(E-Mail Removed) a écrit :
>
> Basically i have 2 networks let say eth1 (10.0.0.1) is gatway 1 and
> eth2 (192.168.0.1) is gatway 2.
>
> I want to allow clients on eth1 to be able to connect to any port 25
> mail server on the internet. But clients on gatway 2 are not allowed
> any outgoing connects on port 25.
Are clients on eth2 allowed to connect to SMTP servers on eth1 ?
> I was think last night of somthing like this:
>
> /usr/sbin/iptables -t nat -A PREROUTING -s <net mask> -p tcp --
> destination-port 25 -j DROP
The 'nat' table is not intended for filtering, it is reserved for
address and port translation. Also, matching on the input interface is
more reliable that matching on the source address.
If you want to prohibit the clients on eth2 from connecting to SMTP
servers outside their own network (including eth1) :
iptables -I FORWARD -i eth2 -p tcp --dport 25 -j DROP (or REJECT)
If you want to prohibit the clients on eth2 from connecting to servers
on internet only (eth0) :
iptables -I FORWARD -i eth2 -o eth0 -p tcp --dport 25 -j DROP