Get Configuration Info
Using the command below, you can gather information on the adapter’s current configuration. Make note of the connection name since that is what is used to in the configuration command further down.
netsh interface ip show config
You can see the existing configuration with the following command.
netsh interface ip dump
Set Interface DHCP
To set interface address as DHCP, issue the following. Change the items highlighted in Red to suite your environment.
Note: Use the above command (netsh interface ip dump
) to figure out which interface you need to use. Default is “Local Area Connection” but many environments will differ. Match the interface= portion and supply that in the Red sections below. I’m leaving the default of “Local Area Connection” but you can see that my interface would be “Ethernet”.
netsh interface ip set address "Local Area Connection" dhcp
You also can set the DNS statically or via DHCP as well.
netsh interface ip set dns "Local Area Connection" 8.8.4.4
Set a secondary DNS server:
netsh interface ip set dns "Local Area Connection" 8.8.4.4 index=2
Set Interface Static
Set the interface with a static address. Change the items in Red to suite your environment.
netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric
Set the DNS server statically.
netsh interface ip set dns "Local Area Connection" 8.8.4.4
Set a secondary DNS server:
netsh interface ip set dns "Local Area Connection" 8.8.4.4 index=2