Linux system port-related knowledge and monitoring tool

In network technology, the port (Port) comprises a logical port and a physical port types.

Refers to physical ports are physical ports, such as ADSL Modem, connected by other interfaces, such as network devices RJ-45 port, SC port hubs, switches, routers are used, and the like.
Port is the port logic and services for distinguishing a logical sense, the scope of the service port, the port number of TCP / IP protocol from 0 to 65535, such as port 80 for web browsing service, the port 21 for FTP service, etc. .
As more and physical port number of logical ports, in order to distinguish the port, each port is numbered, which is the port number

A port by port number can be divided into three categories:
------------------------------------- -------------------------------------------------- ----
1: well-known port (Well Known port)

Well-known port number from 0 to 1023, they are closely tied to some common services, such as FTP service uses port 21, you can see this mapping in the / etc / services inside.

2: Registered Ports (Registered Ports):

From 1024-49151. They are loosely bound to some services. That there are many services bound to these ports, these ports also used for many other purposes.

3: dynamic or private port (Dynamic and / or Private Ports)

Dynamic port, i.e. port number private (private port numbers), the software is available for any number of ports with any other software communications using Transmission Control Protocol Internet, or the user transmission protocol. Dynamic ports generally from 49,152 to 65,535

Linux has limited port range, if I want to set aside certain ports for my program, I need to control the port range.
/ proc / sys / net / ipv4 / ip_local_port_range define the local port range of TCP / UDP
you can net.ipv4.ip_local_port_range = 1024 65000 defined inside /etc/sysctl.conf


two. Related to the Telnet lsof detection tool nmap
1: nmap tool for detecting open ports
------------------------------------ -------------------------------------------------- ----
nmap localhost # to view the current host open port
nmap -p 1024-65535 localhost # View host ports (1024-65535) open ports

nmap -sU 192.168.8.226 #UDP Scan: What UDP services provided to detect the target host, UDP scanning speed will be slower
nmap -PS 192.168.8.226 # detect the target host open port
nmap -O 192.168.8.226 # detect the target host operating system type
nmap -A 192.168.8.226 # detect the target host operating system type
nmap --help # nmap more parameters please consult the help

nmap -sP 192.168.8. * or nmap -sP 192.168.8.0/24 network scanning machines this situation


nmap port state open closed answers Reference link: https: //www.cnblogs.com/AloneSword/articles/5078716.html

-------------------------------------------------- ----------------------------------------
2: netstat tool to detect open ports
--- -------------------------------------------------- -------------------------------------
-a lists all current connections.
-t lists the connection protocol TCP
-u lists the UDP protocol connections
-n option to disable domain name resolution.
The -l option lists is listening socket.
-p option to view process information.
-------------------------------------------------- ----------------------------------------
3: lsof tool for detecting open ports
--- -------------------------------------------------- -------------------------------------
lsof -i lists all open network sockets ( TCP and UDP) process
lsof -i: 22 -i: port to display associated with the specified port network information
lsof -i tcp / udp list only open TCP or UDP sockets processes
-------------------------------------------------- ----------------------------------------
4: use detect whether the port is open the Telnet
- -------------------------------------------------- --------------------------------------
// format: the Telnet ip Prot
the Telnet 192.168.8.226 80

-------------------------------------------------- ----------------------------------------
5: netcat tool to detect whether the port is open.
-------------------------------------------------- ----------------------------------------
nc -v ip scan a certain IP Port a port, return information detailed output


Reference information:
https://blog.csdn.net/zflovecf/article/details/79267769

https://www.cnblogs.com/wzy23/p/11389431.html

Guess you like

Origin www.cnblogs.com/xq0422/p/12074319.html