linux查看本机IP、gateway、dns
IP: ifconfig 或 ifconfig --all
gateway:
[root@localhost ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
X.X.X.X 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
0.0.0.0 X.X.X.X 0.0.0.0 UG 0 0 0 eth0
(以0.0.0.0开始的行的gateway是默认网关)
DNS:
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
nameserver X.X.X.X