类似的问题但没有答案:
具有相同度量的两个默认路由
Linux如何在默认网关之间进行选择?
在Linux上,当两条路由具有相同的度量时,将使用哪一条?我发现这是记录在案 for Windows (“如果多个相同速度的接口具有相同的最低接口度量,那么根据绑定顺序,将使用第一个网络适配器的默认网关。当第一个网络适配器不可用时使用第二个网络适配器的默认网关”)。但无法找到Linux是如何处理这一问题的。
我想答案在代码中,但并不明显。
在工作中,我们有两个网络;一个WiFi网络,用于正常的互联网接入;一个内部局域网网络,用于回购等。我最近开始使用Linux,这是痛苦的,必须不断地在电缆和WiFi之间切换。在Windows上,我们通过运行以下命令来解决这个问题(这样我们就可以同时连接到两个网络):
# Add a route for all traffic to any destination starting with 10 (internal traffic):
route add 10.0.0.0 mask 255.0.0.0 10.18.21.129 metric 40 -p
# Move the default ro
我在航站楼的第一步:
aivinor@mcph:~$ sudo apt-get install ttf-mscorefonts-installer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
imagemagick-common liblqr-1-0 libmagickcore5 lib
我使用以下命令将Linux盒配置为开关模式:
ip link add name switch type bridge
ifconfig switch 192.168.1.2
ip link set switch up
ip link set swp0 master switch && ip link set swp0 up
ip link set swp1 master switch && ip link set swp1 up
ip link set swp2 master switch && ip link set swp2 up
ip li
我的网络拓扑如下
📷
从R1,我不能平R3。
R3上的数据包捕获显示收到了回送请求,但没有收到来自R3的答复。
📷
原来默认网关并没有出现在show ip route中,即使我已经放置了配置,然后是wr mem
这是怎么回事?
怎么修呢?
R1
R1#sh run | i ga
ip default-gateway 192.168.10.2
R1#
R1#show ip route
Default gateway is 192.168.10.2
Host Gateway Last Use Total Uses Interface
ICM