Services and Ports

what is a port
If an IP address is likened to a house, a port is the door that goes in and out of the house. A real house has only a few doors, but an IP address port can have 65536.
 
Two about the port


 
 
Correspondence between three ports and services
/etc/services
 
Four query services opened in the system
netstat -tlunp
-t: list tcp data
-u: list udp data
-l: List listening network services
-n: Display services by port number instead of service name
-p: List the process ID of the service
This command will list all the started services in the system.
 
Five actual combat
[root@localhost ~]# netstat -tlun
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
udp 0 0 0.0.0.0:55516 0.0.0.0:*
udp 0 0 0.0.0.0:5353 0.0.0.0:*
udp 0 0 0.0.0.0:9456 0.0.0.0:*
udp 0 0 192.168.122.1:53 0.0.0.0:*
udp 0 0 0.0.0.0:67 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp6 0 0 :::57782 :::*
[root@localhost ~]# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1939/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1182/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1177/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2025/master
tcp6 0 0 :::22 :::* LISTEN 1182/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1177/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2025/master
udp 0 0 0.0.0.0:55516 0.0.0.0:* 548/avahi-daemon: r
udp 0 0 0.0.0.0:5353 0.0.0.0:* 548/avahi-daemon: r
udp 0 0 0.0.0.0:9456 0.0.0.0:* 5060/dhclient
udp 0 0 192.168.122.1:53 0.0.0.0:* 1939/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1939/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 5060/dhclient
udp6 0 0 :::57782 :::*
[root@localhost ~]# netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.106:22 192.168.0.101:38799 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
udp 0 0 0.0.0.0:55516 0.0.0.0:*
udp 0 0 0.0.0.0:5353 0.0.0.0:*
udp 0 0 0.0.0.0:9456 0.0.0.0:*
udp 0 0 192.168.122.1:53 0.0.0.0:*
udp 0 0 0.0.0.0:67 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp6 0 0 :::57782 :::*
raw6 0 0 :::58 :::*

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326158990&siteId=291194637