Last Updated on August 7, 2025 by Arnav Sharma
With the Netsh command-line utility, you have a powerful tool at your disposal to configure and monitor your network interfaces, firewall, and other network-related settings. Here are 20 Netsh command examples, each with detailed explanations, to help you become a network management pro.
1. Display Network Interfaces
To see all of your network interfaces, use:
netsh interface show interface
This command lists all network interfaces on your system, showing their state, whether they’re connected, and if they’re admin enabled.
2. Assign a Static IP Address
Set a static IP for an Ethernet connection:
netsh interface ip set address "Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1
Replace “Ethernet” with your interface’s name, and the IP addresses with your desired static IP, subnet mask, and default gateway.
3. Switch to DHCP
To obtain an IP address automatically from a DHCP server:
netsh interface ip set address "Ethernet" dhcp
This command is useful when moving from a static IP to an automatic configuration.
4. Set a Static DNS Server
Define a specific DNS server for an interface:
netsh interface ip set dns "Ethernet" static 8.8.8.8
This sets Google’s DNS server as your primary DNS server.
5. Obtain DNS Automatically
To revert to obtaining DNS server addresses automatically:
netsh interface ip set dns "Ethernet" dhcp
This is useful when switching back to a dynamic network environment.
6. Add a Secondary DNS Server
Add a backup DNS server:
netsh interface ip add dns "Ethernet" 8.8.4.4 index=2
This adds Google’s secondary DNS server for redundancy.
7. Enable IP Forwarding
Turn on IP forwarding for an interface:
netsh interface ipv4 set interface "Ethernet" forwarding=enabled
This is particularly useful for setting up a machine as a router.
8. Reset TCP/IP Stack
To reset the TCP/IP stack:
netsh int ip reset resetlog.txt
This can resolve a multitude of network connectivity issues.
9. Export Interface Configuration
Save your interface configuration to a file:
netsh interface ip dump > interface_config.txt
This is a great way to back up your configuration before making changes.
10. Import Network Configuration
To apply a saved configuration:
netsh -f interface_config.txt
This command restores your network settings from a file.
11. Enable Windows Firewall
Turn on the firewall for all profiles:
netsh advfirewall set allprofiles state on
Security is paramount, and this ensures your firewall is active.
12. Block All Incoming Connections
To enhance security by blocking all unsolicited attempts to connect:
netsh advfirewall set allprofiles firewallpolicy blockinbound,allowoutbound
This setting is useful for a lockdown scenario.
13. Allow a Program Through the Firewall
Create an exception for a specific application:
netsh advfirewall firewall add rule name="Allow MyApp" dir=in action=allow program="C:Program FilesMyAppapp.exe"
Replace the path with the actual location of the executable you wish to allow.
14. Delete a Firewall Rule
Remove a previously added rule:
netsh advfirewall firewall delete rule name="Allow MyApp"
This is how you revoke access when it’s no longer needed.
15. Show Wireless Networks
List all available wireless networks:
netsh wlan show networks
A quick way to scan for Wi-Fi networks around you.
16. Connect to a Wireless Network
To connect to a known wireless network:
netsh wlan connect name="YourSSID"
Replace “YourSSID” with the actual network name.
17. Display Wireless Drivers
Check the wireless drivers installed:
netsh wlan show drivers
This can help troubleshoot wireless network issues.
18. Add Wi-Fi Profile from XML
Import a Wi-Fi profile from an XML file:
netsh wlan add profile filename="pathtowirelessprofile.xml"
This is useful for deploying network settings across multiple machines.
19. Delete Wi-Fi Profile
Remove a stored Wi-Fi profile:
netsh wlan delete profile name="YourSSID"
Use this to clear out old or unused Wi-Fi profiles.
20. View Current IP Configuration
To see your current IP settings:
netsh interface ipv4 show config
This provides a detailed view of your IP configuration.
By mastering these Netsh commands, you’ll be well-equipped to handle a wide range of network configurations and troubleshooting tasks. Remember to open the command prompt as an administrator to ensure these commands execute properly. With Netsh, you’re just a few keystrokes away from a fully customized network setup.