[Title] network interview questions

1. Review the current system the number of connections per IP

[root@oldboy ~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      
tcp        0      0 192.168.0.109:22            192.168.0.102:49801         ESTABLISHED 
tcp        0      0 :::22                       :::*                        LISTEN      
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  5      [ ]         DGRAM                    9255   /dev/log
unix  2      [ ACC ]     STREAM     LISTENING     9766   /var/lib/mysql/mysql.sock
unix  2      [ ACC ]     STREAM     LISTENING     7096   @/com/ubuntu/upstart
unix  2      [ ]         DGRAM                    7497   @/org/kernel/udev/udevd
unix  2      [ ]         DGRAM                    13757  
unix  2      [ ]         DGRAM                    11955  
unix  2 [] 9802 DGRAM    
UNIX   . 3 [] 7515 DGRAM    
UNIX   . 3 [] DGRAM 7514 # filtration ESTABLISHED state wherein the recording 
[Oldboy the root @ ~] # the netstat -an | grep "ESTABLISHED"    
TCP 192.168.0.109:22 0 0 192.168. 0.102: 49 801          the ESTABLISHED # filtered IP 
[Oldboy the root @ ~] # the netstat -an | grep "the ESTABLISHED" | awk '{}. 4 Print $' 
192.168.0.109:22 
[the root @oldboy ~] # the netstat -an | grep "the ESTABLISHED" | awk '{}. 4 Print $' | awk -F: '{}. 1 Print $'   
192.168.0.109 # plurality ip after sorting are counted






[root@oldboy ~]# netstat -an|grep "ESTABLISHED"|awk '{print $4}'|awk -F: '{print $1}'|sort -n
192.168.0.109
[root@oldboy ~]# netstat -an|grep "ESTABLISHED"|awk '{print $4}'|awk -F: '{print $1}'|sort -n|uniq -c
      1 192.168.0.109

 

2. Please list the port used by the following services

 

Guess you like

Origin www.cnblogs.com/zoe233/p/11914194.html