Ubuntu 16.04服务器版查看IP、网关、DNS(非DHCP)
查看IP
ifconfig
em1 Link encap:Ethernet HWaddr F0:1F:AF:D6:17:DD
inet addr:115.238.54.116 Bcast:115.238.54.127 Mask:255.255.255.224
inet6 addr: fe80::f21f:afff:fed6:17dd/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:83248115 errors:0 dropped:0 overruns:0 frame:0
TX packets:50674679 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10627919322 (9.8 GiB) TX bytes:13311903923 (12.3 GiB)
Interrupt:16
em1:0 Link encap:Ethernet HWaddr F0:1F:AF:D6:17:DD
inet addr:121.52.229.126 Bcast:121.52.229.127 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:16
em1:1 Link encap:Ethernet HWaddr F0:1F:AF:D6:17:DD
inet addr:120.199.8.215 Bcast:120.199.8.223 Mask:255.255.255.240
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:16
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:16436 Metric:1
RX packets:2228411 errors:0 dropped:0 overruns:0 frame:0
TX packets:2228411 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:667383706 (636.4 MiB) TX bytes:667383706 (636.4 MiB)
(em1表示网卡对应的三个IP;lo表示本地环回IP)
查看Gateway(官网)
netstat -rn 或 route -n
或
ip route show
或
traceroute
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
120.199.8.208 0.0.0.0 255.255.255.240 U 0 0 0 em1
115.238.54.96 0.0.0.0 255.255.255.224 U 0 0 0 em1
121.52.229.96 0.0.0.0 255.255.255.224 U 0 0 0 em1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 em1
0.0.0.0 115.238.54.97 0.0.0.0 UG 0 0 0 em1
(以0.0.0.0开始的行的Gateway是默认网关)
查看DNS
cat /etc/resolv.conf
nameserver 202.101.172.47
nameserver 221.12.1.227
设置IP(同时也可以根据这个反推IP相关信息):
CentOS 6+:http://www.cnblogs.com/EasonJim/p/8072875.html
Ubuntu 16+:http://www.cnblogs.com/EasonJim/p/7857671.html
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »