Pular para o conteúdo principal

How to Quickly Add Multiple IP Addresses to Windows Servers

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.


image


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” 192.168.1.2 255.255.255.0



The above command adds the IP Address 192.168.1.2 (with Subnet Mask 255.255.255.0) 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 255.255.255.0



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



image


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


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



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


image


"

Comentários

Postagens mais visitadas deste blog

Favigen, Favicon Generator

Favigen, Favicon Generator : " Favicons are small icons that help identify websites. They are used as a visual representation of a website both in the web browser and at many online services. The three most prominent locations of favicons are the browser’s address bar, the tabbar and the bookmarks folder. Many webmasters like to create custom favicons to add that custom identifier to their website. Favicons can be created in many image and icon editors, but also online. Favigen is a straightforward favicon generator that can turn an image into a favicon. All that it takes is to pick an image from the local hard drive first, select the dimensions of the favicon and click the submit button to make the service generate the favicon. Favigen supports several image formats, including jpg and png, and it does not seem to have size restrictions either. Available image dimensions range are 16×16, 32×32 and 64×64. The generated favicon is displayed directly on the page. A click on do...

A simple rsync script to back up your home directory

A simple rsync script to back up your home directory : " Backing up important data is obviously something we should all do. Unfortunately, it is not always easy to make it happen. We get lazy; we do not have the additional hardware for a backup server; it takes a long time and a lot of CDs to back up to optical media; we do not trust online backup services; backup schemes are difficult to set up and use — any of dozens of reasons can stand in our way. Still, we know we should be backing up our important data. Modern open source Unix-like operating systems offer a plethora of options for incredibly simple, effective backup schemes, however. If the problem is figuring out how to set one up, a simple rsync solution may be exactly what you need. The rsync utility is used to synchronize files between two systems. It does so by way of incremental copies, only copying from the source to the destination what has not already been copied there, saving time, network bandwidth, and syst...

The 10 hottest checklists, forms, and templates of 2010

The 10 hottest checklists, forms, and templates of 2010 : " The 10 hottest checklists, forms, and templates of 2010 Takeaway: TechRepublic published nearly 400 original downloads in 2010 — from cost calculators to cheat sheets to logs, templates, and PowerShell scripts. Here’s a rundown of some of the most popular items of the year. This year, we added hundreds of resources to the TechRepublic downloads library , including PDFs detailing the latest technologies, problem-solving techniques, and tips for handling tasks efficiently. We also updated a few favorite custom tools and introduced some new ones. Among the biggest crowd-pleasers were several checklists designed help you systematically address tasks ranging from server deployments to virus removal to project risk management. Here’s what you liked best in 2010. 1: Workstation Tune-up Checklist Optimizing a slow-performing system requires a number of diagnostic and repair steps, often with...