You are not logged in.

#1 2008-09-19 22:55:12

jordanwb
Member
From: Ontario, Canada
Registered: 2008-07-01
Posts: 151

[Solved]Detecting if an interface exists

My laptop usually (but may not always) uses my wifi card (using ndiswrapper) to use the net. If the interface doesn't exist  and Arch tries to configure it... well it's like dividing by zero in VB6. So I want to write a bash script that will set up the wifi card if it exists. How do I go about checking if a given network interface exists?

Last edited by jordanwb (2008-09-22 13:01:40)

Offline

#2 2008-09-20 00:36:36

kclive18
Member
From: Columbus, Ohio, USA
Registered: 2008-05-08
Posts: 219

Re: [Solved]Detecting if an interface exists

You really don't need to write a bash script (although you can).  Try this:

hwdetect --show-net

My Rigs:
- Mid-2007 iMac 20", Intel 2GHz Core 2 Duo, 2x1GB DDR2-800, 250GB SATA HDD, and...MIGHTY MOUSE!!! tongue, OSX 10.5 Leopard, ATI Radeon 2400XT 128MB
- HP zv6203cl, AMD Athlon 64 3200 S939, 2x512MB DDR400, 80GB 4200rpm HDD, ATI Radeon Xpress 200M 128MB, Arch i686 cool
- 1986 Gibson SG Junior Cherry Red, Ibanez 15W amp, DigiTech RP250 modeling processor

Offline

#3 2008-09-20 00:38:42

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: [Solved]Detecting if an interface exists

ifconfig
iwconfig

Do either of those commands help?


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2008-09-20 00:59:19

jordanwb
Member
From: Ontario, Canada
Registered: 2008-07-01
Posts: 151

Re: [Solved]Detecting if an interface exists

kclive18 wrote:

You really don't need to write a bash script (although you can).

If the interface doesn't exist, bootup stalls for about 10 seconds.

Offline

#5 2008-09-20 02:09:48

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: [Solved]Detecting if an interface exists

jordanwb wrote:

If the interface doesn't exist, bootup stalls for about 10 seconds.

Looking in /sys/class/net should be one way. Ifconfig -a could help as well for unconfigured devices.

How are you configuring your network{s) though? If it's from a startup script what about just backgrounding it to avoid the stall in those cases? Also, instead of having to write your own...have you taken a look a netcfg2?

Last edited by somedrew (2008-09-20 02:13:32)

Offline

#6 2008-09-20 17:10:43

jordanwb
Member
From: Ontario, Canada
Registered: 2008-07-01
Posts: 151

Re: [Solved]Detecting if an interface exists

somedrew wrote:

How are you configuring your network{s) though? If it's from a startup script what about just backgrounding it to avoid the stall in those cases?

I configure it through /etc/rc.conf How would I go about backgrounding it? By using the @ symbol?

Offline

#7 2008-09-22 01:51:37

tigrmesh
IRC Op
From: Florida, US
Registered: 2007-12-11
Posts: 794

Re: [Solved]Detecting if an interface exists

jordanwb wrote:

How would I go about backgrounding it? By using the @ symbol?

Correct.

Offline

#8 2008-09-22 13:01:26

jordanwb
Member
From: Ontario, Canada
Registered: 2008-07-01
Posts: 151

Re: [Solved]Detecting if an interface exists

tigrmesh wrote:
jordanwb wrote:

How would I go about backgrounding it? By using the @ symbol?

Correct.

Okee dokee.

Thanks.

Offline

Board footer

Powered by FluxBB