WindowsServer2012R2

How to change IP Address from command prompt

How to change IP address from Command Prompt

In this post we’ll learn the steps to assign an IP address to Windows Server 2012 R2 from command prompt. We’ll use Netsh command to change an IP. IP (Internet Protocol) is an identify of your Computer. It is required for computers to communicate with teach other. There are multiple ways to change the IP address, in addition to that you can either assign static IP address to your Computer or Dynamic IP address to your Computer. DHCP Server is required if you want Dynamic IP Address to be assigned to your Server.

1. Right click on start and select the command prompt (admin).

ChangeIPAddressFromCommandPrompt

2. On User Account Control window click on “Yes” to open command prompt.

ChangeIPAddressFromCommandPrompt

3. Type command “ipconfig” to check an IP address of your computer. This shows an APIPA IP address. APIPA is “Automatic Private IP Addressing“, this concludes that our computer is not able to communicate with DHCP Server as currently we don’t have any DHCP in our environment.

ChangeIPAddressFromCommandPrompt

4. To assign an IP to our computer type “Netsh“. It will show “netsh>” console. Then type “Interface IP” this will change the console to “netsh interface ipv4“.

ChangeIPAddressFromCommandPrompt

5. Type the command “set address “Ethernet0” static 192.168.1.10 255.255.255.0 192.168.1.1“. In this command “Ethernet0” is the name of our Ethernet Adapter. As we are assigning static IP address therefore we need to mention an IP address and a subnet mask. 192.168.1.10 is an IP address that we want to assign and 255.255.255.0 is a subnet mask. In addition to IP we are also assigning Gateway to this computer after subnet mask we can define the gateway which is 192.168.1.1 in this example.

ChangeIPAddressFromCommandPrompt

6. Moreover we need to define DNS information. Type a command “set dnsservers “Ethernet0” static 192.168.1.10 primary” to define the primary DNS. Here, “Ethernet0” is the name of our network adapter and 192.168.1.10 is the IP of DNS.

ChangeIPAddressFromCommandPrompt

7. Type “Exit” to exit from netsh interface ipv4 console.

ChangeIPAddressFromCommandPrompt

8. Type “ipconfig /all” to verify that static IP address, subnet mask, default gateway and DNS server IP is assigned.

ChangeIPAddressFromCommandPrompt

 

If you are not fond of commands then you can change IP address from GUI.

Related articles: