LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Filtering in iptables mangle? (https://www.linuxquestions.org/questions/linux-networking-3/filtering-in-iptables-mangle-340818/)

MarleyGPN 07-07-2005 12:27 AM

Filtering in iptables mangle?
 
Is there any side effects filtering packets in prerouting in the mangle table. I have the computer connected to two subnets. eth0 my private network and eth1 the university network which is also my internet. I used to have these in the nat table but read that they can be bypassed under certain ceircumstances. This is mainly to prevent people from setting their default gateway to my computer to access my private network ip_forwarding lets them do this otherwise

#Block Gateway Attempts from eth1
iptables -t mangle -A PREROUTING -i eth1 -d ! 172.26.16.0/24 -j DROP

# Block packet Spoof Attempts from eth1
iptables -t mangle -A PREROUTING -i eth1 -s 192.168.0.0/16 -j DROP

# Block Gateway Attempts from tun0 (VPN)
iptables -t mangle -A PREROUTING -i tun0 -d 192.168.0.0/16 -j DROP
iptables -t mangle -A PREROUTING -i tun0 -d 172.16.0.0/12 -j DROP

# Block packet Spoof Attempts from tun0
iptables -t mangle -A PREROUTING -i tun0 -s 192.168.0.0/16 -j DROP
iptables -t mangle -A PREROUTING -i tun0 -s 172.16.0.0/12 -j DROP


I noticed that openvpn has been disconnecting after i moved these from nat to mangle.

Thanks,
MarleyGPN

archtoad6 07-08-2005 01:54 PM

Opening on a humorous note: To quote a local Widiot (tm:)) "Why would you want to do thaaat?" This in an MCSE class discussing *nix ability to accept multiple simultaneous log-ins.

Well, why would you want to do that? -- Oskar Andreasson in Iptables Tutorial 1.1.19 says don't do that: (3.2. mangle table)
Quote:

3.2. mangle table

This table should as we've already noted mainly be used for mangling packets. In other words, you may freely use the mangle matches etc that could be used to change TOS (Type Of Service) fields and so on.

You are strongly advised not to use this table for any filtering; nor will any DNAT, SNAT or Masquerading work in this table.

Targets that are only valid in the mangle table:
TOS
TTL
MARK
If you have come up with a good reason the break this "rule", I would be very interested to see it.

If Oskar were asked "Is there any side effects filtering packets in prerouting in the mangle table.", his short answer might be "Yes, all bad."

Hope this helps, please post your results.


All times are GMT -5. The time now is 09:37 AM.