Windows : Add entire subnet in a batch

By | February 19, 2013

Adding a bunch of IP to windows through the GUI is a nightmare! Fortunately, you can enter a single command that will add them in a second.

Simply open the command prompt and type the following command :

Let’s explain every piece of that command :

<IP_START> would be the first usable IP of your range
<IP_END> would be the last usable IP of your range
<IP_SUBNET> is the first three numbers of your range
<IP_NETMASK> is your netmask

In a nutshell, suppose we want to add the following C class : 192.168.1.32/27 (which represent 32 IPs)
SUBNET IP : 192.168.1.32
USABLE IPs : 192.168.1.33 – 192.168.1.62
BROADCAST  : 192.168.1.63
NETMASK : 255.255.255.224

The command would be :

NOTE : If your changed the default interface name (Local Area Connection), you need to enter the new interface name between the double quotes.