IP address and cmd

1 04 2010

When I had to set IP address and often changed it, it’s not fun and not convenient to configure all details with Window GUI. cmd /f is what I prefer.

Let’s display the interface’s details

C:\>netsh interface ip show address
Configuration for interface "Local Area Connection"
DHCP enabled: No
IP Address: 192.168.51.243
SubnetMask: 255.255.255.0
Default Gateway: 192.168.51.21
GatewayMetric: 1
InterfaceMetric: 0
C:\>netsh interface ip show config
Configuration for interface "Local Area Connection"
DHCP enabled: No
IP Address: 192.168.51.243
SubnetMask: 255.255.255.0
Default Gateway: 192.168.51.21
GatewayMetric: 1
InterfaceMetric: 0
Statically Configured DNS Servers: 192.168.3.1
Statically Configured WINS Servers: None
Register with which suffix: Primary only

Now, IP address setting is in our control.
C:\>netsh interface ip set address name="Local Area Connection" static 192.168.51.243 255.255.255.0 192.168.51.21 1
Ok.

Do you notice the number behind the gateway address?
That’s gateway metric. So we can set more gateway to our machine.

C:\>netsh interface ip set dns "Local Area Connection" static 192.168.3.1
Ok.

If IP address is distributed with DHCP, configuration is not much different.
C:\>netsh interface ip set address name="Local Area Connection" dhcp
Ok.
C:\>netsh interface ip set dns "Local Area Connection" dhcp
Ok.

With netsh command, IP address setting is more convenient.


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: