Summary:
This article mainly introduces some operations of the cmd command line window, which can give everyone a preliminary understanding of computer networks
1.ipconfig
ipconfig is a command line tool used to control network connections on computers with Microsoft operating systems. It mainly displays network connection configuration information.
Implementation one
ipconfig/all view the network configuration of your own computer network
It can be seen that the wireless LAN connection is used. The IP address is 10.84.61.249. Generally, the internal network address starts with 10. The subnet mask is 255.0.0.0, which is a class A network. If you want to obtain the network number, you can contact IP performs bitwise AND. The default gateway is 10.84.61.249. (Use network card to surf the Internet)
Implementation two
Check the computer configuration next to (on campus)
As you can see, the IP is 202.202.250.188, the subnet mask is 255.255.255.0, and the default gateway is 202.202.250.1 (the connected school intranet)
Convert the subnet mask and IP of the two computers to binary and perform an AND operation, you can know that the two are not on the same subnet. Because the networks connected between the two are different.
2.ping
The program used to test the network connection is a service command of the application layer in the TCP/IP network architecture to test whether the destination station is reachable to understand its related operations
Implementation one
You can see the bytes, time, and survival time returned after ping. Use the school intranet to ping
It can be seen that the school intranet has a faster reply speed and a longer survival time, and the survival time can be reduced by routers, reducing by at least 1, so it can be inferred that the applicable school intranet can pass through fewer routers
Implementation two
The various options of the ping command are as follows: you can learn more
3.tracert
Called route tracking, this command program can be used to track the path taken by Internet Protocol (IP) packets to the destination address
Implementation one
Find out which nodes have passed to Baidu
Sometimes we encounter situations where we can access QQ but not connect to the Internet. In fact, in this case, you can ping through IP but ping different domain names, because there is an application layer protocol DNS that can resolve domain names to IP through DNS, so you can ping through.
Passed 30 hop tracking, * number is that the other router does not want us to obtain information
IP | Location |
---|---|
218.207.38.33 | Chongqing, China Mobile |
218.206.9.21 | Chongqing, China Mobile |
221.183.49.41 | China Mobile |
120.241.49.206 | Shenzhen Mobile, Guangdong Province, China |
183.232.231.174 | Guangzhou Mobile, Guangdong Province, China |
Since my network card is from a mobile company, you can see the geographic location of the router
As for some machines on the same subnet, the first hop is the same, that is, they set off through the same router.
4.ARP
Implementation one
ARP is an address resolution protocol that is used to find the corresponding data link layer address, namely the MAC address, according to a given network layer address
arp -a
See what's cached
Another computer:
clear cache
arp -d *
Query again
arp -a
Ping the IP 202.202.250.99 under the same subnet and check again
You can see that this IP has appeared
Implementation three
able to pass
arp -s IP MAC
To set the gateway to static
to sum up
The static ones in the arp cache will be stored permanently, and the dynamic ones will be deleted if they are not used for a period of time. The arp protocol is built on the basis of mutual trust between the hosts in the network. Using the address resolution protocol, it can be based on the network layer IP data. The IP address information in the packet header parses out the target hardware address (MAC address) information to ensure smooth communication and improve efficiency.
5.DHCP
DHCP is a dynamic host configuration protocol, used for internal networks or network service providers to automatically assign IP to users, and used for internal network administrators to centrally manage all computers. DHCP allows computers to automatically obtain/release network configuration
Implementation one
ipconfig/release
This operation will disconnect the network, if there is no connection, it will prompt
ipconfig/renew
Reacquire
6.netstat
netstat is a command line program that accesses the network connection status and related information in the kernel. It can display the routing table and the status information of the actual network interface equipment. It is generally used to check the running status of the network services on each port of the machine
Implementation one
Windows system records some common ports in C:\WINDOWS\system32\drivers\etc\services, you can see the port number assignment
Implementation two
netstat -an
View the current connection status of the computer
The computer port is the Internet channel. You can learn which ports are open through the netstat command, find out malicious background programs, and reduce risks
7.DNS
DNS is a domain name system. It is a distributed database that maps domain names and IP addresses. It can make it easier for people to access the Internet. It applies to port 53 of TCP and UDP.
Implementation one
Static DNS information is recorded in C:\WINDOWS\system32\drivers\etc\hosts
Implementation two
ipconfig/displaydns
Can view DNS
ipconfig/flushdns
Can clear all DNS cache
Implementation three
Use the default DNS server to query the domain name
8.cache
Cache means cache, which is an important technology in the IT field, here is browser cache
Implementation one
Visit a website Ctrl+Shift+I to open the developer tools, select the NETwork panel and refresh to see which files are cached
Implementation two
Select Disable cache to not apply caching, all from the Internet refresh interface, compare the speed