Linux view network

netstat 

-a

Shows all sockets, including those that are listening.

-c Redisplay every 1 second until the user interrupts it.

-i Display information about all network interfaces, the format is the same as "ifconfig -e".

-n Displays network connections by replacing names with network IP addresses.

-r Display the core routing table, the format is the same as "route -e".

-t Displays the connection status of the TCP protocol.

-u Displays the connection status of the UDP protocol.

-v Display work in progress.

 

1. netstat -an | grep LISTEN

 

0.0.0.0 is the service that each IP has, and which IP is written is the service bound to that IP.

 

2. netstat -tln

 

Used to view the port usage of linux

 

3. /etc/init.d/vsftp start

 

Is used to start the ftp port ~!

 

4. netstat

 

View connected service ports (ESTABLISHED)

 

5. netstat -a

 

View all service ports (LISTEN, ESTABLISHED)

 

6. sudo netstat -ap

 

View all service ports and display the corresponding service program name

 

7. nmap <scan type> <scan parameter>

 

E.g:

 

nmap localhost

 

nmap -p 1024-65535 localhost

 

nmap -PT 192.168.1.127-245

 

when we use netstat

-apn When viewing network connections, you will find a lot of content similar to the following:

 

Proto Recv-Q Send-Q Local Address

Foreign Address State PID/Program name

 

tcp 0 52 218.104.81.152:7710

211.100.39.250:29488 ESTABLISHED 6111/1

 

It shows that the server has opened port 7710, so which program does this port belong to?

We can use the lsof -i:7710 command to query:

 

COMMAND PID USER FD TYPE DEVICE SIZE

NODE NAME

 

sshd 1990 root 3u IPv4 4836 TCP *:7710

(LISTEN) 54com.cn

 

In this way, we know that port 7710 belongs to the sshd program.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326611584&siteId=291194637