DHCP with static address
Gerald Combs
gerald at zing.org
Mon Aug 23 20:59:28 CDT 2004
Gene Dascher wrote:
> I am running Gentoo on an AMD box. Is it possible to set up my NIC for
> dhcp from a Linksys router, but give it a static IP address? I would
> like my machine to have the same IP address, but be able to get new DNS
> server entries, etc. when necessary.
Gentoo's default DHCP client doesn't appear to have a "set up
/etc/resolv.conf, but don't assign an address" option. If you want to
keep the same address but don't care which address you get, you
shouldn't have to do anything -- Gentoo's default DHCP client caches its
last-assigned address and requests it the next time it has to renew a lease.
If you want to request a specific address, the client has a "-s" flag
that lets you request a specific IP address. You would configure it by
specifying
iface_eth0="dhcp"
dhcpcd_eth0="-s 10.11.12.50"
in /etc/conf.d/net. These two solutions only work if no one else has
grabbed your address, however. If you want to force an address, you
could feed the client a script name using the "-c" option, and have the
script set your address.
More information about the Kclug
mailing list