我NetworkManager
用来连接到 VPN 服务器。我的 VPN 有多个服务器,所以我配置了十几个配置文件。NetworkManager
允许您一次连接到多个 VPN;如果我这样做,路由表可能会以多个默认路由结束。
示例(部分表):
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.8.8.1 0.0.0.0 UG 50 0 0 tun0
0.0.0.0 10.7.7.1 0.0.0.0 UG 51 0 0 tun1
0.0.0.0 10.8.8.1 0.0.0.0 UG 52 0 0 tun2
0.0.0.0 10.7.7.1 0.0.0.0 UG 53 0 0 tun3
0.0.0.0 10.8.8.1 0.0.0.0 UG 54 0 0 tun4
0.0.0.0 192.168.50.1 0.0.0.0 UG 100 0 0 enp0s31f6
您的额外网关具有不同的度量标准(并且可能具有不同的表、postip rule show
和ip route list table TTT
TTT 所提及的所有表ip rule show
)。指标记录在 man 8 route http://man7.org/linux/man-pages/man8/route.8.html
metric M
set the metric field in the routing table (used by routing
daemons) to M. If this option is not specified the metric for
inet6 (IPv6) address family defaults to '1', for inet (IPv4)
it defaults to '0'. You should always specify an explicit
metric value to not rely on those defaults - they also differ
from iproute2.
Metric The 'distance' to the target (usually counted in hops).
规则是https://serverfault.com/questions/648276/routing-selection-specificity-vs-metric:
单路由表...在这种情况下,内核选择:
- 最具体的路线;
- 如果有多个同样特定的路由,则是具有最小内核度量的路由。
因此,当没有多个路由表时,linux 将仅使用一个具有最低度量的可达网关(它可能不会使用来自离线网络接口的网关)。
有什么方法可以配置它以便它选择更快的网关?
不,当网关不使用时,您无法检查它的速度。此外,您不能让个人计算机拥有自己的 AS来合法拥有多个网关,这些网关可以将您的单个 IP 连接到互联网。(因此,选择不同的网关会破坏您所有的 TCP 和 UDP 连接,因为您将在 Internet 中使用不同的 IP 地址)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句