Saturday, 11 July 2015

Windows Returns Wrong IP Address With Multiple Addresses Defined

I have a Windows 2012 R2 Server that used to have two NICs installed (Network Interfaces). One was my home IP Address of 192.168.3.3 and the other was 192.168.1.3 which is used to host a separate network which has my IP Cameras installed.

Recently my home server went TITSUP*, so I replaced the motherboard with a simple MSI one which only had a single NIC. No problem, I put both networks onto the same network through a switch and assigned two IP Addresses to the NIC (multi-homed).

The reason I have two IP Addresses is to separate the two networks (obviously) but more importantly the second Network (with its IP Address) actually leaves the house and connects to the IP Cameras. If some miscreant were to obtain access to that cable, he would have access to my internet lovely stuff, therefore that network is configured to restrict that.

OK, the problem I had was that the server was returning the 192.168.1.3 address when it was pinged with the server's name. This then stopped my internal computers from accessing the server via the GUI unless 192.168.3.3 was used instead.

The solution was to use Windows PowerShell and make sure the second address (and probably any more IPs you have) have the SkipAsSource flag set.

You do this by removing the second IP by using the GUI. Starting PowerShell and then run the following commands (note that nothing in windows is case-sensitive. Capitalisation serves to make the commands clearer to read:

Get-NetIPAddress <- To find the names (aliases) of the installed adapters ["Ethernet" in my case]

Set-NetIPAddress -IPAddress 192.168.1.3 -InterfaceAlias "Ethernet" -PrefixLength 24 -SkipAsSource $True

After this, the correct IP will be reported to a Ping....

Note, if you use the GUI again, the SkipAsSource flag will be reset to false.

*TITSUP - Total Inability To Support Usual Performance