Manually configuring IP addressing in Windows via Command Prompt
As a system administrator in any enterprise IT environment the ultimate goal is to insure system uptime and the consistent availability of network resources. Any delay of service, misconfiguration, system downtime, security breach.. etc will have a huge impact on the employees productivity. Time is not calculated by minutes or hours, it is calculated by dollars and how much the company loses within the down time of IT services, and believe me, there is always someone should be blame in these cases, try not to be you.
As for Linux users command line is the fastest and preferred way to configure, modify and fix any problem in no time. Yet in Windows environment most administrators prefer the GUI method to get the job done. However, Windows can be administrated through command line as well; Windows server 2008 Server Core supports strong command line management capabilities.
Moreover, in a production environment most of the servers running services in The enterprise along with sensitive data storages and critical network gears are physically isolated and secured in what we call The “Server Room”, any system administrator would connect remotely to those gears and servers to control them.
In rare cases the company’s security policy may not grant permissions for level one or two admins to access those gears physically in order to administer them locally.
That why command line administration and remote administration become most important key players in system administration (via telnet, ssh, etc for cisco gears.. or via Microsoft Management Console for Windows server 2008 core server.. etc).
In this short tutorial I will demonstrate how to manually configure IP addressing in Windows using Netsh utility. Netsh is a tool that allows the administrator to configure and monitor Windows based computers using command prompt. You may add, change or modify network parameters by using this utility (among other things), such as IP addresses IPv4 and IPv6, Subnet Mask associated, Default Gateway, NetBIOS, WINS and DNS.. etc
Configuring static IP address on an interface:
Assuming you already at the command prompt. Type in the following one line command:
netsh interface ip set address "Connection_Name" static IPaddress SubnetMask
netsh interface ipv6 set address "Connection_Name" IPv6address
netsh interface ip set address "local area connection" static 192.168.1.100 255.255.255.0
Adding default gateway:
netsh interface ip set address "Connection_Name" static IPaddress SubnetMask DefaultGateway
netsh interface ip set address "local area connection" static 192.168.1.100 255.255.255.0 192.168.1.254
Where 192.168.1.254 is the default gateway.
Configuring automatic obtaining of IP address (via DHCP):
netsh interface ip set address "Connection_Name" dhcp
netsh interface ip set address "local area connection" dhcp
Configuring DNS address staticly:
netsh interface ip set dns " Connection_Name" static dnsAddress
netsh interface ip set dns "Local Area Connection" static 192.168.1.1
Configuring DNS address automatically (via dhcp):
netsh interface ip set dns "Connection_Name" dhcp
netsh interface ip set wins "Local Area Connection" static winsAddress
netsh interface ip set wins "Local Area Connection" static 192.168.1.1
For more details about netsh.exe refer to “Microsoft Technet” website:
1. Netsh.exe utility can be used either locally or remotely. And can perform the following tasks
- Configure interfaces.
- Configure routing protocols.
- Configure filters.
- Configure routes.
- Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.
- Display the configuration of a currently running router on any computer.
Use the scripting feature to run a collection of commands in batch mode against a specified router.
2. Usually the System Administrator doesn’t need to configure a static IP addresses for the hosts, only critical network infrastructures are to be assigned static addresses such as Servers, Routers and switches.
3. For netsh Usage:
netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]Use
rName] [-p Password | *]
[Command | -f ScriptFile]
The following commands are available:
? – Displays a list of commands.
add – Adds a configuration entry to a list of entries.
advfirewall – Changes to the `netsh advfirewall’ context.
branchcache – Changes to the `netsh branchcache’ context.
bridge – Changes to the `netsh bridge’ context.
delete – Deletes a configuration entry from a list of entries.
dhcpclient – Changes to the `netsh dhcpclient’ context.
dump – Displays a configuration script.
exec – Runs a script file.
firewall – Changes to the `netsh firewall’ context.
help – Displays a list of commands.
http – Changes to the `netsh http’ context.
interface – Changes to the `netsh interface’ context.
ipsec – Changes to the `netsh ipsec’ context.
lan – Changes to the `netsh lan’ context.
nap – Changes to the `netsh nap’ context.
netio – Changes to the `netsh netio’ context.
p2p – Changes to the `netsh p2p’ context.
ras – Changes to the `netsh ras’ context.
rpc – Changes to the `netsh rpc’ context.
set – Updates configuration settings.
show – Displays information.
wcn – Changes to the `netsh wcn’ context.
winhttp – Changes to the `netsh winhttp’ context.
wins – Changes to the `netsh wins’ context.
winsock – Changes to the `netsh winsock’ context.
wlan – Changes to the `netsh wlan’ context.
|Print article||This entry was posted by Nathan on 08/04/2011 at 12:37 am, and is filed under Microsoft, Windows 7, Windows Server 2003, Windows Server 2008, Windows Vista, Windows XP. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site.|