1通过ip命令
[root@localhost ~]# ip route show
default via 192.168.11.250 dev enp0s3 proto static metric 100
192.168.11.0/24 dev enp0s3 proto kernel scope link src 192.168.11.234 metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
其中via后面192.168.11.250是网关IP地址
2 通过route命令
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.11.250 0.0.0.0 UG 100 0 0 enp0s3
192.168.11.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
3 通过netstat命令
[root@localhost ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.11.250 0.0.0.0 UG 0 0 0 enp0s3
192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0