1. ipconfig: network diagnostic command
The main function is to view IP and some configurations of DNS
1. ipconfig/all displays all parameters (displays IP address , subnet mask , default gateway and other detailed information)
2. ip config/renew updates the DHCP configuration and re-obtains IP ( re-obtains DHCP )
3. i pcongfig/release releases the IP address obtained by DHCP
4. ipconfig/flushdns clears DNS cache information
5. ipconfig/displaydns displays DNS cache information
Here are some pictures for reference:
At this time, I used a command called ipconfig and checked its IP address: 192.168.1.6
Another command used below is: ipconfig/release, which releases the IP address. The picture is as follows:
The ipconfig/displaydns command is used below , mainly to display DNS cache information. The picture is as follows:
Finally, we can use the ipconfig/flushdns command to delete the DNS cache information. The picture is as follows:
2. Ping command: check network connectivity
Main functions: 1. Used to detect network connectivity and analyze network speed
2. Get the server IP based on the domain name
3. Based on the TTL value returned by ping, determine the operating system used by the other party and the number of data packets passing through the router.
1.ping+ip address: (ping followed by an IP address) is used by default. By default 4 packets are sent, each packet takes 32 bytes
Example: ping 192.168.1.1
1.ping -t: ping continuously until ctrl+c is pressed.
2. ping -a: Its function is to resolve the domain name into an IP address
ping baidu.com and ping -a baidu.com
ping www.baidu.com
In this case, the system will automatically help us resolve the IP address corresponding to the domain name and then ping.
- If you want to display the resolved IP address, you can use the -a parameter:
ping -a www.baidu.com
In this way, the ping command will first display the resolved IP address:
Ping www.baidu.com [110.242.68.66] with 32 bytes of data:
We can clearly see that the IP address of the resolved domain name is 110.242.68.66
You can refer to the picture below:
- If you enter only one IP address, using the -a parameter will have no effect :
ping -a 110.242.68.66
In this case, the IP address will not be resolved again because it is already an IP address.
In addition, the -a parameter can also be used in combination with -n:
ping -n 3 -a www.baidu.com
This resolves the domain name and only pings 3 times.
ping -l: Used to specify the size of the sent data packet, that is, the load.
effect:
The -l parameter allows us to set the packet size for the ping test , the default is 32 bytes .
By adjusting the size, it can be used to test performance indicators such as packet loss rate and delay of the network under different loads.
- Common packet sizes
- 32 bytes: default size
- 64 bytes
- 128 bytes
- 256 bytes
- 512 bytes or larger
ping -l packet size host address
Example: ping -l 64 www.daidu.com
The above command will generate a 64-byte size ICMP packet for testing.
ICMP (Internet Control Message Protocol) is the Internet Control Message Protocol . It is a sub-protocol of the TCP/IP protocol suite and is used to transmit control messages between IP hosts and routers.
ping -n Parameters IP address: This willsend the specified number of ICMP echo request packets to the specified host address.
Example: ping -n 10 192.168.1.1
The above command will send 10 ICMP echo request packets to the target IP 192.168.1.1 .
3. The function of the tracert command is to trace the routing path and communication duration of the data packet to the target host. (referred to as traceroute)
Mainly used for network troubleshooting
How to use:
1. tracert + target host address/domain name
For example: tracert www.baidu.com
It shows that 11 routing hops were passed when visiting the Baidu website.
2. tracert -d www.baidu.com (does not resolve IP address to domain name)
teacert -h maximum-hops (used to set the maximum number of hops)
3. For example: tracert -h 30 www.baidu .com
This means that tracert will stop tracking up to 30 nodes. If -h is not set, the maximum number of hops is 30 by default.
Common uses for setting a smaller hop count:
- To troubleshoot local network problems, you only need to trace a few local hops
- Adjust hop count to determine where network failure occurs
- Reduce command execution time
tracert -w timeout: time to wait for each reply (milliseconds)
Format: tracert -w timeout target address
For example: tracert -w 20 www.baidu.com
This means tracert waits up to 200 milliseconds for a reply after issuing each ICMP echo request.
4. nslookup: Mainly used for domain name resolution
- Enter interactive mode and query domain name resolution records:
nslookup
domain name
For example:
nslookup
- Directly specify domain name resolution
nslookup www.baidu.com
5. The arp command (forward address resolution) is mainly used to view and manage the ARP cache table of the system. Its common functions and usage are as follows:
- View the ARP table Use arp -a to view the ARP cache table of the current system. The mapping between the IP address and the corresponding MAC address will be displayed.
- Adding a static ARP entry
arp -s 192.168.1.1 00-11-22-33-44-55 will manually add a static IP-MAC mapping relationship. - Delete ARP table entry arp -d 192.168.1.1 will delete the specified IP address entry in the ARP table.
- View the MAC address of a specific IP arp 192.168.1.1 focused Output the ARP information of a specific IP.
- Refresh the ARP table netsh interface ip delete arpcache will clear and refresh the ARP cache table.
- Other parameters
-N network card name -D display physical address -v details, etc.
It should be noted that the dynamic ARP table will be updated automatically, and the static mapping will be saved permanently.
Reasonable use of the arp command can help find and solve network communication faults.
Six: rarp (reverse address resolution)
arp (Reverse Address Resolution Protocol) reverse address resolution protocol. Its function is opposite to ARP. It is mainly used for clients to obtain IP addresses. Its usage is as follows:
- The client sends a rarp request packet, including its own MAC address
- After receiving the request, the server searches for the corresponding IP address based on the MAC address.
- The server assembles a rarp response datagram containing IP address information
- The client gets the response datagram and gets the IP address assigned to it.
The rarp request uses the ARP datagram format with hardware type 1 (Ethernet).
Commonly used rarp tools:
- rarpd - rarp server daemon under Linux
- rarpc - Client program for sending rarp requests
- rarp - View the mapping of the current rarp table
rarp is mainly used for diskless workstations to obtain IP addresses. Nowadays, it is less commonly used and more uses the DHCP protocol for dynamic allocation.