Using Netsh, you'll be able to display and modify the network configuration, either locally or remotely. It also provides command-line alternative capability to modify and add programs and services into Windows firewall. In addition to that, Netsh can save the configuration script for archival, backup and reference purposes.
Let’s focus on these top features of the command-line utility.
NETWORK CONFIGURATION (Windows 7/Vista/XP)
How to see and inspect the current tcp/ip settings using Netsh
Netsh interface ipv4 show config or C:\Windows\system32>netsh netsh>interface netsh interface>ip netsh interface ipv4>show config |
Using Netsh to backup the tcp/ip configuration of your computer
netsh interface dump > c:\backup\lanconfig.dat or netsh -c interface dump > c:\backup\networkconfig.txt |
The two commands saves the current configuration into a text file
How to Restore your previous network configuration using netsh
cd c:\backup netsh exec lanconfig.dat or netsh -f c:\backup\networkconfig.txt |
How to Configure Network Internet Protocol (IP) Addresses using Netsh (look at the arrows of the images above)
Using Static Address
Command Pattern (Syntax)
netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric
Sample
netsh interface ip set address "Local Area Connection" static 192.168.0.31 255.255.255.0 192.168.0.1 1 |
Using Dynamic Host Configuration Protocol (DHCP) Server to obtain the IP address automatically
netsh interface ip set address "Local Area Connection" dhcp |
Configuring DNS Server using Netsh (Please see the picture above)
netsh interface ip set dns "Local Area Connection" static 192.168.0.1 Dynamically obtain the ip-address netsh interface ip set dns "Local Area Connection" static dhcp |
References
http://support.microsoft.com/kb/257748
http://www.windowsitpro.com/article/resource-kit/cool-things-to-do-with-netsh
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
WINDOWS FIREWALL CONFIGURATION
Firewall Services (tested at Windows XP Professional)
Having some problems administering your network application via Windows Firewall, try and study these various commands using Netsh…
FileAndPrint - File and Printer Sharing
remotedesktop - remote desktop and assistance
remoteadmin - remote administration
netsh firewall set service fileandprint enable netsh firewall set service fileandprint disable netsh firewall set service remotedesktop enable netsh firewall set service remotedesktop disable netsh firewall set service remoteadmin enable netsh firewall set service remoteadmin disable |
How to add a program-based exception to the firewall
netsh firewall add allowedprogram program="C:\Softwares\sky\Skypetron.exe" name="SKY PETRON" mode=enable netsh firewall add allowedprogram program="C:\Softwares\sky\Skypetron.exe" name="SKY PETRON" mode=disable |
How to remove the added program from Windows Firewall listing
netsh firewall delete allowedprogram program="C:\Softwares\sky\Skypetron.exe" |
References
http://technet.microsoft.com/en-us/library/cc771046(v=ws.10).aspx#bkmk_addallowedprogram
WIRELESS NETWORK (WIFI) CONFIGURATION
Want to connect to a wireless network via command prompt? here’s how… Read here
More on Wireless LAN samples
C:\Windows\system32>netsh wlan show hostednetwork Hosted network settings ----------------------- Mode : Allowed Settings : <Not configured> Hosted network status --------------------- Status : Not available C:\Windows\system32>netsh wlan show hostednetwork setting=security Hosted network security settings -------------------------------- Authentication : WPA2-Personal Cipher : CCMP User security key : <Not specified> C:\Windows\system32>netsh wlan show interfaces There is 1 interface on the system: Name : Wireless Network Connection Description : Broadcom 802.11g Network Adapter GUID : 6301e8b5-4429-4504-92e9-e5a4c95bdd46 Physical address : 00:25:56:4a:84:96 State : connected SSID : SM_Free_WiFi BSSID : 00:24:82:0a:ca:59 Network type : Infrastructure Radio type : 802.11g Authentication : Open Cipher : None Connection mode : Discovery (unsecured) Channel : 11 Receive rate (Mbps) : 54 Transmit rate (Mbps) : 54 Signal : 40% |
How to show all visible networks using Netsh
C:\Windows\system32>netsh wlan show networks Interface name : Wireless Network Connection There are 7 networks currently visible. SSID 1 : SM_Free_WiFi Network type : Infrastructure Authentication : Open Encryption : None SSID 2 : Network type : Infrastructure Authentication : Open Encryption : None SSID 3 : Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP SSID 4 : PLDTMyDSL-TRIBAL BTQ. Network type : Infrastructure Authentication : WPA-Personal Encryption : CCMP SSID 5 : aswats0n5 Network type : Infrastructure Authentication : WPA2-Personal Encryption : TKIP SSID 6 : Gerrys Grill_WIFI_Access Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP SSID 7 : ballenas wifi Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP C:\Windows\system32> |
Showing all wifi-networks (mode=bssid)
C:\Windows\system32>netsh wlan show networks mode=bssid Interface name : Wireless Network Connection There are 6 networks currently visible. SSID 1 : SM_Free_WiFi Network type : Infrastructure Authentication : Open Encryption : None BSSID 1 : 00:24:82:0a:c8:79 Signal : 14% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 2 : 00:24:82:0a:ca:59 Signal : 40% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 3 : 00:24:82:0a:d2:59 Signal : 28% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 4 : 00:24:82:0a:c8:b9 Signal : 83% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 5 : 00:24:82:0a:ce:39 Signal : 38% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 6 : 00:24:82:0a:c8:f9 Signal : 28% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 7 : 00:24:82:0a:c8:e9 Signal : 38% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 8 : 00:24:82:0a:c6:d9 Signal : 14% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 SSID 2 : Network type : Infrastructure Authentication : Open Encryption : None BSSID 1 : 00:24:82:4a:d2:59 Signal : 32% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 2 : 00:24:82:8a:d2:59 Signal : 24% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 3 : 00:24:82:4a:c8:b9 Signal : 80% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 4 : 00:24:82:8a:c8:b9 Signal : 80% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 5 : 00:24:82:4a:ce:39 Signal : 50% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 6 : 00:24:82:8a:ce:39 Signal : 50% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 7 : 00:24:82:8a:c8:e9 Signal : 36% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 8 : 00:24:82:4a:ca:59 Signal : 38% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 9 : 00:24:82:8a:ca:59 Signal : 36% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 10 : 00:24:82:4a:c8:f9 Signal : 34% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 11 : 00:24:82:8a:c6:d9 Signal : 14% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 12 : 00:24:82:4a:c8:e9 Signal : 38% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 13 : 00:24:82:4a:c6:d9 Signal : 14% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 14 : 00:24:82:4a:c8:79 Signal : 6% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 15 : 00:24:82:8a:c8:f9 Signal : 34% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 SSID 3 : Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP BSSID 1 : 00:24:82:4a:ce:38 Signal : 22% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 2 : 00:24:82:4a:c8:b8 Signal : 81% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 3 : 00:24:82:4a:ca:58 Signal : 40% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 4 : 00:24:82:4a:d2:58 Signal : 32% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 5 : 00:24:82:4a:c8:e8 Signal : 36% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 6 : 00:24:82:4a:c6:d8 Signal : 10% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 BSSID 7 : 00:24:82:4a:c8:f8 Signal : 34% Radio type : 802.11g Channel : 1 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 SSID 4 : PLDTMyDSL-TRIBAL BTQ. Network type : Infrastructure Authentication : WPA-Personal Encryption : CCMP BSSID 1 : 20:2b:c1:c9:3e:28 Signal : 16% Radio type : 802.11n Channel : 9 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 SSID 5 : aswats0n5 Network type : Infrastructure Authentication : WPA2-Personal Encryption : TKIP BSSID 1 : 00:15:70:ca:27:f0 Signal : 8% Radio type : 802.11g Channel : 11 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54 SSID 6 : Gerrys Grill_WIFI_Access Network type : Infrastructure Authentication : WPA2-Personal Encryption : CCMP BSSID 1 : 00:23:69:32:ba:8a Signal : 10% Radio type : 802.11g Channel : 6 Basic rates (Mbps) : 1 2 5.5 11 Other rates (Mbps) : 6 9 12 18 24 36 48 54
|
Reference:
http://technet.microsoft.com/en-us/library/cc755301(v=ws.10).aspx
Thanks for reading the article!!!
0 komentar:
Posting Komentar