LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 07-07-2005, 12:27 AM   #1
MarleyGPN
Member
 
Registered: Apr 2003
Location: Vail, CO
Posts: 73

Rep: Reputation: 15
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
 
Old 07-08-2005, 01:54 PM   #2
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables packet data filtering firewall <Ol>Origy Linux - Networking 1 08-15-2005 06:07 AM
Per-program packet filtering with iptables? tumbelo Linux - Security 1 08-01-2005 10:53 PM
iptables and payload filtering mosio Red Hat 1 07-09-2005 05:09 PM
iptables and content filtering evan1821 Linux - Security 1 06-09-2004 01:03 PM
Sendmail Spam filtering and Virus filtering MrJoshua Linux - General 2 04-03-2003 10:12 AM


All times are GMT -5. The time now is 05:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration