USB 3G Modem on Slackware – DNS

A follow up from last years post – clearly having not played around with the 3G card since last year, it’s only today I realised that DNS wasn’t actually working. PPPD was correctly requesting the nameservers from the remote peer, but by default, puts them into /etc/ppp/resolv.conf. This isn’t terribly helpful.

PPPD will try to call out to /etc/ppp/ip-{up,down} when bringing a connection up or d’own. By creating these and making them executable, we can get them to set up DNS for us.

I’ve therefore created them as follows:

/etc/ppp/ip-up:

#!/bin/sh

# Change DNS resolvers
if [ -f /etc/resolv.bak ]; then
  echo "/etc/resolv.bak exists!"
else
  cp /etc/resolv.conf /etc/resolv.bak
  rm /etc/resolv.conf
  ln -sf /etc/ppp/resolv.conf /etc/resolv.conf
fi

/etc/ppp/ip-down:

#!/bin/sh

# Change DNS resolvers back.
if [ -f /etc/resolv.bak ]; then
  rm /etc/resolv.conf
  mv /etc/resolv.bak /etc/resolv.conf
else
  echo "/etc/resolv.bak missing!"
fi

With this, running wvdial now also takes care of DNS properly and I can actually resolve domain names (you can also extend these scripts if you want things like VPN, etc, but in my case, this is more than sufficient).

Posted on August 24, 2012 at 11:02 pm by Carlos Corbacho · Permalink
In: Linux, Slackware

Leave a Reply

You must be logged in to post a comment.