Hello,
H.S. a écrit :
>
> I have three LAN network, 192.168.0.0, 192.168.5.0 and 192.168.1.0,
> connected to three interfaces on my router machine running Debian Linux.
>
> Related to this, I would like to forward all my local traffic among all
> my local networks. My external interface is ppp0. My local network
> interfaces are eth0, eth1 and ath0.
>
> Previously, I was using these two forwarding rules:
> $IPTABLES -A FORWARD -i eth0 -o ath0 -j ACCEPT
> $IPTABLES -A FORWARD -i ath0 -o eth0 -j ACCEPT
> $IPTABLES -A FORWARD -i eth0 -o eth1 -j ACCEPT
That's three rules, not two. ;-)
> The first two rules to allow 192.168.0.0 and 192.168.5.0 networks to
> talk to each other.
Yes.
> The last rule is to allow 192.168.0.0 and
> 192.168.1.0 networks to talk to each other.
Actually it allows only forwarded traffic from eth0 to eth1, but not the
other way.
> So, I probably I have to
> write a pair of rules for each combination of the three networks. Is
> that right?
Yes. In some special cases you may also need to accept traffic forwarded
from an interface to itself. But do you trust your modem and ISP enough
to allow *any* traffic from the modem subnet ? I personnally would not
trust them more than the rest of the internet, so I would apply the same
rules as for the traffic on the PPP interface.
> I was also thinking that I may use the negation of match in iptables to
> allow all forwarding among non-ppp0 interfaces with a rule like this:
> $IPTABLES -A FORWARD -i !$EXTIF -o !$EXTIF -j ACCEPT
>
> Will the above work? It appears not to, looks like I am not doing
> something right.
Try to insert a space between the ! and the interface name.
Also, you could use a wildcard : e.g. ppp+ will match any interface name
starting with "ppp". However I don't like such negations in ACCEPT
rules, because if any other interface comes up for any reason (tunnel,
VPN...), all traffic will be accepted inconditionnally. Six rules are
not a big hassle.
|