[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: detecting ethernet connection



You probably want the package "ifplugd". That'll let you configure network interfaces when the cable is plugged in.

	Luke Reeves
	http://www.neuro-tech.net/

Bill Moseley wrote:
I'm looking for a utility to see if the internal interface is connected
-- the so-called "link-beat" detection.  I have a toshiba laptop with
EtherExpress PRO/100+ MiniPCI.

I know about the laptop-net package, but I don't want all the
schema/profile setup, I just want to test for the link when switching
between wireless and wired setup.

My laptop is normally on the wireless card.  The wireless is eth1 and
the built-in network interface is eth0.

Since it's normally on on the wireless I don't have eth0 brought up by
default at boot time just to save time.

What I'd like is:

  - at boot, if eth0 is connected then ifup eth0
  - on pcmcia insert (which is normally the case on boot)
    bring down eth0 and bring up eth1
  - on pcmcia remove bring down eth1 and bring up eth0 if it's plugged
    into the cable.

In other words, bring up eth0 only if the cable is connected.

BTW -- I looked at the man page for interfaces(5) and it doesn't seem like
there's a way to use a program's return value to decide if the interface
should be brought up or not:

   The  following "command" options are available for every family and
   method.  Each of these options can be given multiple times in a
   single stanza, in which  case  the  commands  are executed  in  the
   order in which they appear in the stanza.  If one of the commands
   fails, none of the others will be executed but the interface will
   still be configured.  (You  can ensure a command never fails by
   suffixing "|| true".)

Which, I think it would be handy if a command fails then the interface
is not brought up.  That would make it easy to have a command that tests
if the interface is actually connected.








Reply to: