Network Information Statistics netstat | ss | ip

1: netstate [deprecated]

netstat role:

demand Original instruction New command
1: Network connection netstat -a ss
2: Routing Table netstat -r ip route
3: Statistical Interface netstat -v ip -s link
4: Pseudo connection netstat -M ss
5: multicast member netstat -g ip maddr

2: ss: Socket Statistics: get socket statistics

1:查询ss是否安装
[root@localhost ~]# rpm -qf /usr/sbin/ss
iproute-3.10.0-13.el7.x86_64
[root@localhost ~]# rpm -q iproute
iproute-3.10.0-13.el7.x86_64


2:查看当前服务器的网络连接统计
[root@localhost ~]# ss -s
Total: 434 (kernel 459)
TCP:   6 (estab 2, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 0

Transport Total     IP        IPv6
*         459       -         -        
RAW       1         0         1        
UDP       2         2         0        
TCP       6         4         2        
INET      9         6         3        
FRAG      0         0         0

3:查看所有打开的网络端口
[root@localhost ~]# ss -l
[root@localhost ~]# ss -pl | grep sshd           ### -p列出具体的程序名称
tcp    LISTEN     0      128                  *:ssh                   *:*        users:(("sshd",1618,3))
tcp    LISTEN     0      128                 :::ssh                  :::*        users:(("sshd",1618,4))

###   1618为pid

4:查看这台服务器的所有socket连接
[root@localhost ~]# ss -a
[root@localhost ~]# ss -ta|ua|wa|xa     ### TCP/UDP/RAW/UNIX sockets

3: net-tools and Comparative iproute2

effect net-tools usage iproute2 usage
Native to show all network interfaces ifconfig ip link show
2: to open a network interface ifconfig eth0 up ip link set up eth0
3: Stop a network interface ifconfig eth0 down ip link set down eth0
4: Set the network address of the network interface Ip ifconfig eth0 10.0.0.1/24 ip addr add 10.0.0.1/24 dev eth0
5: Remove the network Ip address ifconfig eth0 0 ip addr del 10.0.0.1/24 dev eth0
6: Shows the IP address of a network interface ifconfig eth0 ip addr show dev eth0
7: Displays the routing table route -n ip route show
8: Adding the default gateway route add default gw 192.168.1.2 eth0 ip route add default via 192.168.1.2 eth0
9: Delete the default gateway route del default gw 192.168.1.2 eth0 ip route del default via 192.168.1.2 eth0
10: show arp table arp -an ip neigh
11: Add ARP entries arp -s 192.168.1.100
00 :0c:29:c0:5d:ef
ip neigh add 192.168.1.100 lladdr
00 :0c:29:c0:5d:ef
12: delete arp entries arp -d 192.168.1.100 ip neigh del 192.168.1.100 dev eth0
13: View of multicast information ipmaddr show dev eth0 ip maddr list dev eth0 ### Note format
14: state display socket netstat -l ss -l

Check the man page for details

[root@localhost ~]# man ip route

Guess you like

Origin www.cnblogs.com/zhoujun007/p/11788302.html
ss