You are not logged in.

#1 2004-10-19 20:41:50

Registered: 2003-11-12
Posts: 37

Wireless networking script

In my downtime after midterms big_smile, I decided to remedy for myself one of the things I really wanted in Arch; so here I present my creation:  a unified wireless networking script with support for multiple profiles.  It was quite a learning experience, and IMHO it turned out quite well.  I based it on code from the pcmcia-cs package and the modified version of that which is used for this same purpose in slackware.

wireless script (Both files go in /etc/rc.d/)

Setup is as follows (this text is also in the configuration file)

To get started, copy the last profile and give it a name
Replace *) with <profile_name>), such as:
You must set IFOPTS for each profile following the standard of /etc/rc.conf network interfaces
     IFOPTS="eth0 netmask broadcast"
...otherwise it WILL fail

After creating a profile, you must add some lines to /etc/rc.conf, such as
     WIRELESS=(wlan0 eth1)
...where "home" and "school_wireless" are the default wireless profiles for those devices
The Wireless script will detect whether the devices are present and will succeed if at least one device connects

To switch to another profile once running, use the following syntax
     /etc/rc.d/wireless switch <device_name> <profile_name>
such as:
     /etc/rc.d/wireless switch wlan0 school_wireless
Note: this does not change the default profile for the device

My purpose for creating this was that my card wasnt supported by pcmcia-cs, wlan-ng, etc and it has the added benefit that it should work for any wireless card as long as that card supports iwconfig
Please, any comments,suggestions,fixes,etc are welcome.

This was created for my own personal use and I have tested it as much as humanly possible, but it is not guaranteed to work. 
Just trying to help the community


#2 2004-10-19 20:52:02

Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879

Re: Wireless networking script

i have a similar thing as part of my ndiswrapper script

it uses /etc/conf.d/ndiswrapper for configuration settings (essid, and whatnot)

/etc/rc.d/ndiswrapper uses this to configure wlan0 (which is always used by ndiswrapper) which just uses iwconfig and ifconfig wlan0 up

i then added wlan0 to my network INTERFACES in rc.conf and wlan0="dhcp", then simply put the ndiswrapper module before network.

yeah mine could use some work... for instance - if multiple wireless interfaces, mine forces all to use the same essid....

I may revamp this a bit... maybe set it up to work with all wireless using some of your logic.

perhaps /etc/conf.d/wireless.${INTERFACE_NAME} or even /etc/conf.d/wireless.${PROFILE_NAME} (using your system)... a setting in rc.conf, such as WIRELESS_INTERFACES=() or WIRELESS_PROFILES=() would then be very simple.

yes, I think I like the idea of wireless profiles much better.  you can browse to my repo (in my signature) and check out the ndiswrapper package and see what you think...


#3 2004-10-19 21:20:55

Registered: 2003-11-12
Posts: 37

Re: Wireless networking script

I like your script, simple and effective smile
I avoided integrating my wireless stuff with the network daemon because if i didnt have my card in my laptop, the network daemon would fail sad
Thats why i made mine detect if the card is present before trying anything and made it only fail if none of the cards were present

On the topic of profiles, if Arch ever gets official wireless setup, whether through 'network' or a seperate daemon, I would love to see it based around the idea of profiles.  That, however, is for those people in charge to decide


Board footer

Powered by FluxBB