LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DHCP Fallback IP? (http://www.linuxquestions.org/questions/linux-networking-3/dhcp-fallback-ip-558036/)

Zylar 05-31-2007 12:28 PM

DHCP Fallback IP?
 
Distro=Centos4.4

Is there a simple way have the IP set to something specific if a DHCP request fails? I've looked into zcip and zeroconf a bit, but can't seem to figure them out. I want to use DHCP, but also want to know the IP if DHCP fails.

Thanks.

marozsas 05-31-2007 01:52 PM

I believe some RFC document out of there assigns the network 169.254.0.0/16 for this purpose.
I am not sure, but this is a good start point to discuss or to google.

vesperatus 05-31-2007 02:12 PM

Marozsas is right, this is the ip you will get, but i'm unsure if it's only in the case of a failed dhcp request. You will get the same ip if there is NO dhcp on the network too. Do you want to assign an ip in the case the host making the request is NOT in the dhcp config ?

Zylar 06-01-2007 08:23 AM

Thanks Mar, I was pretty sure that was the case too. I'd like it to be a 192.168.1.X address though.

Yeah Ves, headless NAS device, destination environment unknown. I'd like it to be available via local DNS if possible (using DHCP) or if no local DNS/DHCP, I'd like to know what the address is.

vesperatus 06-01-2007 09:36 AM

If you know all the hosts that will connect to your server, you can identify them in the dhcpd.conf file using the "host" option and assign a different ip to all other host trying to connect to your server. If that fits your need, i can post a sample dhcpd.conf file.

Zylar 06-01-2007 10:52 AM

I believe (maybe incorrectly) that CentOS uses dhclient.conf for dhcp configuration.

According to 'man dhclient.conf' "The configuration file can also be preinitialized with addresses to use on networks that don’t have DHCP servers.". Unfortunately, I can't seem to find dhclient.conf, maybe it's being renamed/redirected/? via init scripts, I don't know.

I'll keep looking, thanks though.

Edit: Interesting link. Too bad it doesn't apply to 4.4 :(

Zylar 06-01-2007 12:30 PM

Ok, created '/etc/sysconfig/network-scripts/ifcfg-eth0:0' :

Code:

DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.222.0
NETMASK=255.255.255.0
IPADDR=192.168.222.22
USERCTL=no

This just binds a 2nd static ip to the nic, using an alias. Not really what I wanted, but will work until I figure out the dhclient.conf stuff.


All times are GMT -5. The time now is 05:41 AM.