Linux commonly used network analysis tools

ping command

The ping command is often used to test the connectivity from the source network host to the target network host, and at the same time evaluate the network connection quality.

Features:

(1) Can verify the connectivity of the network

(2) The response time and TTL (Time To Live in the IP packet, life cycle) will be counted

So how is it verified?

(1) The ping command will first send an ICMP Echo Request to the peer

(2) After receiving, the peer will return an ICMP Echo Reply

(3) If there is no return, it is timed out, and the specified network address will not be considered to exist.

There are 6 steps to check connectivity using ping.

(1) Use ipconfig / all to observe whether the local network settings are correct.

(2) Ping 127.0.0.l to check whether the local TCP / IP protocol is set up

(3) Ping the IP address of the machine, this is to check whether the IP address of the machine is set incorrectly.

(4) Ping the gateway or IP address of this network, this is to check whether there is a problem with the hardware device, you can also check

Check whether the machine is connected to the local network normally. (This step can be ignored in non-LAN)

(5) Ping the local DNS address. This is to check whether the local DNS server is working properly.

(6) Ping the remote IP address, this is mainly to check whether the connection between this network or this machine and the outside is normal. ping remote IP

Address can also be used to test network latency

telnet

The telnet command is often used to remotely connect and manage the target host, or to test whether a TCP port of a target host is open.

 Ping is usually used to check whether the network of the source host and the target host is unobstructed, or to test the quality of the network connection; telnet is mostly used to detect whether the specified ip is open to the specified port.

Telnet is also a protocol for remote access. It has the same function as the ssh protocol, but the ssh protocol is better, so telnet is rarely used. Telnet is generally used to detect ports.

Similarities between ssh and telnet:

1. Both protocols can log in to another host remotely

2. Both protocols are based on TCP / IP

The difference between ssh and telnet:

1. Telnet is transmitted in clear text; ssh is encrypted transmission and supports compression.

2. The default port number of telnet is 23; the default port number of ssh is 22.

3. ssh uses the public key to verify the identity of users accessing the server, further improving security; telnet does not use the public key.

problem:

Telnet is port 23 and ssh is port 22. So what port is ping? 

Answer: The ping command is based on ICMP and is at the network layer.

The port number is the content of the transport layer. So ICMP doesn't pay attention to the port number at all.

traceroute

Traceroute is also implemented based on the ICMP protocol.

Features:

Print out how many routers the executable program host has been through until the target host.

route -n function is similar to view the route list (you can see the gateway )

Capture tool:

wireshark    tcpdump

 

nslookup

1. Check the DNS server used by the machine (8.8.8.8 in the figure below)

2. Domain name resolution, check the IP address corresponding to the domain name. Baidu has servers in different places, so it may be different in different places

ifconfig (ipconfig in windows)

View network card, ip and subnet mask

ifup  enable network card

ifdown disable network card

netstat

View network status

netstat -tuln to  see which ports the machine has opened

netstat -an  shows all connections

 

Published 59 original articles · Likes46 · Visits 30,000+

Guess you like

Origin blog.csdn.net/sinat_41852207/article/details/105480080