In CentOS 7 system, you can use the following command to view the network card and network information:
ifconfig
: Display the configuration information of the network interface, including IP address, MAC address, etc.ip addr
: Display the configuration information of the network interface, including IP address, MAC address, etc. Similarifconfig
functionality, but with more options and information.ip link
: Display the link status and information of the network interface, including interface name, status, MAC address, etc.route -n
: Display the routing table information of the system, including destination network, gateway, subnet mask, etc.netstat -rn
: Display the routing table information of the system,route -n
similar to the function.ping
: Used to test network connectivity. It can be usedping <IP地址>
to test the connectivity with the host with the specified IP address.traceroute
: Used to track the path of network data packets on the network. It can be usedtraceroute <IP地址>
to track the path to the host with the specified IP address.nslookup
: Used to query DNS records and can be usednslookup <域名>
to query the IP address of a specified domain name.ss -tunlp
: Display the system’s network connection information, including TCP, UDP connections and listening ports.hostname
: Displays the hostname of the system.
These commands provide a wide range of network information and configuration viewing functions. You can choose the appropriate command according to your needs to obtain the required network information.
Please note that some commands may need to be run as root or require the corresponding software package to be installed. If the command cannot be executed or cannot be found, you can try to use sudo
the command to obtain root privileges or use yum
the command to install the required software package.
In summary, the above are commonly used commands to view network card and network information in CentOS 7 systems. By using these commands, you can obtain detailed information about network interfaces, routing tables, network connectivity, etc.