Netsh Network Interface Configuration in Windows XP
In Windows XP, the Network Shell (netsh) command-line
utility gave administrators a scriptable, centralized way to manage
local and remote network interfaces without using the graphical user
interface. By organizing commands into modular contexts,
netsh enabled administrators to assign static and dynamic
IP addresses, configure DNS and WINS servers, back up and restore
network settings, and reset the entire TCP/IP stack during system
troubleshooting.
The interface ip
Context
Windows XP organized netsh functionality into
hierarchical contexts. Administrators targeted network adapter settings
primarily through the interface ip context. Commands could
be executed interactively via the netsh prompt or directly
from the standard Windows command prompt as one-line instructions.
To enter the context interactively:
netsh interface ipConfiguring IP Addresses: Static and DHCP
Administrators identified adapters by their connection names (such as "Local Area Connection").
To switch an interface from dynamic addressing to a static IP address, subnet mask, and default gateway:
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.1.50 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1To revert the interface back to obtain an IP address automatically via DHCP:
netsh interface ip set address name="Local Area Connection" source=dhcpManaging DNS and WINS Settings
netsh provided direct control over primary and secondary
name resolution servers.
To assign a primary static DNS server:
netsh interface ip set dns name="Local Area Connection" source=static addr=192.168.1.10To append a secondary DNS server:
netsh interface ip add dns name="Local Area Connection" addr=192.168.1.11 index=2To configure DNS settings to obtain automatically from a DHCP server:
netsh interface ip set dns name="Local Area Connection" source=dhcpExporting, Scripting, and Batch Deployment
One of the primary benefits of netsh in Windows XP
environments was configuration portability. Administrators could export
an active network configuration to a plain-text script using the
dump command:
netsh interface ip dump > C:\netconfig.txtThis generated script could then be applied to other workstations or
re-applied to restore settings using the exec option:
netsh exec C:\netconfig.txtResetting the TCP/IP Stack
Windows XP installations frequently suffered from corrupted registry
keys controlling the network subsystem, often caused by malware or
faulty driver installations. netsh included a dedicated
repair mechanism to rewrite the TCP/IP registry keys back to a default
operational state:
netsh int ip reset C:\resetlog.txtThis command rewrote the
SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and
SYSTEM\CurrentControlSet\Services\DHCP\Parameters registry
keys, offering a reliable alternative to reinstalling the operating
system.