1. netstat
netstat -t 查看 tcp 连接
netstat -u 查看udp连接
netstat -x 查看unix socket连接
netstat -p 显示socket关联的程序(如不是本用户执行的程序, 需sudo netstat -p查看)
2. nmap
Network Mapper, 可以扫描网络
常见的如查找指定网段下连接的主机。
nmap -sP 192.168.1.0/24 子网掩码24bit, 用ping方式扫描192.168.1.0 ~ 192.168.1.255
river@~$ nmap -sP 192.168.1.0/24
Starting Nmap 7.60 ( https://nmap.org ) at 2019-11-27 13:47 CST
Nmap scan report for 192.168.1.10
Host is up (0.00057s latency).
Nmap scan report for 192.168.1.93
Host is up (0.00019s latency).
Nmap scan report for 192.168.1.141
Host is up (0.00054s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 2.41 seconds
nmap 目标主机地址
nmap -v 目标主机地址
nmap -v -A 目标主机
等
river@~$ nmap -v 192.168.1.10
Starting Nmap 7.60 ( https://nmap.org ) at 2019-11-27 13:44 CST
Initiating Ping Scan at 13:44
Scanning 192.168.1.10 [2 ports]
Completed Ping Scan at 13:44, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 13:44
Completed Parallel DNS resolution of 1 host. at 13:44, 0.00s elapsed
Initiating Connect Scan at 13:44
Scanning 192.168.1.10 [1000 ports]
Discovered open port 22/tcp on 192.168.1.10
Discovered open port 80/tcp on 192.168.1.10
Completed Connect Scan at 13:44, 0.02s elapsed (1000 total ports)
Nmap scan report for 192.168.1.10
Host is up (0.0014s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
river@~$ nmap -v www.baidu.com
Starting Nmap 7.60 ( https://nmap.org ) at 2019-11-27 13:46 CST
Initiating Ping Scan at 13:46
Scanning www.baidu.com (61.135.169.125) [2 ports]
Completed Ping Scan at 13:46, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 13:46
Completed Parallel DNS resolution of 1 host. at 13:46, 0.00s elapsed
Initiating Connect Scan at 13:46
Scanning www.baidu.com (61.135.169.125) [1000 ports]
Discovered open port 80/tcp on 61.135.169.125
Discovered open port 443/tcp on 61.135.169.125
Discovered open port 53/tcp on 61.135.169.125
Completed Connect Scan at 13:46, 4.91s elapsed (1000 total ports)
Nmap scan report for www.baidu.com (61.135.169.125)
Host is up (0.0022s latency).
Other addresses for www.baidu.com (not scanned): 61.135.169.121
Not shown: 997 filtered ports
PORT STATE SERVICE
53/tcp open domain
80/tcp open http
443/tcp open https
Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 4.94 seconds
3. ifconfig
...
4. route
...
5. iperf
...