Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to know if the cable is connected to the interface

Reply
Thread Tools Display Modes

How to know if the cable is connected to the interface

 
 
Osiris
Guest
Posts: n/a

 
      11-27-2004, 07:35 PM
Hi,
I'd like to know if there is a way to know whether the cable is connected
to my interface. The aim is to detect it at startup so as to know if I need
eth0 set up or not (on a laptop), in which case (if not needed) only the
wifi card is set up.

In fact the problem is that if the wifi card AND the eth0 interface are
both set up, I cannot use the wifi card, even if the cable is not plugged
to the eth0 interface.

My route says that the default gw is wlan0, but eth0 is set first.
Any idea ?

 
Reply With Quote
 
 
 
 
Alexander Clouter
Guest
Posts: n/a

 
      11-27-2004, 09:44 PM
Hi,

On 2004-11-27, Osiris <(E-Mail Removed)> wrote:
> Hi,
> I'd like to know if there is a way to know whether the cable is connected
> to my interface. The aim is to detect it at startup so as to know if I need
> eth0 set up or not (on a laptop), in which case (if not needed) only the
> wifi card is set up.
>

'ethtool' or the old fashion 'mii-diag'/'mii-tool'. I would recommend you
have a look at 'whereami' to do a lot of the autodetection; this also would
include you telling it tests it can do on the ethernet port to detect *where*
your laptop is plugged in (work or office?) with ARP pings/mappings and such.

> In fact the problem is that if the wifi card AND the eth0 interface are
> both set up, I cannot use the wifi card, even if the cable is not plugged
> to the eth0 interface.
>

Tis all lies, what you cannot do (without knowing about metrics and more
advanced routing magic) is having two default gateways; your computer does
not know which interface to route traffic out on and then gets confused with
the return traffic; if I remember correctly.

> My route says that the default gw is wlan0, but eth0 is set first.
> Any idea ?
>

My plan would be to munch through 'ethtool eth0' with awk/bash to see if the
cable is plugged in, if not start detecting and configuring the wifi. If the
cable is plugged in then configure it depending on the environment you have
plugged it into.

Tis what I do afterall

Have fun

Alex
 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      11-28-2004, 12:58 PM
Osiris wrote:
> Hi,
> I'd like to know if there is a way to know whether the cable is connected
> to my interface. The aim is to detect it at startup so as to know if I need
> eth0 set up or not (on a laptop), in which case (if not needed) only the
> wifi card is set up.
>
> In fact the problem is that if the wifi card AND the eth0 interface are
> both set up, I cannot use the wifi card, even if the cable is not plugged
> to the eth0 interface.
>
> My route says that the default gw is wlan0, but eth0 is set first.
> Any idea ?
>


Google for iplugd - interface plug daemon.

I'm using it just now on this laptop in the way
you requested.

HTH

--

Tauno Voipio
tauno voipio (at) iki fi

 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      11-28-2004, 01:27 PM
Osiris wrote:

> Hi,
> I'd like to know if there is a way to know whether the cable is connected
> to my interface. The aim is to detect it at startup so as to know if I
> need eth0 set up or not (on a laptop), in which case (if not needed) only
> the wifi card is set up.
>
> In fact the problem is that if the wifi card AND the eth0 interface are
> both set up, I cannot use the wifi card, even if the cable is not plugged
> to the eth0 interface.
>
> My route says that the default gw is wlan0, but eth0 is set first.
> Any idea ?


You could write a script to turn down one interface and bring up the other.
Another possibility, is to use profiles. You'd create a profile for each
configuration. You can then switch profiles at any time, or even at boot
up.

 
Reply With Quote
 
Osiris
Guest
Posts: n/a

 
      12-01-2004, 12:58 PM
James Knott <(E-Mail Removed)> wrote in
news:UvCdnR_fs_DcfTTcRVn-(E-Mail Removed):


Thanks for all the precious info

What is the usual doc/howto to read to get a multiprofile boot up ?


> Osiris wrote:
>
>> Hi,
>> I'd like to know if there is a way to know whether the cable is
>> connected to my interface. The aim is to detect it at startup so as
>> to know if I need eth0 set up or not (on a laptop), in which case (if
>> not needed) only the wifi card is set up.
>>
>> In fact the problem is that if the wifi card AND the eth0 interface
>> are both set up, I cannot use the wifi card, even if the cable is not
>> plugged to the eth0 interface.
>>
>> My route says that the default gw is wlan0, but eth0 is set first.
>> Any idea ?

>
> You could write a script to turn down one interface and bring up the
> other. Another possibility, is to use profiles. You'd create a
> profile for each configuration. You can then switch profiles at any
> time, or even at boot up.
>
>



 
Reply With Quote
 
James Knott
Guest
Posts: n/a

 
      12-01-2004, 01:01 PM
Osiris wrote:

> What is the usual doc/howto to read to get a multiprofile boot up ?
>


That would depend on your distro. I use SuSE, so the searching the help for
SCPM has the info. As for booting into different profiles, that would be
covered under Grub or lilo.

 
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
Two WAPs connected by cable for roaming? al_erola Wireless Internet 4 09-09-2007 09:37 PM
Can cable modems be connected directly to a network switch igniteyourlife@optushome.com.au Windows Networking 3 04-22-2007 05:54 AM
maximum distance for UTP cable connected to 10/100 port urgelab@gmail.com Network Routers 1 04-04-2006 09:12 PM
ADSL Modem Does not work when connected from USB Interface =?Utf-8?B?cmdhbmdhcmE=?= Broadband Hardware 1 12-16-2005 02:49 PM
Wireless Router/Cable Modem Interface Question Don Wireless Internet 5 10-02-2004 09:36 PM



1 2 3 4 5 6 7 8 9 10 11