Assigning a Static IP Address with command line


Some group policies designed to disable “Network connection” feature in control panel.
If the policy was deployed to OU in active directory, it will avoid administrator from viewing this feature.
If from some reason administrator wants to get a static IP, using the command line is a workaround to accomplish this:
1.To display a list of network interfaces,run the following command (Start < Run < type ‘cmd’ < press ‘run’:
netsh interface ipv4 show interfaces

2.Make note or screen capture of the name and unique ID of the network interfaces listed.

3.To change the IP address to a Static IP, use this command line:
netsh interface ipv4 set address name=”<ID\Name>” source=static address=<RequestedStaticIP>
mask=<Subnetmask> gateway=<Defaultgateway>

Replace ”<ID\Name>” with the requested network interface ID or name from section 2.
Replace <RequestedStaticIP> with the new IP address.
Replace <Subnetmask> with the appropiate subnet mask for this IP.
Replace <Defaultgateway> with the default gateway.

When using the same network as IP scope that was used with DHCP, just copy the <Subnetmask> and <Defaultgateway>
IP addresses.
When using an IP address from DHCP scope, make sure to exclude this IP address in DHCP server first.

4.For each Static DNS configuration entry, use this in command line:
netsh interface ipv4 add dnsserver name=”<ID\Name>” address=<DnsServerIP>index=1
add dnsservers “local area connection” (Which is DNS IP) index=2

5.Check Configurations using the command:
IPConfig /all