DHCP and resolv.conf

Mike Lovell toelovell at gmail.com
Fri Jul 6 19:05:16 MDT 2007

Charles Curley wrote:
> I have a firewall, on which I just installed a text mode only ubuntu
> 7.04. I have two problems related to DHCP. Both interfaces use DHCP.
> * Each time a lease renews, dhclient sets /etc/resolv.conf to the
>   server information in that lease's information. I would like to
>   ignore the information for the external interface, and only use that
>   from the internal. I think I have a partial workaround with the
>   prepend domain-name-servers and supersede domain-name statements,
>   but that leaves me either with two entries for each local server, or
>   the local servers and the ISP's servers.
> * When the firewall boots, dhclient uses both routers to configure the
>   routing table. This means I get two default gateways, with the wrong
>   route first. How do I tell dhclient to ignore the internal
>   interface's gateway (which will be the firewall's internal
>   interface)?
> ------------------------------------------------------------------------
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
To start with, I have to ask the question of why you are running dhcp on 
your internal network interface? I can understand wanting to run the 
DHCP server on a different box but it is usually best to have the 
firewall use a static address internally. Anyways, I have some thoughts 
on how to do this.
dhcpcd has command line options to have it skip writing resolv.conf file 
(the -R option) and from specifying a gateway (the -G option). But I am 
guessing that you are using dhclient since it is Ubuntu. In this case, 
you will probably want to edit the dhclient.conf file. With it, you can 
specify to override (or supersede) options returned by the dhcp server. 
You will have to do a bit of playing with it but it should be able to 
override specific options for certain interfaces. Look in the man page 
for dhclient.conf.
Good Luck


More information about the PLUG mailing list