Debian 使用外部网关访问 Internet

Debian 使用外部网关访问 Internet

我在网上查找了解决方案,但没有任何进展,我相信修复起来也很简单。我确实找到了https://serverfault.com/questions/ask?title=debian%20private%20gateway我认为这很相似,但仍然无法解决我的问题。我正在使用 Debian 计算机 (10.0.0.1),并尝试通过不属于同一网络 (192.168.100.254) 的网关连接到互联网。我无法访问网关,但 Debian 计算机通过交换机连接到外部网络(并且必须保持连接)。

My Debian /etc/networking/interfaces is
auto eth0
iface lo inet loopback
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0
gateway 192.168.100.254
broadcast 10.0.0.255


route -n
Destination   Gateway   Genmask       Flags     Metric    Ref   Use   Iface
10.0.0.0     0.0.0.0    255.255.255.0  U          0         0    0    eth0

我尝试过通过 192.168.100.254 添加 ip route 10.0.0.1,但问题没有解决。还尝试过在 /interfaces 中使用/不使用网关,但问题仍然没有解决。如果我将 IP 地址更改为网络内的 IP 地址,它就可以正常工作,我可以正常 ping/nslookup。

有人知道我错在哪里或者能给我指出正确的方向吗?

答案1

根据定义,您的默认网关必须位于同一子网。您需要与运行此网络的人员沟通以解决问题。

任何两个子网之间的通信都需要第 3 层路由器的协助,因此在您的情况下,需要有一个在两个子网上都有接口的路由器,以便您拥有有效的互联网连接。

相关内容