View previous topic :: View next topic |
Author |
Message |
trapperjohn Apprentice
Joined: 11 Nov 2003 Posts: 242 Location: Bremen/Germany
|
Posted: Sun Feb 01, 2004 7:43 pm Post subject: Gentoo-style WLAN config |
|
|
Gentoo-style WLAN config
I created my own little Gentoo-style WLAN script to configure WLAN-settings easily in the same way wired network is configured. In contrast to the script already posted to "Networking & Security" by someone else, it allows configuration of different access points/ESSIDs by creating a config file per access point (so you don't have to touch your /etc/conf.d/net for every AP .. just add a new file to the config directory).
You may have a look at it:
net.eth0 -> /etc/init.d/net.eth0
net -> /etc/conf.d/net
myessid -> /etc/wireless/myessid
Remember: Always backup important config files ...
Replace /etc/init.d/net.eth0 and link to it correctly. The link must be called like your wireless device - if it's eth1 you would link like this:
Code: | ln -sf /etc/init.d/net.eth0 /etc/init.d/net.eth1 |
Now replace /etc/conf.d/net and edit it. Tell the script, which interface is wireless and set different options (as you can see in the example file above):
Code: | iface_eth1="wlan"
# ... and other options |
(BTW: I replaced the default iface_ethX, because I think, the IP/netmask-configuration should be based on the access point, you want to connect to - not based on the device)
Don't forget to re-set your wired network config (cause you replaced the old one )
Now you can create a file for every access point (if you want to configure just one access point, you can also do this directly in /etc/conf.d/net) named after its ESSID. The default path for these files is /etc/wireless, but you can override this name in /etc/conf.d/net.
At the moment, you can configure just basic options (access-point-scanning on/off, essid, wepkey, nick and dhcp/static ip) but advanced features can simply be added (but I think, most people don't need more).
It worked for me so far, although I've got some problems with my router. Scanning always returns only my neighbours AP until I set the correct ESSID. But this is another story ...
Hope you like this script ... else forget it I'd like to hear some feedback. |
|
Back to top |
|
|
trapperjohn Apprentice
Joined: 11 Nov 2003 Posts: 242 Location: Bremen/Germany
|
Posted: Wed Feb 04, 2004 6:45 am Post subject: |
|
|
Any feedback? Is it so bad? |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Wed Feb 11, 2004 2:06 pm Post subject: |
|
|
I'm the author of the "other" scripts in the Network forum
https://forums.gentoo.org/viewtopic.php?t=122435
Some comments - although I haven't actually tried your scripts.
How will you handle ESSID's with strange characters like spaces and " and \ and / in them?
Does your iwlist scan command return ESSID's with these characters in?
You don't have a preferred ESSID access list - some people require this.
If you have one ESSID set to DHCP and another to static and flip between the two will DHCP be killed/started correctly?
Will it correctly bring down the interface for PCMCIA users (I'm not sure if this is a problem for your scripts - just something that mine failed to do for a while) when the card is removed?
Saying all that, you have given me one idea for mine - a seperate file for the preferred access list as a tab seperated list which I use at the moment will probably confuse users. |
|
Back to top |
|
|
trapperjohn Apprentice
Joined: 11 Nov 2003 Posts: 242 Location: Bremen/Germany
|
Posted: Thu Feb 12, 2004 9:01 pm Post subject: |
|
|
UberLord wrote: |
How will you handle ESSID's with strange characters like spaces and " and \ and / in them? |
Can iwconfig set ESSIDs with special characters? If I call 'iwconfig wlan0 my\ essid', there is no error, but the ESSID is not set ..
Quote: |
Does your iwlist scan command return ESSID's with these characters in?
|
Yes.
Quote: |
You don't have a preferred ESSID access list - some people require this.
|
No, I only have just one fall-back ESSID when no AP is found. This is just because I've never been in the situation to be in reach of two access points which I have both configured. My script just uses ESSID of the first configured AP or the fall-back ESSID.
Quote: |
If you have one ESSID set to DHCP and another to static and flip between the two will DHCP be killed/started correctly?
|
I did not really test this - but as I added the parameter -n, dhcpcd won't fail if it is recalled. It just gets a new lease.
Quote: |
Will it correctly bring down the interface for PCMCIA users (I'm not sure if this is a problem for your scripts - just something that mine failed to do for a while) when the card is removed?
|
Never tried this - I don't own any PCMCIA cards. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Feb 13, 2004 10:27 am Post subject: |
|
|
trapperjohn wrote: |
Can iwconfig set ESSIDs with special characters? If I call 'iwconfig wlan0 my\ essid', there is no error, but the ESSID is not set .. |
Yes it can
Code: | iwconfig eth1 essid "test\" one" |
connects to the essid test" one |
|
Back to top |
|
|
drdebian n00b
Joined: 07 Apr 2004 Posts: 49
|
Posted: Mon Apr 12, 2004 4:10 am Post subject: Re: Gentoo-style WLAN config |
|
|
trapperjohn wrote: | Gentoo-style WLAN config[/size]
Now replace /etc/conf.d/net and edit it. Tell the script, which interface is wireless and set different options (as you can see in the example file above):
Code: | iface_eth1="wlan"
# ... and other options |
(BTW: I replaced the default iface_ethX, because I think, the IP/netmask-configuration should be based on the access point, you want to connect to - not based on the device)
Don't forget to re-set your wired network config (cause you replaced the old one )
|
Can your script be adapted such that pcmcia cards will get a different name? Not eth?, but wlan? or something like that?
You see I have a number of dynamically assigned interfaces and I need to know which is the wireless one to assign special security (iptables) to it. |
|
Back to top |
|
|
ForestJump n00b
Joined: 08 Apr 2004 Posts: 13 Location: München
|
Posted: Thu Sep 02, 2004 2:46 pm Post subject: |
|
|
nice script ! I'm using it on my laptop.... |
|
Back to top |
|
|
matthias* Tux's lil' helper
Joined: 03 Aug 2004 Posts: 144 Location: Paris
|
Posted: Wed Sep 08, 2004 10:39 am Post subject: |
|
|
+1
thanks |
|
Back to top |
|
|
|