Windows Server 2008 r2 ip management from the shell
Hello everybody 🙂
Sometimes we have to do some not ordinary things, and it is really difficult to find the solution over the network.
Perhaps, this post will help somebody, who wants to change the outgoing IP at his server based on Windows 2008. The main issue, that Windows server has no “primary” IP anymore. If your server’s NIC has a set of IPs, numerically less IP will be set automatically as a default outgoing IP. And it is not cool! So you are really not allowed to change the outgoing IP on the Windows server in general! To do that, you have to do the following steps:
a) download the hotfix: http://support.microsoft.com/kb/975808
b) install it
c) reboot your server
d) reconfigure the server using provided in the article shell command.
To simplify console management I will improve you with the following commands:
1) ipconfig – will list all IPs on your server
ipconfig | find /i “ipv4” – will find and show only IPv4 Ips on your server, use find command to cut not necessary information from the shell command output, find will left only strings, which contains the expression you will enter in quotes.
2) Netsh int ipv4 add address
example: netsh int ipv4 add address “Local Area Connection” 192.168.1.2 255.255.255.255 skipassource=true
2.1) “Local Area Connection” – your NIC’s name,
2.2) skipassource=true – magical flag, which makes selected IP to be ignored as an outgoing IP address. In simple words, next numerically bigger IP becomes a default outgoing IP for traffic.
3) netsh int ipv4 delete address “Local Area Connection” 192.168.1.2
Will remove the IP from the server’s configuration
So, if you have on your Windows 2008 r2 server 2 IPs: 220.127.116.11 and 18.104.22.168, after the installed hotfix and rebooted server you will be able to do the following, to make your .2 IP source ip:
0) check your IP at ipchicken.com, it should be 22.214.171.124
1) netsh int ipv4 delete address “Local Area Connection” 126.96.36.199
2) netsh int ipv4 add address “Local Area Connection” 188.8.131.52 255.255.255.255 skipassource=true
3) check your IP at ipchicken.com, it should become 184.108.40.206
Happy server administrating! (: