LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-03-2015, 09:50 AM   #1
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Rep: Reputation: 4
iptables, zones and traffic management


hello everyone

I have question about creating iptables zones and managing traffic with zones. In my example does that mean that in IZONE only accepts traffic from the external interface "eth0" and sends to it? and do I need to define any more: "iptables -A IZONE -i eth0" and "iptables -A IZONE -o eth0"


Example:

IP address:
eth0/192.168.1.100

Interfaces:
eth0 - external interface
eth1 - internal interface

#!/bin/bash

iptables -F
iptables -F -t nat
iptables -F -t mangle
iptables -X
iptables -X -t nat
iptables -X -t mangle
iptables -Z

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -N IZONE
iptables -N LZONE

iptables -A INPUT -i eth0 -j IZONE
iptables -A OUTPUT -o eth0 -j IZONE

iptables -A INPUT -i eth1 -j LZONE
iptables -A OUTPUT -o eth1 -j LZONE

iptables -A IZONE -p tcp -s 192.168.1.100 -d 8.8.8.8 --dport 53 -m conntrack --ctstate \
NEW,ESTABLISHED -j ACCEPT
iptables -A IZONE -p tcp -s 8.8.8.8 -d 192.168.1.100 --dport 53:65535 -m conntrack --ctstate \
ESTABLISHED -j ACCEPT

iptables -A IZONE -p tcp -s 192.168.1.100 -d 0/0 --dport 80 -m conntrack --ctstate \
NEW,ESTABLISHED -j ACCEPT
iptables -A IZONE -p tcp -s 0/0 -d 192.168.1.100 --dport 80:65535 -m conntrack --ctstate \
ESTABLISHED -j ACCEPT


Thank you
 
Old 12-05-2015, 03:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by paul2015 View Post
I have question about creating iptables zones and managing traffic with zones.
I'm not seeing any Netfilter-centric "zoning" concept here: just usage of arbitrary chain names.


Quote:
Originally Posted by paul2015 View Post
In my example does that mean that in IZONE only accepts traffic from the external interface "eth0" and sends to it?
Yes, the filter table INPUT chain routes all traffic from eth0 to chain "IZONE", just like the filter table INPUT chain routes all traffic from eth1 to chain "LZONE".


Quote:
Originally Posted by paul2015 View Post
and do I need to define any more: "iptables -A IZONE -i eth0" and "iptables -A IZONE -o eth0"
Try putting into words what those rules would do and explain what you are trying to accomplish?
 
Old 12-06-2015, 06:07 AM   #3
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
Thank you

you completely answered my question about how traffic is redirected from INPUT -i eth0 to chain IZONE so I don't need to write rule like: iptables -A INPUT -i eth0 -p tcp .... instead I can iptables -A IZONE -p tcp .... it means that traffic comes from eth0 interface. About "zones" I was wrong that it is chains I am creating (IZONE,LZONE). but I have read that "The firewalld daemon manages groups of rules using entities called "zones". Zones are basically sets of rules dictating what traffic should be allowed depending on the level of trust you have in the networks your computer is connected to. Network interfaces are assigned a zone to dictate the behavior that the firewall should allow."

So as level of trust for local network I will use GZONE (green zone) name of chain and for internet RZONE (red zone) name of the chain an then dictate what to traffic will be blocked and where it will go, will this chains function like zones?
 
Old 12-06-2015, 07:10 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I do not have any clue (yet) as to how firewalld handles "zones" (as one of the first things I do is disable firewalld and enable good 'ol iptables.service) so if you want to stay with the "zone" concept then using whatever interface firewalld provides for managing rule sets is probably the most efficient way?..
 
Old 12-06-2015, 07:29 AM   #5
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
well I do the same when I configure firewall remove firewalld and install iptables-services. I don't want to stay with zone concept, I was just interested that is there some advantages of using zones. If zones, as written are set of rules assigned to network interface and firewalld controls behavior what should be allowed, it means that I can do same with iptables. for example: name chains "zone" names redirect traffic from specific interface to that chain "zone" and manage set of rules associated to that chain "zone" as I need. There is nothing new I guess.
 
Old 12-06-2015, 07:56 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Indeed AFAIK there is nothing "new" in firewalld (as in changes to the Netfilter framework) and I seriously loathe any interface that vomits CSF, Control Panel-driven or UFW-like rule sets.
 
1 members found this post helpful.
Old 12-06-2015, 07:58 AM   #7
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
thanks for your answers
 
Old 12-06-2015, 08:03 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You're welcome. Please mark this thread solved when done?
 
Old 12-06-2015, 08:13 AM   #9
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
of course.
 
  


Reply



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, zones and traffic management paul2015 Linux - Networking 4 12-03-2015 03:11 PM
Solaris 10 with zones, outbound Internet traffic blocked. HElP! Ben99 Solaris / OpenSolaris 7 04-04-2011 03:25 PM
zones and Resource Management under Opensolaris? your_shadow03 Solaris / OpenSolaris 5 07-10-2009 03:17 AM
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 11:26 AM
Traffic management priyadarshan Linux - Newbie 5 03-30-2009 09:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:56 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration