路由/桥接问题

路由/桥接问题

我在尝试路由两个网络时遇到了 raspbian(raspberry 的 debian)问题。我的网络配置是这样的(/etc/network/interfaces):

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.81.3
        netmask 255.255.255.248
        network 192.168.81.0
        broadcast 192.168.81.7
        gateway 192.168.81.1

iface eth1 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255

这就是路线打印的内容:

root@raspberrypi:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.81.1    0.0.0.0         UG    0      0        0 eth0
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
192.168.81.0    *               255.255.255.248 U     0      0        0 eth0

root@raspberrypi:~# route -C
Kernel IP routing cache
Source          Destination     Gateway         Flags Metric Ref    Use Iface

当我执行“cat /proc/sys/net/ipv4/ip_forward”时,它返回 1,所以我假设 ipForwarding 正在运行。但问题是它不在网络适配器之间转发数据包。

我可以在同一网络上的设备之间进行 ping 操作,但是当我尝试与其他网络上的主机联系时,它会失败...我不知道我缺少什么,也不知道为什么我的路由缓存是空的。有人知道吗?

答案1

固定的!

我非常关注 raspbian,认为问题应该存在,并发现 192.168.81.1 上的互联网(网关)路由器没有将 10.0.0.0 重定向回 192.168.81.3 (raspbian)。所以,我手动添加了192.168.81.1中的路由并修复了!

看来我的树莓派已成功配置,但我看得太盲目了,忘记配置我的主网关(退出到互联网的网关)。

感谢@roaima 让我大开眼界!

相关内容