0

On Windows10, I would like to be able to set multiple static IP addresses (eg. 192.168.0.250, 192.168.10.250, 10.0.7.250) on the computer ethernet interface card if no DHCP server is found.

I know Windows has an alternate configuration tab in TCP/IP settings to do that but there I can only set one static IP address.

Is there a way to do be able to set multiple IP addresses as an alternate configuration ?

Loïc G.
  • 111
  • 7

2 Answers2

0

You don't need to go to alternate configuration. Go to general tab and click advanced. In IP settings tab, Then click Add. Add the each static IP address with their subnet masks. Make sure to disable DHCP and uncheck Obtain IP address automatically and insert your Gateway (Usually router's IP address).

Wasif
  • 7,984
  • 2
  • 19
  • 32
  • No, you can't add multiple static addresses there when DHCP is configured because the "Add" button is disabled. – Loïc G. Jun 11 '20 at 06:55
  • Then you have to disable DHCP configuration on router and assign each device connected to LAN a static TCP/IP settings and disable DHCP client in your PC. – Wasif Jun 11 '20 at 07:01
  • I know but I can't change router settings. – Loïc G. Jun 11 '20 at 07:02
0

From command line, using netsh:

These commands are used to view your NICs and IDs:
netsh interface ipv4 show interfaces
netsh interface ipv4 show ip

This commands sets an IP address on NIC with [id]. Execute the command multiple times for multiple IPs.
netsh interface ipv4 set address name=[id] source=static address=[static ip] mask=[subnet mask] gateway=[default gateway]

Using powershell command:
Set-NetIPAddress –InterfaceIndex [id] –IPAddress [newIP] –PrefixLength [subnet length, ie 24]

Krackout
  • 103
  • 5
  • And what about the DHCP ? It will be automatically disabled after running these commands which set static IP address. I would like to keep the DHCP feature to use it when available – Loïc G. Jun 11 '20 at 06:56
  • How about using a script to check if a dhcp is available, or if you got an IP address. Perhaps you could check for 169.254.x.x IP, which means that no dhcp server was found or IP leased and in that case use the above commands to set static IPs. – Krackout Jun 11 '20 at 07:10
  • Yeah but once the static IPs would be set, the DHCP feature will be disabled on the NIC. I could execute a script on cable connection but I don't know how to do this. How to catch this cable connection event. – Loïc G. Jun 11 '20 at 07:17
  • Cannot help you with an event driven - cable connection event - script either. But you could use a time interval to execute the script, per minute for example. In this scenario you could also go back to dhcp lease when it's available, reverting from static IPs. – Krackout Jun 11 '20 at 07:23
  • I just found [this](https://superuser.com/questions/262799/how-to-launch-a-command-on-network-connection-disconnection) I will have a look at it. Thanks for the hint ! – Loïc G. Jun 11 '20 at 07:24
  • Interesting, I'll also keep the link you sent for reference. – Krackout Jun 11 '20 at 07:27