原始问题
我正在运行 Ubuntu 和网络管理器。我有两个不同的界面,eth0
并且eth1
.网络管理员(据我所知)已正确添加此手动路由:
~$ ip route
default via 172.16.0.2 dev eth1 proto static
10.0.0.0/8 via 172.16.0.2 dev eth1 proto static
130.35.0.0/16 via 172.16.0.2 dev eth1 proto static
...
172.16.0.0/12 dev eth1 proto kernel scope link src 172.16.0.15 metric 1
192.135.82.0/24 via 172.16.0.2 dev eth1 proto static
eth0
似乎下降了,但在我看来,这是一个单独的问题。即使给出上述路由,IP 堆栈似乎更倾向于eth0
:
~$ ping 130.35.249.52
PING 130.35.249.52 (130.35.249.52) 56(84) bytes of data.
^C
--- 130.35.249.52 ping statistics ---
18 packets transmitted, 0 received, 100% packet loss, time 17132ms
~$ ping -Ieth1 130.35.249.52
PING 130.35.249.52 (130.35.249.52) from 172.16.0.15 eth1: 56(84) bytes of data.
64 bytes from 130.35.249.52: icmp_seq=1 ttl=57 time=210 ms
此外,
~$ ip rule
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
~$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 172.16.0.2 0.0.0.0 UG 0 0 0 eth1
10.0.0.0 172.16.0.2 255.0.0.0 UG 0 0 0 eth1
130.35.0.0 172.16.0.2 255.255.0.0 UG 0 0 0 eth1
...
172.16.0.0 0.0.0.0 255.240.0.0 U 0 0 0 eth1
192.135.82.0 172.16.0.2 255.255.255.0 UG 0 0 0 eth1
~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
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 pfifo_fast state UP qlen 1000
link/ether 08:00:27:01:b1:f6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::a00:27ff:fe01:b1f6/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:35:eb:24 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.15/12 brd 172.31.255.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe35:eb24/64 scope link
valid_lft forever preferred_lft forever
如何强制 IP 堆栈遵守这些路由?
路由成功
~$ ip route get 130.35.249.52
130.35.249.52 via 172.16.0.2 dev eth1 src 172.16.0.15
cache
这种情况变得有点棘手了。看来第一次ping失败是暂时的,第二次 pingeth1
成功,然后后续 pingeth0
路由正确。我很难确定 IP 堆栈如何进入这种状态,但现在我将尝试解决另一个与 DNS 相关的问题。
答案1
结果发现问题是 UDP 数据包没有被传递。我不知道为什么。 TCP DNS 工作得很好。最后我network-manager-openconnect
在VirtualBox中使用并只保留了一个虚拟适配器,并且它可以工作。