Name resolution w/ multiple connections

Peter Garrett peter.garrett at optusnet.com.au
Wed Feb 28 00:06:45 UTC 2007


On Tue, 27 Feb 2007 17:55:19 -0500
Anthony Yarusso <tonyyarusso at earthlink.net> wrote:

> So, what I need to know, is how to have both the modem and
> wireless LAN connections up at the same time while maintaining
> nameserver stuff through the dialup connection (except for things
> defined in the hosts file as being local, like "duluth 192.168.1.5")

The DNS settings are being re-written by DHCP from the router. If you want
the nameservers to remain the same, you can override this with an "enter
hooks" file/script. The idea is to pre-empt the replacement of
the /etc/resolv.conf file by your router. 

make a file,  /etc/dhcp3/dhclient-enter-hooks containing the following:

#!/bin/bash

# Stop overwriting /etc/resolv.conf !

function make_resolv_conf {
echo “Doing nothing to resolv.conf”
}


Make the "script" executable

sudo chmod +x /etc/dhcp3/dhclient-enter-hooks

When you next bring up the wireless interface, your nameservers should
remain unchanged. just make sure you have the ones that you need
in /etc/resolv.conf .  It's a funny solution ( a script that explicitly
does nothing), but it works 

I use this here to define my own nameserver IPs and avoid having the ISPs
numbers and/or router IP constantly reappearing in /etc/resolv.conf Simply
making /etc/resolv.conf unwritable does not work, because dhcp actually
*replaces* the /etc/resolv.conf file and not just its contents.

 Give it a try :-)

Peter




More information about the ubuntu-users mailing list