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

How to query gateway information in Linux

青灯夜游
Release: 2022-03-09 17:01:23
Original
37779 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template