1

I'm creating simple program to add address via windows form. It's actually only call this command:

netsh interface ip add address

The address was successfully added, but after executing that command, I lost my internet connection. I had to restart to regain the connection.

Is there a command to add second ip address without losing internet connection?

Thanks

manus
  • 25
  • 3
  • 1
    What Windows version are you using? – Daniel Mar 09 '15 at 12:10
  • @Daniel, it's windows 7 – manus Mar 09 '15 at 12:23
  • Could you be more specific about your nic cards:- i.e. weather you have two nics and you are trying to give ip address to one while using other for internet, or only one nic and you are trying to give it an ip address. In second case, if your ISP is providing you IP address i.e. dynamic IP address, and you are trying to use your own then obviously it would cause issue. This might be due to one of two reasons 1) – Damon Mar 09 '15 at 12:31
  • @Damon, it's the second case. On linux i use this command: "ip address add 10.10.1.1 dev wlan0" & works fine (address added & internet still connected). So I'm looking for similar solution in windows. – manus Mar 09 '15 at 12:46
  • Mostly ISPs don't allow you to edit your IP address unless you have requested static IP from your ISP. If you still edit your IP statically, it might cause IP conflict, and would cause the Internet to disconnect. – Damon Mar 09 '15 at 12:50

1 Answers1

1

The netsh command you are using is correct. However, you can only add IP addresses to an interface with a static ip.

If your interface is connected with a dynamic IP address assigned by a DHCP server, the netsh interface ip add address command switches the interface from dynamic to static and then adds the IP address.

You are either losing your internet connection because you assign an IP address from a different net, or because you are assigning an IP address in the same net without setting the gateway.

Daniel
  • 6,940
  • 6
  • 33
  • 64