LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Wireless Networking (https://www.linuxquestions.org/questions/linux-wireless-networking-41/)
-   -   Select wifi configuration based on essid (https://www.linuxquestions.org/questions/linux-wireless-networking-41/select-wifi-configuration-based-on-essid-379455/)

BlueNoteMKVI 11-02-2005 10:23 PM

Select wifi configuration based on essid
 
My laptop goes around with me all over the place, connecting to a wide variety of wireless networks. Most of the time it can get a configuration via DHCP and everything is happy. When I come back home at the end of the day, however, I'd like the laptop to connect to my home network with a static IP so that some backup scripts can run automatically.

There's an interesting script here that does something similar to what I'm looking for, but still requires user intervention to make it happen. I would really like for all of this to happen at boot time without my thinking about it. Here's the general idea, in psuedo-code:

Code:

$list_of_aps=iwlist eth1 scan;
if (in_list($list_of_ips, 'my_home_network'){
//proceed with static IP configuration
}else{
//fall back to DHCP configuration
}

It seems like this could be put into the networking startup script, but I'm not sure how to do it - shell scripting is not my strong suit.

I've seen some programs out there that can handle switching profiles on the fly. That's all well and good...but not really necessary. At the moment there are really only two options - static IP at home, or DHCP elsewhere. I don't want to set up profiles for every coffee house, hotel, classroom or client I visit. Can anyone help out with this script?

mjjzf 11-23-2005 04:40 AM

Yes - any pointers on this one? At present I use Wifi-radar, which is good, but hardly automatic...

BlueNoteMKVI 11-23-2005 08:19 AM

I got it to work using a script called WhereAmI. It took quite a bit of trial and error. I have two laptops here now that use it. Both run the same version and distro but it took wildly different configs to make them both work.

archtoad6 11-26-2005 07:38 AM

You could also set your DHCP server to assign the laptop its "static" IP address according to its MAC address. This ability to do assigned/reserved/"nailed" IP's is present in most, but not all, DHCP servers. My old SMC router could do this, a new model at a client's house could not.

Currently I am using SmoothWall Express 2.0 & considering moving to IPcop.

Assuming you have a DHCP server available, there is the advantage of central administration if you have it assign all those local static IP addresses you want. I currently have only 4 (down from 6) boxen + firewall on my LAN & every one gets its assigned IP from my DHCP server.


All times are GMT -5. The time now is 01:57 AM.