Sag*_*gar 4 networking linux routing route ip-routing
我尝试设置的系统有一个 IP 地址172.31.2.1。它的默认网关是172.31.254.1。这工作正常,我可以访问网关允许我访问的任何内容(172.31.0.0/16 + 149.244.178.0/24)。
在149.244.178.1有另一个网关,它允许我访问149.244.0.0 中的任何内容,我正在尝试将其添加到表中,以便我可以访问149.244.64.250。
这是我的路由表目前的样子:
Kernel IP Routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.31.0.0 * 255.255.0.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 172.31.254.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
route add 149.244.0.0/16 gw 149.244.178.1给出错误:
route: netmask 0000ffff doesn't make sense with host route.
Run Code Online (Sandbox Code Playgroud)
route add -net 149.244.0.0/16 dev eth0将路由表更改为:
Kernel IP Routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.31.0.0 * 255.255.0.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
149.244.0.0 * 255.255.0.0 U 0 0 0 eth0
default 172.31.254.1 0.0.0.0 UG 0 0 0 eth0
Run Code Online (Sandbox Code Playgroud)
但是,尝试添加网关仍然给我同样的错误。对不起,如果这听起来令人费解,任何帮助表示赞赏!
149.xxx 主机不会在您的本地子网中,因此您的计算机将无法联系它。您的子网和该子网之间的路由器应该同时具有 149.x 和 172.x 地址(希望在两个不同的 NIC 上),它将在两个子网之间路由。
| 归档时间: |
|
| 查看次数: |
8723 次 |
| 最近记录: |