Networking Forums

Networking Forums > Computer Networking > Linux Networking > DHCP failover to static IP addr

Reply
Thread Tools Display Modes

DHCP failover to static IP addr

 
 
Bob Williams
Guest
Posts: n/a

 
      10-25-2004, 10:53 PM
I am configuring a Fedora Core2 Test2 system.
I would like to activate eth0 using dhcp, but if that fails (no dhcp server
on the network) I would like to assign a static IP address.

One approach is using dhclient and creating an /etc/dhclient.conf file:

send host-name "home.test";
send dhcp-client-identifier "home";
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
timeout 30;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;

lease {
interface "eth0";
option host-name "home.test";
fixed-address 10.1.1.1;
renew 1 2004/10/25 22:24:33;
rebind 2 2004/10/26 04:00:03;
expire 2 2004/10/26 05:30:03;
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.1.255;
option domain-name "test";
}

This functions normally when a DHCP server is present on the net, but when
there is no server, 'ifup eth0' tries 10.1.1.1 but fails. It fails during a
verification process for 10.1.1.1 resulting in bash dumping its environment
variables and the contents of
/etc/sysconfig/network-scripts/network-functions. It then displays a usage
message for ping... eth0 remains down.

Does anyone know if this is a proper use for the fixed-address parameter of
a lease in the dhclient.conf file?

If this doesn't work, I guess I could just write a script that checks if the
interface is up after initial network startup. If not, it can configure the
interface with a static IP address.

Any suggestions?
Thanks in advance


 
Reply With Quote
 
 
 
 
Joachim Maeland
Guest
Posts: n/a

 
      10-25-2004, 11:24 PM
On Mon, 25 Oct 2004 15:53:16 -0700, Bob Williams wrote:

> I am configuring a Fedora Core2 Test2 system. I would like to activate
> eth0 using dhcp, but if that fails (no dhcp server on the network) I
> would like to assign a static IP address.

[..]
> If this doesn't work, I guess I could just write a script that checks if
> the interface is up after initial network startup. If not, it can
> configure the interface with a static IP address.
>
> Any suggestions?


Not sure if this will do what you are looking for...:

man dhclient-script:
"After all processing has completed, /sbin/dhclient-script checks for
the presence of an executable /etc/dhclient-exit-hooks script, which if
present is invoked using the '.' command."

AFAIK, a /etc/dhclient-exit-hooks script can be used to set the desired
default static IP address...

http://chrismetcalf.net/wiki/index.p...sForLinuxHacks
http://zeroconf.sourceforge.net/

--
mvh/regards
Joachim Mæland

If everything seems under control, you're just not going fast enough.
-Mario Andretti

 
Reply With Quote
 
CL (dnoyeB) Gilbert
Guest
Posts: n/a

 
      10-27-2004, 08:15 PM
Bob Williams wrote:
> I am configuring a Fedora Core2 Test2 system.
> I would like to activate eth0 using dhcp, but if that fails (no dhcp server
> on the network) I would like to assign a static IP address.
>
> One approach is using dhclient and creating an /etc/dhclient.conf file:
>
> send host-name "home.test";
> send dhcp-client-identifier "home";
> request subnet-mask, broadcast-address, time-offset, routers,
> domain-name, domain-name-servers, host-name;
> timeout 30;
> retry 60;
> reboot 10;
> select-timeout 5;
> initial-interval 2;
>
> lease {
> interface "eth0";
> option host-name "home.test";
> fixed-address 10.1.1.1;
> renew 1 2004/10/25 22:24:33;
> rebind 2 2004/10/26 04:00:03;
> expire 2 2004/10/26 05:30:03;
> option subnet-mask 255.255.255.0;
> option broadcast-address 10.1.1.255;
> option domain-name "test";
> }
>
> This functions normally when a DHCP server is present on the net, but when
> there is no server, 'ifup eth0' tries 10.1.1.1 but fails. It fails during a
> verification process for 10.1.1.1 resulting in bash dumping its environment
> variables and the contents of
> /etc/sysconfig/network-scripts/network-functions. It then displays a usage
> message for ping... eth0 remains down.
>
> Does anyone know if this is a proper use for the fixed-address parameter of
> a lease in the dhclient.conf file?
>
> If this doesn't work, I guess I could just write a script that checks if the
> interface is up after initial network startup. If not, it can configure the
> interface with a static IP address.
>
> Any suggestions?
> Thanks in advance
>
>


Any reason why you cant have 2 IP addresses on eth0, one static and one
DHCP?

--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber." John 10:1

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP Failover config darren5972 Windows Networking 2 04-26-2009 05:10 PM
Can I access a Router which is on private static ip addr from ISP using leased ethernet line? GS Linux Networking 7 10-30-2005 06:52 PM
How can I assign static DNS addr? GS Linux Networking 6 05-22-2005 11:24 PM
DHCP Failover JB Windows Networking 4 12-19-2003 06:00 PM
BT adidom addr appears on our DHCP server? Jann Broadband 2 07-08-2003 05:40 PM



1 2 3 4 5 6 7 8 9 10 11