是否可以将两个不同的默认网关添加到android中两个不同网卡的路由表中?
默认情况下,默认连接的数据包将使用 eth0 出/入。 路由表中的默认网关是eth0的gw ip。
当另一个接口说 eth1 已启动时,我想为 eth1 添加另一个默认网关。 在安卓上可以吗? 因为我无法为 eth1 添加另一个默认网关,因为已经存在 eth0。
感谢您的帮助。
By default, the packets of default connection will use eth0 to go out/in.
The default gateway in the routing table is eth0's gw ip.
When another interface said eth1 is up, I want to add another default gateway for eth1.
Is that possible in android?
Since I cannot add another default gateway for eth1 because there already exists eth0's.
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认网关只有一个,它是默认网关。您可以拥有多个接口,每个接口具有不同的网关,但只有一个默认网关(您的系统无法选择)。
想象一下:
您应该至少有 3 条路由(通常是自动的):
所以您会看到,您不需要多个默认网关。您可能需要的是特定路由的网关。想象一下,您的网络
192.168.2.0
只能通过使用192.168.1.1
处的网关来访问。通过上述配置,您的计算机将尝试使用默认网关192.168.0.1
。您可以使用类似的内容:这样您将拥有 2 个网关,但默认只有 1 个。第二个仅用于 192.168.2.0 网络。
A default gateway is only one, it's the default. You can have several interfaces each one with a different gateway, but only one default (your system cannot choose).
Imagine this:
You should have at least 3 routes (usually automatic):
So you see, you don't need more than one default gateway. What you might want is a gateway for a specific route. Imagine that you have the network
192.168.2.0
that can only be reached by using gateway at192.168.1.1
. With the above configuration, your machine would try to use the default gateway192.168.0.1
. You could use something like:This way you'll have a 2 gateways, but only 1 is the default. This second one is only used for 192.168.2.0 network.
它可以在 Windows 10 计算机中使用,第二个作为软件界面处理并用于后备。我希望 Android 也有这个功能,但每次我的电缆坏掉才能更改为 ADSL 时,我都必须手动更改它。
It is posible in a Windows 10 machine, the second is handled as a software interface and is used for fallback. I expected android to have this feature too but instead I have to change it manually every time my cable dies to change to ADSL.