Under the Windows system, ipconfig with /all parameter, you can view the IP address, mask, default gateway, DHCP, DNS server and other information of the machine. On Linux or Mac systems, use the ifconfig command instead.

C:\Users\admin>ipconfig /all Windows IP Configuration Ethernet adapter Ethernet0: Connection-specific DNS Suffix . : DHCP Description . . . . . . . . . . . : Intel(R) 82574L Gigabit Network Connection Physical Address. . . . . . . . . : 00-0C-29-A8-3E-AA DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::547b:2b11:b2bd:3cfb%15(Preferred) IPv4 Address. . . . . . . . . . . : 172.16.13.3(Preferred) Subnet Mask........... : 255.255.255.0 Lease Obtained at: On May 24, 2021 14:26:49 Lease Expires.......... : on May 25, 2021 14:12:25 Default Gateway print: 172.16.13.1 DHCP Server.......... : 172.16.13.1 DHCPv6 great significance by IAID........... : 117443625 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-1B-98-1F-00-0C-29-A8-3E-AA DNS Servers . . . . . . . . . . . : 172.16.13.1 NetBIOS over TCPIP........ : Enabled connection-specific DNS Suffix Search List: DHCP HOST

Ping can be used to detect connectivity to another host and obtain the following information. Note that some machines may disable the ICMP protocol used for ping, resulting in no response.

  1. Judge whether the network connection is smooth;
  2. Get the IP address of a domain name;
  3. Obtain the response speed of the network according to the time value;
  4. According to the TTL value, determine the number of routers the packets have passed through.
MacBook :~ Aaron $ping baidu.com Ping baidu.com (220.181.38.148): 56 Data bytes 64 bytes from 220.181.38.148: ICMP_seq =0 TTL =52 time= 32.15ms 64 bytes from 220.181.38.148: Icmp_seq =1 TTL =52 time= 34.66ms 64 bytes from 220.181.38.148: Icmp_seq =2 TTL =52 time= 32.626ms -- -baidu.com ping statistics -- 4 packets, 4 packets received, 0.0% packet loss round - trip min/avg/Max/stddev 34.663/0.991 = 32.157/32.971 / ms

The IP address is 220.181.38.148 by ping Baidu’s domain name. The response time is less than 50 milliseconds, indicating that the network speed is normal.

In the previous article, we said that routing data between different network segments is done by routers. TTL, short for Time To Live, stands for the maximum number of network segments that an IP packet is allowed To pass through before it is dropped by the router. The initial value may vary from operating system to operating system, but is 2 to the power of N. Here, we use the nearest 64 to the return value 52, i.e. 2^6, as the initial value, so the number of routers passed on the way can be calculated by using 64-52=12.

The telent command can be used to check whether there is any service running on a certain port of the remote host. Windows system does not have this command by default, but it can be installed in the control panel. If there is no response, make sure the port of the remote server is not disabled by fire.

MacBook :~ Aaron $Telnet 39.156.69.79 80 Trying 39.156.69.79... MacBook :~ Aaron $Telnet 39.156.69.79 80 Trying 39.156.69.79... Escape character is Connected to 39.156.69.79.

Tracert is used to detect the number of routers reaching the target host. Tracert works with the ICMP protocol and can help us locate which node in the network has a problem. First, it sends a packet with a TTL (lifetime) of 1 to the target host. The first router that processes the packet decrements the TTL value by 1, then discard the 0 datagram and returns an ICMP packet containing the router’s IP address. Then, incrementing the TTL in turn, the response will travel to more routers until it fails or ends. For Linux use the traceroute command instead.

MacBook :~ Aaron $traceroute-q 1 114.114.114.114 traceroute to 114.114.114.114 (114.114.114.114), 64 hops Max, 52 Byte Packets 1 192.168.0.1 (192.168.0.1) 2.908 ms 2 192.168.1.1 (192.168.1.1) 3.831 ms 3 58.208.178.1 (58.208.178.1) 5.278 MS 4 218.4.30.205 (218.4.30.205) 7.611 MS 5 221.224.235.61 (221.224.235.61) 7.858 MS 6 10.255.61.9 (10.255.61.9) 13.068ms 8 * 9 * 8.625ms 7 61.155.228.158 (61.155.228.158) 13.068ms 8 * 9 *

Here -q means one packet at a time; The asterisk indicates the line, probably because the firewall blocked the ICMP response.

Project directory