Tuesday, December 11, 2007

Set up IP from Command Prompt

Setting up IP addresses from the Command Prompt is a fundamental skill for network administrators and IT professionals tasked with managing and configuring network connectivity. The Command Prompt, also known as cmd or cmd.exe, is a command-line interpreter available in Windows operating systems. It provides a powerful and efficient way to execute various network-related commands, including those related to IP address configuration. In this article, we will explore the step-by-step process of setting up IP addresses using the Command Prompt, covering essential commands and best practices for effective network configuration.

You can set up IP from Command Prompt by using this NETSH command.
Syntax: netsh interface ip
 
Usage:
set address [name=]<string>
[[source=]dhcp |
[source=] static [addr=]IP address [mask=]IP subnet mask]
[[gateway=]<IP address>|none [gwmetric=]integer]


Parameters:

  • Tag: Value
  • name: The name of the interface.
  • source: One of the following values:
    • dhcp: Sets DHCP as the source for configuring IP addresses for the specific interface.
    • static: Sets the source for configuring IP addresses to local static configuration.
  • gateway      - One of the following values:
    • <IP address>: A specific default gateway for the static IP address you are setting.
    • none: No default gateways are set.
  • gwmetric: The metric for the default gateway. This field should not be set if gateway is set to 'none'.

The following options are used only if source is 'static':
  • addr: An IP address for the specified interface.
  • mask: The subnet mask for the specified IP address.

 
Remarks: 

Used to change the IP address configuration mode from either DHCP to static mode or static mode to DHCP. Adds IP addresses on an interface with static IP address or adds default gateways.

 
Examples:
set address name="Local Area Connection" source=dhcp
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1


full syntax:
netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1

In conclusion, mastering the ability to set up IP addresses from the Command Prompt is a valuable skill that empowers network administrators and IT professionals to efficiently manage network configurations. By following the step-by-step instructions outlined in this article, users can gain confidence in utilizing the Command Prompt for IP address configuration tasks, such as assigning static IP addresses, configuring DNS settings, and troubleshooting network connectivity issues. Continual practice and exploration of command-line tools like the Command Prompt contribute to a deeper understanding of networking concepts and enhance the ability to maintain a stable and reliable network infrastructure.