In the Exchange 2007 and 2010 world there are definite scenarios where there is a need to add multiple IP addresses to a server so that we can assign specific IP addresses to different web sites. However we do not want clients resolving the Exchange server to multiple A records and getting into a tizzy.
You can a review a previous blog post that I wrote on new functionality that was added to Windows 2008 and Windows 2008 R2 via an update that allows only allowed IP addresses to be registered into DNS. This is a boon especially if you only have a single NIC.
Windows 2012 has this functionality, and also embraces the PowerShell paradigm by providing the same functionality in a PowerShell Cmdlet. Lets review Netsh first then move to PowerShell.
Kicking It Old School
In the below screen shot you can see the Skip As Source parameter:
As a recap, to add the address using Netsh:
Netsh Int IPv4 Add Address <Interface Name><ip address> SkipAsSource=True
"Interface Name" is the name of the interface for which you want to add a new IP address.
"IP address" is the IP address you want to add to this interface
In my case this was the command used:
Netsh Int IPv4 Add Address Ethernet 192.168.2.201 SkipAsSource=True
And the results can be seen below:
And should you want to remove the IPv4 address using Netsh:
Netsh Int IPv4 Delete Address Ethernet 192.168.2.201
Enter The PowerShell
In PowerShell we can achieve the same by leveraging the New-NetIPAddress Cmdlet. First up, let’s take a look at the existing IP addresses via the Get-NetIPAddress cmdlet, and note the current IP of 192.168.2.246 has a value of $False in the SkipAsSource field.
Now let’s add the additional IP address in with the New-NetIPAddress Cmdlet:
New-NetIPAddress -IPAddress 192.168.2.201 -InterfaceAlias Ethernet -SkipAsSource $True
We can see that the SkipAsSource field is set to $True in the above screen shot, and the result is also shown in the Get-NetIPAddress Cmdlet:
Get-NetIPAddress 192.168.2.201
Conclusion
Now you go to parties and impress people with how to add IPs and not have then register into DNS.
Cheers,
Rhoderick