Home>Article>Operation and Maintenance> How to query gateway information in Linux

How to query gateway information in Linux

青灯夜游
青灯夜游 Original
2022-03-09 17:01:02 37578browse

How to query gateway information on Linux: 1. Use the "route -n" command to view; 2. Use the "netstat -r" command to view; 3. Use the "cat /etc/sysconfig/network" command to check; 4. Use the "ip route show" command to check.

How to query gateway information in Linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Linux query gateway information

Method 1

Execute the following command

route -n

The system returns something similar to the following, judging and obtaining the corresponding internal and external gateway addresses based on the Destination parameter value.

How to query gateway information in Linux

Method 2

Execute the following command

netstat -r

The system returns something similar to the following, judge and merge based on the Destination parameter value Obtain the corresponding intranet and external network gateway addresses.

How to query gateway information in Linux

Method three

Execute the following command

cat /etc/sysconfig/network

The system returns something similar to the following, the value of the GATEWAY parameter is Gateway address.

How to query gateway information in Linux

Method 4

Execute the following command

ip route show

The system returns something similar to the following, the IP behind the default via field That is the gateway IP.

How to query gateway information in Linux

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to query gateway information in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn