linux - Ubuntu : Reset default routing table

标签 linux networking routes

<分区>

在我的电脑上,我有 2 个连接 - 3G 和 LAN。

在连接 3G 之前,路由表是这样的:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    100    0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

3G拨号后的路由表是这样的:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.64.64.64     0.0.0.0         UG    0      0        0 ppp0
10.64.64.64     *               255.255.255.255 UH    0      0        0 ppp0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

3G断开后,路由表是这样的:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

由于3G断开后默认路由被禁用,即使局域网处于事件状态,系统也无法连接到服务器。

有没有办法在3G掉线后修改路由表?

提前致谢

最佳答案

% sudo route add default gw 1​​92.168.0.1

如果route命令不可用,试试

% sudo ip route add default via 192.168.0.1

关于linux - Ubuntu : Reset default routing table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16411625/

相关文章:

networking - 如何通过pcap_sendpacket发送大于1500字节的数据包?

azure - 基于http header 自定义逻辑的动态路由(Azure、AWS、GCP)

angularjs - 具有深度嵌套路由的 Angular2 路由 v3.0.0

linux - 在 bash 中执行之前测试命令

linux - fork 的 ptraced 进程挂起

networking - 网络数据包中的哪些字段应该转换为网络字节序

linux - 路由命令输出

ASP.Net MVC 使用路由处理段

linux - 无法将工作节点连接到 kubernetes 集群

Java 无法读取包含某些 "special"字符的文件