为多个上行链路路由移动连接

为多个上行链路路由移动连接

我有一个带有 2 个网络接口(一个是 VLAN)的 MBIM LTE 调制解调器,我正在尝试配置两个连接,因为 IP、网关等是通过 MBIM 协议获取的,因此路由需要手动完成。谷歌搜索并在这个论坛中搜索了很多,解决方案似乎是这个,即使用第二和第三路由表和路由规则。

这种解决方案通常建议用于 eth 网络设备,但我认为应该没有区别,但是我无法使两个网络一起工作,并且在最好的情况下我只能从第一个接口 ping,而 vlan 则不能完全无法 ping 通。

我的配置如下:

假设 MBIM 协议为两个连接提供以下数据

Session 1
IP=10.39.187.213/24
GW=10.39.187.1

Session 2
IP=5.91.204.208/24
GW=5.91.204.1

这是路由

ip link add link wwp0s20u1u1u4 name wwp0s20u1u1u4.0 type vlan id 0
ip set link wwp0s20u1u1u4 up

ip route show table main
default
    nexthop via 10.39.187.1  dev wwp0s20u1u1u4 weight 1
    nexthop via 5.91.204.1  dev wwp0s20u1u1u4.0 weight 1
5.91.204.0/24 dev wwp0s20u1u1u4.0  proto kernel  scope link  src 5.91.204.208
10.39.187.0/24 dev wwp0s20u1u1u4  proto kernel  scope link  src 10.39.187.213

ip route show table second
default via 10.39.187.1 dev wwp0s20u1u1u4
10.39.187.0/24 dev wwp0s20u1u1u4  scope link  src 10.39.187.213

ip route show table third
default via 5.91.204.1 dev wwp0s20u1u1u4.0
5.91.204.0/24 dev wwp0s20u1u1u4.0  scope link  src 5.91.204.208

ip rule
0:  from all lookup local
32762:  from all to 5.91.204.0/24 lookup third
32763:  from 5.91.204.0/24 lookup third
32764:  from all to 10.39.187.0/24 lookup second
32765:  from 10.39.187.0/24 lookup second
32766:  from all lookup main
32767:  from all lookup default

这是 ping 的结果

ping -I wwp0s20u1u1u4 8.8.8.8 -c 4
PING 8.8.8.8 (8.8.8.8) from 10.39.187.213 wwp0s20u1u1u4: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=42 time=121 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=42 time=79.4 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=42 time=111 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=42 time=110 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 79.458/105.839/121.511/15.807 ms


ping -I wwp0s20u1u1u4.0 8.8.8.8 -c 4
PING 8.8.8.8 (8.8.8.8) from 5.91.204.208 wwp0s20u1u1u4.0: 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3023ms

更新:对于公开 2 个 RMNET 的 QMI 调制解调器,可以使用相同的配置。我想知道如何调试这个用例的 VLAN 网络。

相关内容