ping command to test network connectivity. This command sends ICMP requests to a specified IP address or domain name and displays information such as response time and packet loss rate. For example, to test network connectivity with www.example.com:ping www.tencent.com
PING www.tencent.com.eo.dnse5.com (61.170.66.121) 56(84) bytes of data.64 bytes from 61.170.66.121 (61.170.66.121): icmp_seq=1 ttl=50 time=10.3 ms64 bytes from 61.170.66.121 (61.170.66.121): icmp_seq=2 ttl=50 time=10.1 ms64 bytes from 61.170.66.121 (61.170.66.121): icmp_seq=3 ttl=50 time=9.77 ms64 bytes from 61.170.66.121 (61.170.66.121): icmp_seq=4 ttl=50 time=10.1 ms...
ping: www.example.com: Name or service not known
ping: connect: Network is unreachable
traceroute command to trace the network path. This command displays the network path from the local host to the destination host, as well as information such as the IP address and response time of each router. For example, to trace the network path to www.example.com:traceroute www.example.com
traceroute to www.example.com (172.217.6.196), 30 hops max, 60 byte packets1 gateway (192.168.1.1) 1.000 ms 1.000 ms 1.000 ms2 10.10.10.1 (10.10.10.1) 10.000 ms 10.000 ms 10.000 ms3 172.16.1.1 (172.16.1.1) 20.000 ms 20.000 ms 20.000 ms4 172.16.2.1 (172.16.2.1) 30.000 ms 30.000 ms 30.000 ms5 172.16.3.1 (172.16.3.1) 40.000 ms 40.000 ms 40.000 ms6 172.16.4.1 (172.16.4.1) 50.000 ms 50.000 ms 50.000 ms......
traceroute to www.example.com (172.217.6.196), 30 hops max, 60 byte packets1 gateway (192.168.1.1) 1.000 ms 1.000 ms 1.000 ms2 * * *3 * * *4 * * *5 * * *
netstat command to view network connection status. This command displays network connection information in the current system, including local IP addresses, remote IP addresses, and connection status. For example, to display network connection information in the current system:netstat -a
Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:22 0.0.0.0:* LISTENtcp 0 0 192.168.1.100:22 192.168.1.101:12345 ESTABLISHEDtcp 0 0 192.168.1.100:22 192.168.1.102:54321 ESTABLISHED...
Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:22 0.0.0.0:* LISTENtcp 0 1 192.168.1.100:22 192.168.1.101:12345 SYN_SENTtcp 0 0 192.168.1.100:22 192.168.1.102:54321 CLOSE_WAIT...
ss (socket statistics) is a network connection monitoring and debugging tool in Linux. Compared with the traditional netstat command, ss offers better performance and information display.ssNetid State Recv-Q Send-Q Local Address:Port Peer Address:Port Processu_str ESTAB 0 0 /run/systemd/journal/stdout 25077 * 24218u_str ESTAB 0 0 * 20557 * 592u_dgr ESTAB 0 0 * 23602 * 13633......
ss -t
ss -u
ss -l
ss -t state established
ss -t state established state closing
-p option:ss -t -p
-e option to display extended information (such as sliding window size and packet loss statistics):ss -t -e
-s option to display socket summary statistics, such as TCP/UDP/RAW and connection counts:ss -s
grep command together with common filters. For example, to view all connections on port 80:ss -t -a | grep ':80'
ethtool is a utility for querying and controlling network device drivers and hardware settings. If ethtool is not installed on the system, run the following command to install the software package.dnf install ethtool
ethtool ens18 #Use NIC ens18 as an example
Settings for ens18:......Speed: 1000Mb/sDuplex: FullAuto-negotiation: on......
ethtool -s ens18 speed 100 duplex full autoneg off
ethtool -a ens18Pause parameters for eno1:Autonegotiate: onRX: offTX: off
ethtool -A ens18 rx on tx off
ethtool ens18
Settings for ens18:......Wake-on: g.....
ethtool -s ens18 wol g
ethtool -s ens18 wol d
ethtool -k ens18
Features for ens18:rx-checksumming: ontx-checksumming: ontx-checksum-ipv4: off [fixed]tx-checksum-ip-generic: ontx-checksum-ipv6: off [fixed]......
ethtool -K ens18 tso on gso on
ethtool -S ens18
NIC statistics:rx_packets: 399566tx_packets: 257685rx_bytes: 215936573tx_bytes: 55115699rx_broadcast: 9854tx_broadcast: 92......
ethtool -t ens18
The test result is PASSThe test extra info:Register test (offline) 0Eeprom test (offline) 0Interrupt test (offline) 0Loopback test (offline) 0Link test (on/offline) 0
tcpdump is a powerful network packet capture tool that can be used to capture network packets and display their contents. The following are common usage examples of tcpdump:tcpdump -i eth0 host www.example.com
-i parameter specifies the network interface to capture, and the host parameter specifies the target host to capture.tcpdump -i eth0 src host 192.168.1.100 and dst host www.example.com
tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes14:23:45.678901 IP 192.168.1.100.12345 > 93.184.216.34.80: Flags [S], seq 123456789, win 65535, options [mss 1460,nop,nop,sackOK], length 014:23:45.789012 IP 93.184.216.34.80 > 192.168.1.100.12345: Flags [S.], seq 987654321, ack 123456790, win 65535, options [mss 1460,nop,nop,sackOK], length 014:23:45.890123 IP 192.168.1.100.12345 > 93.184.216.34.80: Flags [.], ack 1, win 65535, length 014:23:45.901234 IP 192.168.1.100.12345 > 93.184.216.34.80: Flags [P.], seq 1:101, ack 1, win 65535, length 10014:23:46.012345 IP 93.184.216.34.80 > 192.168.1.100.12345: Flags [.], ack 101, win 65535, length 0...
tcpdump -i eth0 src host 192.168.1.100 and dst host www.example.com
tcpdump: verbose output suppressed, use -v or -vv for full protocol decodelistening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes14:23:45.678901 IP 192.168.1.100.12345 > 93.184.216.34.80: Flags [S], seq 123456789, win 65535, options [mss 1460,nop,nop,sackOK], length 014:23:45.789012 IP 93.184.216.34.80 > 192.168.1.100.12345: Flags [R.], seq 0, ack 123456790, win 0, length 0
R flag indicates that the connection has been reset, which means there is a problem with the network connection.tcpdump -i eth0 net 192.168.1.0/24
eth0.tcpdump -i eth0 port 80
icmp traffic:tcpdump -i eth0 'icmp'
icmp with other protocols to monitor, such as tcp or udp.tcpdump -i eth0 'udp port 53'
tcpdump -i eth0 'udp port 67 or udp port 68'
tcpdump -i eth0 'tcp[tcpflags] & (tcp-syn|tcp-ack) != 0'
-i parameter of this command specifies eth0 as the network interface to capture from, and the filter 'tcp[tcpflags] & (tcp-syn|tcp-ack) != 0' detects TCP packets with the SYN and ACK flags.-c parameter to specify the number of packets to capture:tcpdump -i eth0 -c 10
eth0..pcap file:tcpdump -i eth0 -w output.pcap
.pcap file:tcpdump -r output.pcap
arping command to check whether the IP addresses of other servers on the LAN have address conflicts:arping -c 2 192.168.1.110
ARPING 192.168.1.11042 bytes from 02:99:96:xx:xx:xx (192.168.1.110): index=0 time=128.403 usec42 bytes from 62:10:6d:xx:xx:xx (192.168.1.110): index=1 time=168.765 usec
-c 2 specifies sending twice). If a reply is received, the MAC address of the target device is displayed. By observing the response, you can determine whether multiple MAC addresses correspond to the same IP address. As shown above, 192.168.1.110 corresponds to two different MAC addresses, indicating an IP address conflict.arping -I ens18 -D 192.168.1.110
ARPING 192.168.1.110 from 0.0.0.0 ens18Unicast reply from 192.168.1.110 [02:99:96:xx:xx:xx] 0.803msSent 1 probes (1 broadcast(s))Received 1 response(s)
1 response(s) is displayed in the response, it indicates that one device conflicts with this IP address, and the MAC address of the conflicting device is 02:99:96:xx:xx:xx. If 0 response(s) is returned, it indicates that there is no IP address conflict.sysctl net.ipv4.neigh.default.gc_stale_time
net.ipv4.neigh.default.gc_stale_time = 60
arp -n
Address HWtype HWaddress Flags Mask Iface192.168.1.111 ether 02:99:96:a7:27:43 CM ens18192.168.2.1 ether c2:fd:0b:bb:a6:9c C ens19192.168.1.1 ether 86:7a:1c:87:a8:35 C ens18192.168.2.111 ether 02:1e:16:7d:cc:50 C ens19
sudo arp -d 192.168.1.111
192.168.1.111 is the IP address of the device removed from the ARP cache.arp -s 192.168.1.111 02:99:96:xx:xx:xx
192.168.1.111 and MAC address 02:99:96:xx:xx:xx.arp -n command to view the ARP cache. The entry for this device is marked with M, indicating a permanent entry.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários