Win Network Command

ipconfig

列出所有網卡上的資訊,包括IP和MAC
ipconfig /all

ps:
ipconfig Options:
 /? Display this help message
 /all Display full configuration information.
 /release Release the IPv4 address for the specified adapter.
 /release6 Release the IPv6 address for the specified adapter.
 /renew Renew the IPv4 address for the specified adapter.
 /renew6 Renew the IPv6 address for the specified adapter.
 /flushdns Purges the DNS Resolver cache.
 /registerdns Refreshes all DHCP leases and re-registers DNS names
 /displaydns Display the contents of the DNS Resolver Cache.
 /showclassid Displays all the dhcp class IDs allowed for adapter.
 setclassid Modifies the dhcp class id.
 /showclassid6 Displays all the IPv6 DHCP class IDs allowed for adapter.
 /setclassid6 Modifies the IPv6 DHCP class id.



netsh

設定靜態ip,mask,gateway
netsh interface ip set address < LANstring> static < static IP> < net mask> < gateway> 1
ex:
netsh interface ip set address “區域連線” static 61.11.22.33 255.255.255.0 61.11.22.254 1

設定動態ip
netsh interface ip set address < LANstring> dhcp
ex:
netsh interface ip set address “區域連線” dhcp
ipconfig /release
ipconfig /renew

設定dns
netsh interface ip set dns < LANstring> static < static IP> primary

新增次要dns
netsh interface ip add dns < LANstring> < static IP>

netstat
a tool for collecting Information regarding network connections
It provides a simple view of TCP and UDP connections, and their state and network traffic statistics.

ps
netstat used port tcp/udp 15
refer
http://www.speedguide.net/port.php?port=15

netstat -ano
display the tcp and udp network ,listening ports,PID
information as below
Active Connections
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 340
TCP 127.0.0.1:49668 0.0.0.0:0 LISTENING 7424
TCP 127.0.0.1:52739 127.0.0.1:52740 ESTABLISHED 3452
TCP 127.0.0.1:52740 127.0.0.1:52739 ESTABLISHED 3452
TCP 192.168.100.133:139 0.0.0.0:0 LISTENING 4
TCP 192.168.100.133:53786 111.221.29.253:443 TIME_WAIT 0
TCP 192.168.100.133:53795 74.125.34.46:443 ESTABLISHED 4588
TCP 192.168.119.1:139 0.0.0.0:0 LISTENING 4
TCP 192.168.157.1:139 0.0.0.0:0 LISTENING 4
TCP [::]:135 [::]:0 LISTENING 340
TCP [::1]:49663 [::]:0 LISTENING 8076
UDP 0.0.0.0:500 *:* 848
UDP 0.0.0.0:63139 *:* 1080
UDP 127.0.0.1:1900 *:* 1120
UDP 127.0.0.1:53451 *:* 1120
UDP 192.168.100.133:137 *:* 4
UDP 192.168.157.1:53448 *:* 1120
UDP [::]:500 *:* 848
UDP [::1]:53447 *:* 1120

netstat -b
display binary
information as below
Active Connections
Proto Local Address Foreign Address State
TCP 127.0.0.1:52739 raymond:52740 ESTABLISHED
[vmware-hostd.exe]
TCP 192.168.100.133:53342 104.244.42.200:https ESTABLISHED
[chrome.exe]
…omit…

netstat -r
information as below
============================================== 
Interface List
12…00 0c 29 e9 91 21 ……Realtek PCIe GBE Family Controller
9…52 10 b3 0a 35 ad ……Microsoft Hosted Network Virtual Adapter
…omit…
============================================== 
 
IPv4 Route Table
============================================== 
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.100.1 192.168.100.133 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
…omit…
============================================== 
Persistent Routes:
None
 
IPv6 Route Table
============================================== 
Active Routes:
If Metric Network Destination Gateway
18 306 ::/0 On-link
1 306 ::1/128 On-link
…omit…
============================================== 
Persistent Routes:
None

netstat -s
information as below
IPv4 Statistics
Packets Received = 1648870
…omit…
IPv6 Statistics
Packets Received = 3654
…omit…
ICMPv4 Statistics
Received Sent
Messages 1252 319
…omit…
ICMPv6 Statistics
Received Sent
Messages 772 48
…omit…
TCP Statistics for IPv4
Active Opens = 4150
…omit…
TCP Statistics for IPv6
Active Opens = 19
…omit…
UDP Statistics for IPv4
Datagrams Received = 86359
…omit…
UDP Statistics for IPv6
Datagrams Received = 2021
…omit…


netstat -anob
display binary