Recently, well, It was yesterday. So yesterday, in a project, I had 300 computers that were powered up for the first time, and one of my technicians and I needed to set IP addresses to all computers. Two people have 300 computers, so it makes 150 each. With the GUI, there are multiple steps. Go to start, then settings, network settings, blah blah blah. Oh my God. After a couple of computers, I just got frustrated and gave up.
Now you can tell me, “Oh Roosho! Roosho!! Roosho!!! You claim to be the jack of all IT trades. You are just a fool. You could easily set up the DHCP server in the router, and the router should take care of everything”. Yes you are absolutely right. I thought of that. But, the project I was working on requires specific static IPs for particular computers.
As a programmer and a Linux administrator, I prefer writing some commands over clicking Mouse. I am more comfortable with that. So if there is a way to run some commands in the command prompt and set up the static IP, that would be great. Here I am sharing how to set up the static IP of Windows 10 using the command prompt.
To set a static IP address on Windows 10 using the Command Prompt, you can follow these steps:
Start MS-DOS as Administrator
To do this, open Run by pressing Windows+R. Write “cmd” and press Ctrl+Shift+Enter to open Command Prompt/MS-DOS as Administrator. Or, type “cmd” into the search bar on the taskbar, then right-click on the “Command Prompt” result and select “Run as administrator” from the menu. You can visit this article to know all the ways of how to start command prompt.
Select the Network Adapter and set Network Credentials
If you have only one NIC card the Network Adapter name will be Ethernet unless you have changed it. In the Command Prompt window, type the following command mentioning the Network Adapter Name, IP Address, subnet mask and default gateway and press Enter.
netsh interface ip set address name="<Interface Name>" static <IP Address> <Subnet Mask> <Default Gateway>
Set DNS via Command (Bonus)
If you want to set the DNS Server addresses as well type the following command mentioning the Network Adapter Name, IP Address of the Preferred DNS Server.
netsh interface ip add dns "<Interface Name>" <DNS Address>
For Alternative DNS type the following
netsh interface ip add dns "<Interface Name>" <DNS Address> INDEX=2
Finally, Verify your Configuration
To verify that the IP address has been changed, you can use the following command
ipconfig /all
This command will show you all of the network adapter settings, including the new static IP address.
This is how I did it. But still I’m looking for a more easy way. If you have any you can share that with me.
One Comment
great