static IP networking

C

Chuck

Is it possible to have 2 static IP addresses for the same interface?

I move my laptop between 2 different networks frequently.
I've seen how to configure between one network with DHCP and
another STATIC. So I'm hoping I can setup some similar with
multiple static IP's.

Scenario:
NET1 has IP scope 192.168.0.x
NET2 has IP scope 10.20.30.x
Both have NETMASK = 255.255.255.0
NET1 has gateway = 192.168.0.254
NET2 has gateway = 10.20.30.254

I've tried >> local area connection properties > properties > general >
TCP /IP properties > (setup info for NET1) >
advanced TCP/IP > (added IP, subnet mask & gateway for NET2)
after which I can ping the local network but not outside the gateway
(The gateway doesn't change with the IP)

Does it have something to do with the "Automatic metric" check box
and the "interface metric" value?
 
S

Steve Winograd [MVP]

"Chuck" said:
Is it possible to have 2 static IP addresses for the same interface?

I move my laptop between 2 different networks frequently.
I've seen how to configure between one network with DHCP and
another STATIC. So I'm hoping I can setup some similar with
multiple static IP's.

Scenario:
NET1 has IP scope 192.168.0.x
NET2 has IP scope 10.20.30.x
Both have NETMASK = 255.255.255.0
NET1 has gateway = 192.168.0.254
NET2 has gateway = 10.20.30.254

I've tried >> local area connection properties > properties > general >
TCP /IP properties > (setup info for NET1) >
advanced TCP/IP > (added IP, subnet mask & gateway for NET2)
after which I can ping the local network but not outside the gateway
(The gateway doesn't change with the IP)

Does it have something to do with the "Automatic metric" check box
and the "interface metric" value?

Yes, an interface can have 2 static IP addresses. However, only one
default gateway can be active at a time, and there's no easy way to
choose between two gateways in the TCP/IP properties.

I recommend defining just one IP address and using the "netsh" command
to switch between the networks:

netsh interface ip set address <connection> static <ip> <mask>
<gateway> <gateway metric>

For example:

netsh interface ip set address "Local Area Connection" static
192.168.0.100 255.255.255.0 192.168.0.254 10

netsh interface ip set address "Local Area Connection" static
10.20.30.100 255.255.255.0 10.20.30.254 10
--

--
Best Wishes,
Steve Winograd, MS-MVP (Windows Networking)

Please post any reply as a follow-up message in the news group
for everyone to see. I'm sorry, but I don't answer questions
addressed directly to me in E-mail or news groups.

Microsoft Most Valuable Professional Program
http://mvp.support.microsoft.com
 
C

ChuckS

I recommend defining just one IP address and using the "netsh" command
to switch between the networks:

netsh interface ip set address <connection> static <ip> <mask>
<gateway> <gateway metric>

For example:

netsh interface ip set address "Local Area Connection" static
192.168.0.100 255.255.255.0 192.168.0.254 10

netsh interface ip set address "Local Area Connection" static
10.20.30.100 255.255.255.0 10.20.30.254 10

Thanx!

What's the significants of the "gateway metric"
and the example value "10"?



a google on "netsh command" led me to:

http://is-it-true.org/nt/nt2000/utips/utips46.shtml
If you need to plug your laptop into different networks, you can save
and restore the appropriate network configuration using the netsh.exe
utility which ships with W2K and XP. When you have your laptop correctly
configured for your office network, you can save the network
configuration for later restoration.

netsh -c interface dump > c:\configs\officeinterface.txt

Now lets say you take it home and reconfigure it correctly for you home
network. To save you home network configuration for later use:

netsh -c interface dump > c:\configs\homeinterface.txt

OK. Now you take the laptop back to the office and you need to
reconfigure for the office environment: nic address, wins, gateway
address... Use the following command to restore your office network
interface:

netsh -f c:\configs\officeinterface.txt

At end of day, you take it home. To setup for home, run:

netsh -f c:\configs\homeinterface.txt

As you can imagine, this is very valuable if you have get your laptop to
function in multiple network locations.
 
S

Steve Winograd [MVP]

ChuckS said:
Thanx!

What's the significants of the "gateway metric"
and the example value "10"?

The netsh command creates a route table entry, and every route table
entry contains an interface metric.

Since there will be only one default gateway, the value of the
interface metric is irrelevant -- it can be anything between 1 and
9999. Windows XP typically assigns 10 to a Fast Ethernet connection.

If there are multiple default gateways, the system uses the one with
the lowest metric.
--
Best Wishes,
Steve Winograd, MS-MVP (Windows Networking)

Please post any reply as a follow-up message in the news group
for everyone to see. I'm sorry, but I don't answer questions
addressed directly to me in E-mail or news groups.

Microsoft Most Valuable Professional Program
http://mvp.support.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top