fir3net
PPS-Firenetbanner-780.5x190-30-03-17

Windows - netsh - Change you IP address via the CLI

Netsh.exe is a network administration tool that allows you to configure and monitor Windows-based computers at a command prompt. With the Netsh.exe tool, you can direct the context commands you enter to the appropriate helper, and the helper then carries out the command.

Setting you IP address

Below is the syntax for setting the IP address for your wireless connection and adding to DNS servers. Note you can get the name of your interface from the IP config command.

netsh interface ip set address name="Wireless Network Connection 3" static [ip] [netmask] [gw]
netsh interface ip set dns "Wireless Network Connection 3"  static [dns server ip]
netsh interface ip add dns "Wireless Network Connection 3" [dns server ip] index=2

Saving your configuration and importing

To export your configuration

netsh -c interface dump > c:\location1.txt

To import your configuration

netsh -f interface dump > c:\location1.txt

Windows firewall

Below shows the syntax for opening a port, showing your firewall state, and disabling the firewall

netsh firewall set portopening tcp 445 smb enable
netsh firewall show state
netsh firewall set opmode disable

GUI

netsh diag GUI

Diagnostics

Below will connect to the default incoming and outgoing mail servers then drop the connection. Easier for customers than trying to telnet to the mail server ports.

netsh diag connect mail

Reset all IP protocol stack configurations on your interface and send the output to a log file.

netsh int ipv4 reset resetlog.txt

 

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001