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?