ip
gxxc@gxxc-NBLK-WAX9X:~$ ip r
default via 10.16.45.1 dev wlp2s0 proto dhcp metric 600
10.16.45.0/24 dev wlp2s0 proto kernel scope link src 10.16.45.90 metric 600
169.254.0.0/16 dev wlp2s0 scope link metric 1000
其中,10.16.45.1
就是网关地址
nmcli
gxxc@gxxc-NBLK-WAX9X:~$ nmcli device show wlp2s0
GENERAL.DEVICE: wlp2s0
GENERAL.TYPE: wifi
GENERAL.HWADDR: 1C:BF:C0:C0:79:45
GENERAL.MTU: 1500
GENERAL.STATE: 100(已连接)
GENERAL.CONNECTION: X
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/3
IP4.ADDRESS[1]: 10.16.45.90/24
IP4.GATEWAY: 10.16.45.1
IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 10.16.45.1, mt = 600
IP4.ROUTE[2]: dst = 10.16.45.0/24, nh = 0.0.0.0, mt = 600
IP4.ROUTE[3]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP4.DNS[1]: 10.16.45.1
IP6.ADDRESS[1]: fe80::3491:83f4:d42f:f165/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 600
IP6.DNS[1]: fe80::cabf:4cff:fe05:e36b
其中,IP4.GATEWAY: 10.16.45.1
就是网关, wlp2s0
是网卡名称