How-To Geek

How to Quickly Add Multiple IP Addresses to Windows Servers

If you have ever added multiple IP addresses to a single Windows server, going through the graphical interface is an incredible pain as each IP must be added manually, each in a new dialog box. Here’s a simple solution.


Needless to say, this can be incredibly monotonous and time consuming if you are adding more than a few IP addresses. Thankfully, there is a much easier way which allows you to add an entire subnet (or more) in seconds.

Adding an IP Address from the Command Line

Windows includes the “netsh” command which allows you to configure just about any aspect of your network connections. If you view the accepted parameters using “netsh /?” you will be presented with a list of commands each which have their own list of commands (and so on). For the purpose of adding IP addresses, we are interested in this string of parameters:

netsh interface ipv4 add address

Note: For Windows Server 2003/XP and earlier, “ipv4” should be replaced with just “ip” in the netsh command.

If you view the help information, you can see the full list of accepted parameters but for the most part what you will be interested in is something like this:

netsh interface ipv4 add address “Local Area Connection”

The above command adds the IP Address (with Subnet Mask to the connection titled “Local Area Network”.

Adding Multiple IP Addresses at Once

When we accompany a netsh command with the FOR /L loop, we can quickly add multiple IP addresses. The syntax for the FOR /L loop looks like this:

FOR /L %variable IN (start,step,end) DO command

So we could easily add every IP address from an entire subnet using this command:

FOR /L %A IN (0,1,255) DO netsh interface ipv4 add address “Local Area Connection” 192.168.1.%A

This command takes about 20 seconds to run, where adding the same number of IP addresses manually would take significantly longer.

A Quick Demonstration

Here is the initial configuration on our network adapter:

ipconfig /all


Now run netsh from within a FOR /L loop to add IP’s to this adapter:

FOR /L %A IN (10,1,20) DO netsh interface ipv4 add address “Local Area Connection” 192.168.1.%A

After the above command is run, viewing the IP Configuration of the adapter now shows:


Jason Faulkner is a developer and IT professional who never has a hot cup of coffee far away. Interact with him on Google+

  • Published 01/26/11

Comments (8)

  1. mike

    i love tips like this, but one has to ask.. why would you have more than 1 ip on the same nic?

  2. Jacob Adams


  3. darkness

    You will come accross issues with this and applications unless they are network aware. An easy one you will see this with is Netbios, it will only pick one of the IP addresses to listen on. So this may cause you issues with your clients connecting. Another reason to do this is to have multiple applications listen on the same port. Say like two instances of SQL where you don’t need to change the default port it is communicating on.

  4. san

    how about adding the Gateway.?

  5. piagetblix

    FOR /L %A IN (10,1,20) Why is the ‘1’ needed in between the beginning and ending values? defining the gateway???


  6. sco

    To add the gateway:

    netsh int ipv4 add address gateway= gwmetric=1

    The 1 is the “step.” It is incrementing the address by one so you get:

  7. sco

    Correction on the gateway…
    netsh int ipv4 add address “Local Area Connection” gateway= gwmetric=1
    (or whatever you want the metric to be)

  8. Sascha

    @mike: when using ssl certificates for running websites on https:// without any certificate warnings, you need one ip address per certificate, and usually one certificate only serves one domain.
    for this reason, many webservers have to use multiple ips on the same nic. my company for example would need 14 (!) ip addresses if it weren’t for the ssl certificates, but we are actually using 37 ip addresses.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!