in Network, Windows, Windows Server

How to set the primary IP address of a Windows server 2008 R2

In the Windows server 2003 days this was an easy task. Just type the primary IP address first and any additional IP addresses won’t be used as the outgoing IP address. However, in Windows server 2008 this is not so simple and there seems to be no easy GUI way of doing that.

When using multiple IP addresses in Windows server 2008, the IP address closest to the default gateway is used as the outgoing IP address. I cannot think of why Microsoft choose to do that but it has been causing problems on one of my servers lately.

Here’s the hard way (and probably the only way):

1. Download three optional hot fixes from Microsoft:

  • KB2386184: This is a patch adding a feature to exclude IP addresses from the list of IP addresses allowed as the outgoing IP address (e. source). This is the key patch allowing us to “select” the primary IP address.
  • KB2554859: KB2386184 was buggy and seems to be a quickfix. This hotfix fixes a bug where the GUI used to manage IP addresses on the server clears the configurations made using the new feature added by KB2386184 .
  • KB2551090: Apparently KB2386184 created another bug where you couldn’t select IP addresses excluded as outgoing IP address. This fixed that.

2. Restart the server. The addons won’t work until the server is restarted.

3. Remove any IP address on the server that are closer to the default gateway than the IP address you want to configure as the primary IP address. (If you are not sure, remove all IP addresses that should not be the primary IP address)

For example if the default gateway is 192.168.1.1 and the server has two other IP addresses: 192.168.1.2 and 192.168.1.3, 192.168.1.2 will be used as the default outgoing IP address because it is closer to the default gateway IP address.

4. Open a command prompt (Start -> Run -> cmd)

5. Add all IP addresses that you removed and should not be used as the default outgoing IP address with the skipassource=true flag (added by KB2386184) using this command. You can only set the skipassource flag by adding IP addresses, there’s no update method available to set this property.

netsh int ipv4 add address "Local Area Connection" 192.168.1.2 255.255.255.0 skipassource=true

Replace “Local Area Connection” with the name of your network adapter/connection, 192.168.1.2 with the IP address being imported and 255.255.255.0 with the correct subnet mask on your network.

6. To view a list of IP address and which is skipped as source address, use this command:

netsh int ipv4 show ipaddresses level=verbose

That’s all, pretty easy right?