Skip site navigation (1)Skip section navigation (2)
Date:      08 Oct 2003 09:01:28 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        "Roger 'Rocky' Vetterberg" <listsub@401.cx>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   [RTFM pointer] Re: dhcp overrides default route
Message-ID:  <44llrvg9xz.fsf@be-well.ilk.org>
In-Reply-To: <3F83F1AA.7060702@401.cx>
References:  <3F83F1AA.7060702@401.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
"Roger 'Rocky' Vetterberg" <listsub@401.cx> writes:

> Lets say you have this in rc.conf:
> 
> ifconfig_dc0="inet 1.2.3.4 netmask 255.255.255.0"
> ifconfig_dc1="DHCP"
> default_router="1.2.3.254"
> 
> The network on dc1 is 192.168.0.0/24 with the default router on that
> subnet being 192.168.0.254.
> 
> If I reboot the box, dhclient will set default router to
> 192.168.0.254, overriding the value I specified in rc.conf.
> Is there a way to prevent that?
> 
> Right now, I have a shellscript that runs as soon as the box is
> finished booting that resets the default route to its correct value,
> but somehow it feels that this is not the right way to do it.

Right.  What you want to do is simply tell dhclient(8) not to do that.
The way you do that configuration is with dhclient.conf(5).

I would recommend the following statement: 
        prepend routers 192.168.0.254

My own dhclient.conf looks like the following, in which the only
statement that actually does anything useful is the one pointing the
main name server entry at myself.

    # $FreeBSD: src/etc/dhclient.conf,v 1.2.2.1 2001/12/14 11:44:31 rwatson Exp $
    #
    #	This file is required by the ISC DHCP client.
    #	See ``man 5 dhclient.conf'' for details.
    #
    #	In most cases an empty file is sufficient for most people as the
    #	defaults are usually fine.
    #
    interface "fxp0" { 
     request subnet-mask, broadcast-address, routers, domain-name-servers, 
             domain-name, host-name; 
     send host-name "lowellg.ne.client2.attbi.com";
     send dhcp-lease-time 5184000;

     prepend domain-name-servers 127.0.0.1;

    # require domain-name-servers; 
    # default host-name "lowellg";
    # default domain-name "ne.mediaone.net";
    # supersede host-name "lowellg.ne.mediaone.net";
    } 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44llrvg9xz.fsf>