content
1. Configure TCP/IP parameters
IP address
Identifies a host in the network
Question: Why is the IP address found by the command IPCONFIG different from the IP address I checked online?
Answer: ipconfig checks your intranet ip address, while online ip check is the public network ip assigned to you by the service provider (that is, China Netcom or China Telecom). The public network ip is used to connect to the Internet, while the intranet ip only distinguishes the addresses of the local area network, a local area network can have 100 computers, you can use a public network ip (through the router) to access the Internet, but the local area network must be distinguished, all have intranet ip
Example: Query the IP address of www.baidu.com and
find that it is in Nanjing
subnet mask
It is used to identify the range of the network where your ip is located. The larger the subnet mask, the smaller the network range.
default gateway
The IP address that identifies the address of the router that is directly connected to the host
DNS server
for domain name resolution
command line related commands
Statically configure IP address, subdomain mask, default gateway
netsh interface ip set address "Ethernet0" static 192.168.100.100 255.255.255.0 192.168.100.254
Get TCP/IP parameters automatically
netsh interface ip set address "Ethernet0" dhcp
Statically configure DNS server
netsh interface ip set dnsserver "Ethernet0" static 12.12.12.12
Add alternate DNS server
netsh interface ip add dnsserver "Ethernet0" 222.66.66.66 index=2 //index是索引,表示备用
Obtain DNS server automatically
netsh interface ip set dnsserver "Ethernet0" dhcp
2. View TCP/IP parameters, use ipconfig
View TCP/IP parameters of all network cards (IP address, subnet mask, default gateway)
ipconfig
ipconfig /all
View TCP/IP parameters of all network cards (ip address, subnet mask, default gateway, mac address, dhcp address, dns address, hostname)
ipconfig /all
ipconfig /release
Release TCP/IP parameters
ipconfig /release
ipconfig /renew
Reacquire TCP/IP parameters
ipconfig /renew
ipconfig /flushdns
flush dns cache
ipconfig /flushdns
3.ping command
Function: used to test whether the TCP/IP configuration is correct
ping -n 10 www.baidu.com
Used to send 10 messages
ping -l 1000 www.baidu.com
A single message of 10000 bytes
ping -t www.baidu.com
keep pinging
ping -a
Returns the hostname of the IP (multiple for LANs)
4.tracert
Function: trace route
5.route
print routing table
Add route entry
Example:
route add 112.53.42.52/32 192.168.33.1
112.53.42.52 is the destination address or network /32 stands for subdomain mask or 112.53.42.0
or 112.53.12.0 destination network, /24 subdomain mask
192.168.33.1 gateway address
delete route entry
Example:
route delete 0.0.0.0 //0.0.0.0是网络目标
6.netstat
View all TCP connections, including processes, displayed numerically
Example:
netstat -anop tcp
View routing table
Example:
netstat -r //等于与 route print