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?

Write a Comment

Comment

  1. I am having trouble with KB2386184. I have downloaded the hotfix but when I run it I get “The Update is not applicable to your computer.” I have Windows 2008 R2 standard with SP1. The file that downloads is Windows6.1-KB2386184-v2-x64.msu – Do I need to install SP2 first?

  2. This hotfix will reset [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
    “IPEnableRouter” to 0. If you use this setting, you will need to reset it after installing the hotfix.

  3. hi, I just tested on your script, it only work for 1 IP address, and some how I found out another script which solve my problem

    netsh int ipv4 add address name=”Local Area Connection 1″ addr=10.114.1.35
    mask=255.255.255.240 skipassource=true

    Hope this help, any how, thanks for the sharing

Webmentions

  • Merak Mail Servisi Sunucu Çıkış IP Değiştirme – www.boduroglu.org August 27, 2014

    […] Ayrıntılı bilgi APİ […]