Linux view command collection of network interface

In layman's terms, the network interface is the network card on our host. The same command is used to view and manipulate network interfaces: ifconfig. Manipulating the network interface refers to starting, closing and temporarily modifying network interface parameters. Generally speaking, all users can use ifconfig to view network interfaces, but only the root user can manipulate network interfaces. By the way, all network references in this article refer to Ethernet.

Table of contents

One, ifconfig

1.ifconfig ##View all enabled network devicesEdit

2. Netstat port scan to see if the port is working normally

3.ss socket

2. Analysis of Port Occupancy


1. Collection and usage of basic commands

1.ifconfig ##View all enabled network devices

  • ifconfig -a Query all network devices
  • ifconfig -s View network communication
  • ifconfig ens33 Query the specified device
  • ifconfig ens33 up open the specified device
  • ifconfig ens33 down closes the specified device
  • ifup opens the specified device
  • ifdown closes the specified device
  • ificonfig ens33:0 Create a virtual network card

2. Netstat port scan to see if the port is working normally

  • -a Display information about all active network links on the current host
  • -n Display relevant host address and port information in numerical form
  • -r Display routing table information
  • -l Display the network link and port information in the listening state
  • -t Display information about the tcp protocol
  • -u display information about udp protocol
  • -p Displays the process number and process name information related to the network link (root authority must be used)
    • Usage: netstat -antp | grep port number or service name

3. ss get socket Manage port and statistics information through communication socket

  • -t tcp protocol
  • -u udp protocol
  • -w bare socket
  • -x kernel socket related
  • -l is in listening state
  • -a show all network link activity
  • -n number format
  • -p The pid and process name of the relevant process
    • Usage: ss -antp | grep port number or service name
      • ​​​​​​​​ nslookup forward resolution resolves the real ip address through the domain name

2. Analysis of Port Occupancy

  1. Who uses the port
  2. Query that the port is occupied by that service, 80 http nginx 
  • Note: The query speed of ss is faster than that of netstat. ss is suitable for scenarios with a large number of links, and netstat may be stuck. nslookup forward resolution resolves the real ip address through the domain name

Guess you like

Origin blog.csdn.net/Sp_Tizzy/article/details/130753130