我正在运行服务器 16.04,最近进行了 dist-upgrade,重启后我无法获得网络连接。
当我 ping 任何域时:
$ ping google.com
ping: unknown host google.com
$ ping 8.8.8.8
connect: Network is unreachable
$ ping 10.1.1.1
PING 10.1.1.1 (10.1.1.1) 56(84) bytes of data.
64 bytes from 10.1.1.1: icmp_seq=1 ttl=64 time=0.996 ms
nslookup 问题
nslookup google.com
;; connection timed out; no servers could be reached
但如果我指定默认路由:
$ nslookup
> server 10.1.1.1
Default server: 10.1.1.1
Address: 10.1.1.1#53
> google.com
Server: 10.1.1.1
Address: 10.1.1.1#53
Non-authoritative answer:
Name: google.com
Address: 172.217.8.174
Name: google.com
Address: 172.217.8.174
Name: google.com
Address: 172.217.8.174
我有 4 个接口
eth0 Link encap:Ethernet HWaddr 52:54:00:5f:9b:74
inet addr:10.1.1.250 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe5f:9b74/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:397 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19855 (19.8 KB) TX bytes:1542 (1.5 KB)
eth1 Link encap:Ethernet HWaddr 52:54:00:93:61:40
inet addr:10.1.2.250 Bcast:10.1.2.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fe93:6140/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:675 errors:0 dropped:0 overruns:0 frame:0
TX packets:625 errors:0 dropped:0 overruns:0 carrier:0
collisions:930 txqueuelen:1000
RX bytes:45296 (45.2 KB) TX bytes:50167 (50.1 KB)
eth2 Link encap:Ethernet HWaddr 52:54:00:ff:75:4c
inet addr:10.1.3.250 Bcast:10.1.3.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:feff:754c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:480 (480.0 B) TX bytes:648 (648.0 B)
eth3 Link encap:Ethernet HWaddr 52:54:00:e8:45:8f
inet addr:10.1.4.250 Bcast:10.1.4.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fee8:458f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:480 (480.0 B) TX bytes:648 (648.0 B)
/etc/网络/接口
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
gateway 10.1.1.1
auto eth1
iface eth1 inet static
address 10.1.2.250
netmask 255.255.255.0
gateway 10.1.1.250
auto eth2
iface eth2 inet static
address 10.1.3.250
netmask 255.255.255.0
gateway 10.1.1.250
auto eth3
iface eth3 inet static
address 10.1.4.250
netmask 255.255.255.0
gateway 10.1.1.250
路由表
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.1.1.1 255.255.255.0 UG 0 0 0 eth0
10.1.1.0 * 255.255.255.0 U 0 0 0 eth0
10.1.2.0 * 255.255.255.0 U 0 0 0 eth1
10.1.3.0 * 255.255.255.0 U 0 0 0 eth2
10.1.4.0 * 255.255.255.0 U 0 0 0 eth3
答案1
尝试gateway 10.1.1.250
从接口eth1
、eth2
和 中删除eth3
。您不需要它们。默认网关是所有网络的设置。