Linux机器网络检查

查看DNS file:

dian@TestLRSSnapshot:~$ cat /etc/resolv.conf

# This file is managed by man:systemd-resolved(8). Do not edit.

#

# This is a dynamic resolv.conf file for connecting local clients to the

# internal DNS stub resolver of systemd-resolved. This file lists all

# configured search domains.

#

# Run "systemd-resolve --status" to see details about the uplink DNS servers

# currently in use.

#

# Third party programs must not access this file directly, but only through the

# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,

# replace this symlink by a static file or a different symlink.

#

# See man:systemd-resolved.service(8) for details about the supported modes of

# operation for /etc/resolv.conf.

nameserver 127.0.0.53

options edns0

search 4baqgnrc2zverab0oks4co0vjd.ix.internal.cloudapp.net

用Nping测试连接

需要先下载nmap:

sudo apt install nmap

Nping

dian@TestLRSSnapshot:~$ nping login.microsoftonline.com -p 443

Starting Nping 0.7.60 ( Nping — Network packet generation tool & ping utility ) at 2023-07-05 04:19 UTC

SENT (0.0050s) Starting TCP Handshake > login.microsoftonline.com:443 (20.190.148.164:443)

RCVD (0.0725s) Handshake with login.microsoftonline.com:443 (20.190.148.164:443) completed

SENT (1.0078s) Starting TCP Handshake > login.microsoftonline.com:443 (20.190.148.164:443)

RCVD (1.0742s) Handshake with login.microsoftonline.com:443 (20.190.148.164:443) completed

SENT (2.0104s) Starting TCP Handshake > login.microsoftonline.com:443 (20.190.148.164:443)

RCVD (2.0769s) Handshake with login.microsoftonline.com:443 (20.190.148.164:443) completed

SENT (3.0131s) Starting TCP Handshake > login.microsoftonline.com:443 (20.190.148.164:443)

RCVD (3.0797s) Handshake with login.microsoftonline.com:443 (20.190.148.164:443) completed

SENT (4.0159s) Starting TCP Handshake > login.microsoftonline.com:443 (20.190.148.164:443)

RCVD (4.0822s) Handshake with login.microsoftonline.com:443 (20.190.148.164:443) completed

Max rtt: 67.511ms | Min rtt: 66.360ms | Avg rtt: 66.668ms

TCP connection attempts: 5 | Successful connections: 5 | Failed: 0 (0.00%)

Nping done: 1 IP address pinged in 4.08 seconds

dian@TestLRSSnapshot:~$

Route table in Linux

netstat -rn

dian@TestLRSSnapshot:~$ netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

0.0.0.0         10.2.0.1        0.0.0.0         UG        0 0          0 eth0

10.2.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0

168.63.129.16   10.2.0.1        255.255.255.255 UGH       0 0          0 eth0

169.254.169.254 10.2.0.1        255.255.255.255 UGH       0 0          0 eth0

dian@TestLRSSnapshot:~$

Listening port:

-n -> numeric value (do not resolve service names).

-t -> TCP sockets.

-u -> UDP sockets.

-p -> Processes.

-l -> Listening

dian@TestLRSSnapshot:~$ netstat -ntplu

(Not all processes could be identified, non-owned process info

 will not be shown, you would have to be root to see it all.)

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -

tcp        0      0 0.0.0.0:25324           0.0.0.0:*               LISTEN      -

tcp6       0      0 :::22                   :::*                    LISTEN      -

udp        0      0 127.0.0.53:53           0.0.0.0:*                           -

udp        0      0 10.2.0.4:68             0.0.0.0:*                           -

udp        0      0 127.0.0.1:25224         0.0.0.0:*                           -

TCP traceroute

Need to install it firstly: sudo apt install traceroute

dian@TestLRSSnapshot:~$ sudo traceroute -T 40.126.16.166

traceroute to 40.126.16.166 (40.126.16.166), 30 hops max, 60 byte packets

 1  * * *

 2  * * *

 3  * * *

 4  * * *

 5  * * *

 6  * * *

 7  * * *

 8  * * *

 9  * * *

10  * * *

11  * * *

12  * * *

13  * * *

14  * * *

15  * * *

16  * * *

17  * * *

18  * * *

19  * * *

20  * * *

21  * * *

22  * * *

23  40.126.16.166 (40.126.16.166)  65.304 ms *  65.508 ms

NC测连接

dian@TestLRSSnapshot:~$ nc -zv 40.126.16.166 443

Connection to 40.126.16.166 443 port [tcp/https] succeeded!

你可能感兴趣的:(linux,网络,运维)