![接口错误](https://linux22.com/image/1008271/%E6%8E%A5%E5%8F%A3%E9%94%99%E8%AF%AF.png)
由于两天没有上网,我的测试服务器今天我发现了一些有趣的事情,如下所示:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 213.156.10.17 0.0.0.0 UG 0 0 0 eth0
10.0.201.2 0.0.0.0 255.255.255.255 UH 0 0 0 Albert
192.9.200.0 10.0.201.1 255.255.255.0 UG 0 0 0 Albert
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
213.156.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
213.156.10.16 0.0.0.0 255.255.255.240 U 0 0 0 eth0
因此,列表顶部的 eth0 网关应该与列表底部的网关在一起,当我检查时,/etc/network/interfaces
它们是在一起的,当我重新启动服务时,没有任何变化
接口文件:
主网络接口
自动 eth0 iface eth0 inet 静态
address 213.156.10.20 gateway 213.156.10.17 netmask 255.255.255.240
还有其他几行,但它们是 # 情况,它们很旧,但有时需要尝试一些东西
另外,从底部开始的第二个 eth0 根本不应该在那里,所以发生了什么事?因为两天前或昨天我检查的时候情况并不是这样的
edit1:Mikael Schultz 要求我执行几个命令,因此这里是它们的 IP 地址
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:13:21:f2:75:3d brd ff:ff:ff:ff:ff:ff
inet 213.156.10.20/28 brd 213.156.10.31 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::213:21ff:fef2:753d/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:13:21:f2:75:3c brd ff:ff:ff:ff:ff:ff
inet 192.168.1.164/24 brd 192.168.1.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::213:21ff:fef2:753c/64 scope link
valid_lft forever preferred_lft forever
4: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:11:0a:61:9b:dc brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global eth2
valid_lft forever preferred_lft forever
5: eth3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:11:0a:61:9b:dd brd ff:ff:ff:ff:ff:ff
inet 192.168.100.253/24 brd 192.168.100.255 scope global eth3
valid_lft forever preferred_lft forever
6: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1
link/gre 0.0.0.0 brd 0.0.0.0
7: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
8: Albert@eth0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN group default qlen 1
link/gre 213.156.10.20 peer 212.57.52.228
inet 10.0.201.1 peer 10.0.201.2/32 brd 10.0.201.255 scope global Albert
valid_lft forever preferred_lft forever
inet6 fe80::200:5efe:d59c:a14/64 scope link
valid_lft forever preferred_lft forever
ping 213.156.10.17
PING 213.156.10.17 (213.156.10.17) 56(84) bytes of data.
From 213.156.10.20 icmp_seq=1 Destination Host Unreachable
From 213.156.10.20 icmp_seq=2 Destination Host Unreachable
From 213.156.10.20 icmp_seq=3 Destination Host Unreachable
From 213.156.10.20 icmp_seq=4 Destination Host Unreachable
From 213.156.10.20 icmp_seq=5 Destination Host Unreachable
From 213.156.10.20 icmp_seq=6 Destination Host Unreachable
^C
--- 213.156.10.17 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6017ms
pipe 3
ping 8.8.8.8
connect: Network is unreachable
答案1
在得到了同事的帮助后,问题很快得到解决,只需对/ect/network/interfaces
防火墙进行一些调整,一切恢复正常,感谢 Mikael Schultz 的努力