使用iptables转发stream量到一个IP地址

设置:

Debian的; 作为使用iptables的networking路由器,fail2ban由于外部的要求,两个networking都是192.168.1.x. eth0:192.168.1.1 eth1:192.168.1.2

Ubuntu(192.168.1.3)充当eth0的networking桥:192.168.1.3 wlan0:192.168.1.10

客户端计算机(192.168.1.100至200)连接到交换机

我的内部networking上的Debian eth0(192.168.1.1)连接到一台交换机以及台式计算机,无线设备等的客户端计算机。

eth1直接连接到Ubuntu的eth0。

我可以从Debian ping到ssh到Ubuntu而没有任何问题。 当我尝试从其中一台客户端计算机(连接到Debian的eth0)ping或SSH时,我的连接超时。

我不确定是否应该使用路由(或完全确定如何使用路由)或iptables从Debian的eth0获取stream量到eth1和Ubuntu。

这是我的iptables输出:

Chain INPUT (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 state NEW Chain FORWARD (policy DROP 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT all -- eth2 eth0 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT all -- eth0 eth1 0.0.0.0/0 0.0.0.0/0 0 0 REJECT all -- eth1 eth1 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable 

将不胜感激任何帮助。 谢谢!

你是否已经桥接了debian机箱上的接口? 如果没有,那么哪个接口的IP地址是192.168.1.2 。 你的debian盒上的其他接口有哪些ip地址? 请在问题中添加此信息。

由于问题并不完整,我只能“猜测”Debian上的路由表混淆了,因为您已经为debian框的两个非桥接接口分配了相同的ipnetworking地址(甚至是相同的ip地址)。

如果确实是这个问题,那么你应该把ubuntu-debian连接上的ipnetworking改成一些不同的C类networking。 说192.168.2. / 255.255.255.0 192.168.2. / 255.255.255.0 ,所以debian eth1会有192.168.2.3而ubuntu会得到192.168.2.4

那么你应该可以通过inputssh [email protected]从你的客户端访问ubuntu,即使你的客户端都在192.168.1.xxx/255.255.255.0 ipnetworking中。