Networking Forums

Networking Forums > Computer Networking > Linux Networking > Test for configured ethX

Reply
Thread Tools Display Modes

Test for configured ethX

 
 
CptDondo
Guest
Posts: n/a

 
      03-28-2007, 05:44 PM
I have a machine that travels. I want to configure it differently when
it is attached to a local network and when it is not.

So...

Is there an easy way to test if ethX (eth1 in my case) has received an
IP address via DHCP?

What I want is something like this:

Try to get a DHCP address
If you succeed, do the following
copy network database config file to our config
If you fail, do the following
copy local database config file to our config
start local mysqld

Nothing too complex.... But I can't seem to find a reliable test for the
DHCP assignment.

The box is running Debian Etch, if that matters....

--Yan
 
Reply With Quote
 
 
 
 
Stephane CHAZELAS
Guest
Posts: n/a

 
      03-29-2007, 04:24 PM
2007-03-28, 09:44(-08), CptDondo:
> I have a machine that travels. I want to configure it differently when
> it is attached to a local network and when it is not.
>
> So...
>
> Is there an easy way to test if ethX (eth1 in my case) has received an
> IP address via DHCP?
>
> What I want is something like this:
>
> Try to get a DHCP address
> If you succeed, do the following
> copy network database config file to our config
> If you fail, do the following
> copy local database config file to our config
> start local mysqld
>
> Nothing too complex.... But I can't seem to find a reliable test for the
> DHCP assignment.

[...]

I would use dhclient-script hooks. See:

man dhclient-script

--
Stéphane
 
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
determining which card is which ethX interface spip_yeah@yahoo.com Linux Networking 10 11-08-2006 02:20 PM
fix a particular network card as ethx Ming-Ching Tiew Linux Networking 6 05-03-2006 10:15 PM
pegasus USB ethernet driver loading but no ethX interface Paul Gratz Linux Networking 0 10-15-2004 04:30 PM
Binding of ethX to the interfaces. Dan McDaid Linux Networking 8 07-06-2004 08:12 PM
Possible to have unique ethx for laptop with one CardBus slot, wireless and wired NICs? Jared R. Jones Linux Networking 0 07-01-2004 01:08 PM



1 2 3 4 5 6 7 8 9 10 11