如何检查所有网络接口的网关IP?

时间:2019-12-23 06:01:15

标签: linux networking interface gateway

在我的一个Linux VM上,有2个网络接口eth0和eth1。 当我运行route -n命令时,可以看到仅eth1的默认网关IP。如何查看eth0的网关IP?

eth0      Link encap:Ethernet  HWaddr 52:54:00:83:46:8c
          inet addr:172.18.54.117  Bcast:172.18.54.127  Mask:255.255.255.240
          inet6 addr: fe80::5054:ff:fe83:468c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:43585689 errors:0 dropped:7 overruns:0 frame:0
          TX packets:7966 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2890771673 (2.8 GB)  TX bytes:1934442 (1.9 MB)

eth1      Link encap:Ethernet  HWaddr 52:54:00:62:66:51
          inet addr:172.18.53.231  Bcast:172.18.53.255  Mask:255.255.255.128
          inet6 addr: fe80::5054:ff:fe62:6651/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:44198700 errors:0 dropped:7 overruns:0 frame:0
          TX packets:1084325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3554903221 (3.5 GB)  TX bytes:123266129 (123.2 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.18.53.129   0.0.0.0         UG    0      0        0 eth1
172.18.53.128   0.0.0.0         255.255.255.128 U     0      0        0 eth1
172.18.54.112   0.0.0.0         255.255.255.240 U     0      0        0 eth0

0 个答案:

没有答案