路由/网桥问题

网络工程 路由器 linux
2022-02-22 14:21:41

我在尝试路由两个网络时遇到了 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 上的 Internet(网关)路由器没有将 10.0.0.0 重定向回 192.168.81.3(raspbian)。于是,我在 192.168.81.1 中手动添加了路由并修复了!

似乎我的树莓派配置成功了,我看得太盲目了,忘了配置我的主网关(退出到互联网的那个)。

我现在因为那个菜鸟失败而感到非常愚蠢...... T_T

其它你可能感兴趣的问题