assign ip address through command line

How to assign your computer ip address through command line

System Administrator Windows

It is way to change an ip address on your computer control panel. but there is another way to change an ip address on your computer through command line. in this article we share how to assign an ipv4 address through command line. first open run(windows+R) option then type cmd then enter and command prompt window will come. now we check current configuration using below command

netsh interface ipv4 show config

Configuration for interface “Wireless Network Connection
DHCP enabled: Yes
IP Address: 192.168.2.103
Subnet Prefix: 192.168.2.0/24 (mask 255.255.255.0)
Default Gateway: 192.168.2.1
Gateway Metric: 0
InterfaceMetric: 25
DNS servers configured through DHCP: 192.168.2.1
Register with which suffix: Primary only
WINS servers configured through DHCP: None

Now we change ip address through below command

netsh interface ipv4 set address name=”YOUR INTERFACE NAME” static IP_ADDRESS SUBNET_MASK GATEWAY

Example:

netsh interface ipv4 set address name=”Wireless Network Connection” static 192.168.2.8 255.255.255.0 192.168.2.1

Now we set primary dns server address

netsh interface ipv4 set dns name=”Wireless Network Connection” static 8.8.8.8

Secondary DNS
netsh interface ipv4 set dns name=”Wireless Network Connection” static 4.2.2.2 index=2

Now we again check configuration
netsh interface ipv4 show config

Configuration for interface “Wireless Network Connection”
DHCP enabled: No
IP Address: 192.168.2.8
Subnet Prefix: 192.168.2.0/24 (mask 255.255.255.0)
Default Gateway: 192.168.2.1
Gateway Metric: 256
InterfaceMetric: 25
Statically Configured DNS Servers: 8.8.8.8
4.2.2.2
Register with which suffix: Primary only
Statically Configured WINS Servers: None


 

Leave a Reply

Your email address will not be published. Required fields are marked *