Change IP configurations based on connected wireless network
March 26, 2008 10:53 AM   Subscribe

Is there a way to change IP configurations for a Wireless Netword Connection based on the Wireless network I am currently connected using Vista or any third-party software?

I currently work home-based and sometimes I work on some customers. Problem is that I use fixed IP address at home and would like to use DHCP when I am on a customers site.

Currently, I have to switch my TCP/IP settings whenever I change sites. Does anyone know how to automate this?
posted by fcoury to Computers & Internet (10 answers total) 2 users marked this as a favorite
 
This isn't a perfect answer, but if you can't make Vista do it, could you setup a dhcp server at home that you could hard code the addresses into?
posted by rbs at 10:58 AM on March 26, 2008


Best answer: Write a batch script using the netsh command.

So at home you would do something like this:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1

At work or wherever you'd do

netsh interface ip set address "Local Area Connection" dhcp


Both these examples are from here. Or spring for a dhcp server at home.
posted by damn dirty ape at 11:05 AM on March 26, 2008 [1 favorite]


Try Odyssey Access Client:

Download here

You can install a 30 day eval from there. Make sure you get version 4.72, it supports Vista.

It's list price is $50. You can purchase it online by searching for OAC-ADD-1CLT.

Google Price
posted by JintsFan at 12:39 PM on March 26, 2008


Response by poster: A mix of what damn dirty ape suggested with Elevate Power Toys, that allows a user to run scripts as administrator, gave me exactly (or almost exactly) what I wanted.

I have created two batch files that runs given commands with elevation, so all I need to do is:

When arriving at customer:
Start > Run > setout

When arriving back home:
Start > Run > sethome

And that's it! Super!

The only best scenario I can imagine, would be to detect the network change and run those automagically.

Any hints anyone?
posted by fcoury at 3:13 PM on March 26, 2008


I used to have this issue, but I made it go away by using DHCP at home as well, and setting the DHCP server in my router so it always hands out a preset IP address to my laptop's MAC. That lets me do all those convenient fixed-IP things like port forwarding, without having to mess with the laptop's network settings at all.
posted by flabdablet at 4:39 PM on March 26, 2008


Response by poster: flabdablet, I could have easily fixed that if my low end D-Link WBR-1310 Wireless Router had an option to always give same IP address to a given network card by its MAC address. Unfortunately that's not an option.

I have an Ubuntu server laying around, but I think I never got in the mood to spare time and try to run the DHCP server. That would be an option, but I would have to redirect all clients to obtain IP addresses from that machine. Don't think so :-)

Well, now to the good news: I have managed to automate the task of resetting my network back to home fixed IP automatically!

All I had to do was create a new task on the awesome revamped Vista Task Scheduler.

In this new version, you have an option to run a given task only if you're connected to a given network.

In addition to that, I configured the task to run every time I unlock my notebook, witch is the case, since I will be returning from the customer with the notebook on sleep mode.

A have to admit this new scheduler caught me by surprise, and I must admit that's one of the first times I've got surprised (at least in a good way) by Vista. I might even write a blog article about it :-).

Thanks for all replies.
posted by fcoury at 5:07 PM on March 26, 2008


Best answer: Glad you're sorted.

For the record, though, this is wrong:

I would have to redirect all clients to obtain IP addresses from that machine

Since the first step in DHCP is a broadcast request from the client, any available DHCP server will do. The clients don't need to know a DHCP server address before they start. All you'd need to do is turn off DHCP in the WBR-1310 to make sure it never handed your laptop a bum IP.

If you do get in the mood to fool about with DHCP on the Ubuntu box, install bind9 on it as well and fool about with DNS too. As well as having fixed IP addresses, your local machines can also have nice tidy DNS names inside .fcoury.lan :-)
posted by flabdablet at 5:55 PM on March 26, 2008


Response by poster: Since the first step in DHCP is a broadcast request from the client, any available DHCP server will do. The clients don't need to know a DHCP server address before they start. All you'd need to do is turn off DHCP in the WBR-1310 to make sure it never handed your laptop a bum IP.

Really!? I consider myself a technical savvy person, since I am a systems engineer for 12 years now and - shame on me - I didn't know that! :-)

I will definitely enable DHCP on Ubuntu. Any good startup references you would recommend?

The outcome of this question may turn out to be even better than I first thought.

Thanks again!
posted by fcoury at 7:21 PM on March 26, 2008


This and a quick read of this should get you there.
posted by flabdablet at 7:50 PM on March 26, 2008


Response by poster: Done! Even easier with Webmin installed (my server has no UI). Just had to install dhcp3 and configure a host, so a fixed IP is now assigned to my notebook.

SUPER! It really turned out to be a better outcome than I would ever imagine.

Thanks again!!!
posted by fcoury at 8:01 PM on March 26, 2008


« Older Good Food in SF   |   Hope me please. Thanks. Newer »
This thread is closed to new comments.