Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo-style WLAN config
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
trapperjohn
Apprentice
Apprentice


Joined: 11 Nov 2003
Posts: 242
Location: Bremen/Germany

PostPosted: Sun Feb 01, 2004 7:43 pm    Post subject: Gentoo-style WLAN config Reply with quote

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
View user's profile Send private message
trapperjohn
Apprentice
Apprentice


Joined: 11 Nov 2003
Posts: 242
Location: Bremen/Germany

PostPosted: Wed Feb 04, 2004 6:45 am    Post subject: Reply with quote

Any feedback? Is it so bad? :-(
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Feb 11, 2004 2:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
trapperjohn
Apprentice
Apprentice


Joined: 11 Nov 2003
Posts: 242
Location: Bremen/Germany

PostPosted: Thu Feb 12, 2004 9:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Fri Feb 13, 2004 10:27 am    Post subject: Reply with quote

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
View user's profile Send private message
drdebian
n00b
n00b


Joined: 07 Apr 2004
Posts: 49

PostPosted: Mon Apr 12, 2004 4:10 am    Post subject: Re: Gentoo-style WLAN config Reply with quote

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
View user's profile Send private message
ForestJump
n00b
n00b


Joined: 08 Apr 2004
Posts: 13
Location: München

PostPosted: Thu Sep 02, 2004 2:46 pm    Post subject: Reply with quote

nice script ! I'm using it on my laptop.... :wink:
Back to top
View user's profile Send private message
matthias*
Tux's lil' helper
Tux's lil' helper


Joined: 03 Aug 2004
Posts: 144
Location: Paris

PostPosted: Wed Sep 08, 2004 10:39 am    Post subject: Reply with quote

+1

thanks :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum