我在尝试路由两个网络时遇到了 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,但是当我尝试与另一个网络上的主机联系时它失败了......我不知道我缺少什么或为什么我的路由缓存是空的。有人知道吗?