LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-24-2012, 08:22 AM   #1
tastiero
LQ Newbie
 
Registered: Mar 2012
Location: Rome (Italy)
Posts: 17

Rep: Reputation: Disabled
allows outgoing traffic for two mac address with iptables


i'm using IPCOP like firewall for my lan.
i want to block outgoing traffic of all client except two mac address.
i use this rule for the first client:
iptables -I CUSTOMFORWARD -o eth1 -m mac ! --mac-source xx:xx:xx:xx:xx:xx -j DROP
when i insert the second rule with the second mac addres i have problems.
only one client works fine.
what's wrong?
thank you
 
Old 03-24-2012, 09:29 AM   #2
smilemukul
Member
 
Registered: Jun 2009
Distribution: Redhat,CentOS,Ubuntu,Puppet
Posts: 292

Rep: Reputation: 34
First of all your first rule is incorrect, where -o is mentioned -i should be inserted in iptables -I CUSTOMFORWARD -o eth1 -m mac ! --mac-source xx:xx:xx:xx:xx:xx -j DROP & also in your first rule you are denying traffic to all which is taking precedence.

The correct rule,

1. First apply rule for the clients to accept for the two mac addresses as,
iptables -I OUTPUT -i eth1 -p tcp -m mac --mac-source <first mac address to accept> -j ACCEPT
iptables -I OUTPUT -i eth1 -p tcp -m mac --mac-source <Second mac address to accept> -j ACCEPT

2. Now drop/reject outgoing traffic for all clients as,
iptables -I OUTPUT -i eth1 -p tcp -j DROP

Note: Drop takes preceedence over Accept rule.
 
1 members found this post helpful.
Old 03-24-2012, 10:19 AM   #3
tastiero
LQ Newbie
 
Registered: Mar 2012
Location: Rome (Italy)
Posts: 17

Original Poster
Rep: Reputation: Disabled
thank you. i try and let you know
 
Old 03-26-2012, 05:11 AM   #4
tastiero
LQ Newbie
 
Registered: Mar 2012
Location: Rome (Italy)
Posts: 17

Original Poster
Rep: Reputation: Disabled
solved

i found the right solution:
iptables -A CUSTOMFORWARD -p tcp -o eth1 -m mac --mac-source <first mac address> -j ACCEPT
iptables -A CUSTOMFORWARD -p tcp -o eth1 -m mac --mac-source <second mac address> -j ACCEPT
iptables -A CUSTOMFORWARD -p tcp -o eth1 -j DROP

thanks smilemukul
 
  


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/Squid with outgoing traffic NoTeef Linux - Networking 3 06-27-2011 08:29 AM
IPtables: Route outgoing traffic from internal host to only go a internet interface predatorz Linux - Networking 4 11-24-2010 10:05 AM
IPTables How to make outgoing traffic show from a different IP address codenjanod Linux - Networking 4 11-05-2009 02:10 PM
to change outgoing mac and ip address korenje Linux - Networking 3 12-31-2005 01:41 AM
Iptables - Redirecting Outgoing Traffic Frankablu Linux - Networking 1 06-12-2005 02:18 PM


All times are GMT -5. The time now is 11:58 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration