Changing IP address between 2 networks?

Terak

New member
Hey guys.

Let me explain my situation. I use my laptop for work, but whenever I plug in the cable at work I need to set my IPv4 to a static IPv4 given by the company. When I get home, I need to set my IPv4 address to automatic.

Is there a way I can set this up via a .bat file? Its super annoying having to change them twice a day.

My wireless is busted so that is out of the question.

Thanks
 
Hey guys.

Let me explain my situation. I use my laptop for work, but whenever I plug in the cable at work I need to set my IPv4 to a static IPv4 given by the company. When I get home, I need to set my IPv4 address to automatic.

Is there a way I can set this up via a .bat file? Its super annoying having to change them twice a day.

My wireless is busted so that is out of the question.

Thanks

http://support.microsoft.com/kb/283676

That will explain it better than I can. If your using Windows 7 its more or less the same steps.
 
Oh i tried Alternate a while back but there was a value missing. It's working fine now. Thanks :)

Nah mike they don't. I dont meddle with the IT guys, as long as it works i'm happy :D
 
Oh i tried Alternate a while back but there was a value missing. It's working fine now. Thanks :)

Nah mike they don't. I dont meddle with the IT guys, as long as it works i'm happy :D

lol... just slap them and tell them you want DHCP :p... Oh wait thats right, Matthew is your IT guys roflmao :p
 
Ah no now its bombed out again. Apparently the DCHP is enables though. So yeah, still need a solution for this
 
Ah no now its bombed out again. Apparently the DCHP is enables though. So yeah, still need a solution for this

Don't see why its not working if you put the static ip Address as the alternative you should have no problems.

But in anycase why not change your home network so you can use it there without changing ip address all the time.
 
Don't see why its not working if you put the static ip Address as the alternative you should have no problems.

But in anycase why not change your home network so you can use it there without changing ip address all the time.

It wont give me the option to set the alternate IP if I set the original to automatic. I suppose I could change my home pc, but even thats a mission :P
 
You can script this via NETSH, it's a built in windows utility.

First, create a file, call it whatever you like. I called this dhcp.nsh, and for convenience, I saved it in c:\.

Code:
# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip

# Interface IP Configuration for "Local Area Connection"

set address name="Local Area Connection" source=dhcp
set dns name="Local Area Connection" source=dhcp register=PRIMARY
set wins name="Local Area Connection" source=dhcp

popd
# End of interface IP configuration

Change "Local Area Connection" to the correct name of your lan connection, if necessary.
Then create a shortcut on your desktop, point it to C:\Windows\System32\netsh.exe -f C:\dhcp.nsh
Call this shortcut DHCP.

Now, create a new file like before, but call it static.nsh.

Code:
# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip
# Interface IP Configuration for "Local Area Connection"

set address name="Local Area Connection" source=static addr=192.168.0.5 mask=255.255.255.0
set address name="Local Area Connection" gateway=192.168.0.1 gwmetric=0
set dns name="Local Area Connection" source=static addr=192.168.0.1 register=PRIMARY
add dns name="Local Area Connection" addr=192.168.0.2 index=2
set wins name="Local Area Connection" source=static addr=none

popd
# End of interface IP configuration

Change "Local Area Connection" as necessary, and then set the IP settings as you require.

Create a new shortcut on your desktop, point it to C:\Windows\System32\netsh.exe -f C:\static.nsh and call the shortcut STATIC.

Voila.
 
Back
Top