LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 04-21-2010, 11:24 AM   #1
toure32
LQ Newbie
 
Registered: Nov 2009
Posts: 26

Rep: Reputation: 15
iptable Mark packet and use this mark in other rule


Hi, all
I'll like to mark all packet coming from and going to an ip adresse. And I'd like to match that mark packet in an other rule.
Ex :
Rule 1 : Mark all packet coming from 192.168.2.0/25 with number 1
Rule 2 : Drop all packets which has been mark with number 1

How could I write these tow rules.
Regards.

Last edited by toure32; 04-21-2010 at 02:33 PM.
 
Old 04-21-2010, 02:07 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
example:
Code:
iptables -A PREROUTING -t mangle --match mark --mark 1 -j ACCEPT
iptables -A PREROUTING -t mangle -i eth1 -j MARK --set-mark 1
or you can use chains rather then mark.
or -m recent

Last edited by troop; 04-21-2010 at 02:13 PM.
 
1 members found this post helpful.
Old 04-21-2010, 02:13 PM   #3
toure32
LQ Newbie
 
Registered: Nov 2009
Posts: 26

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by troop View Post
use chains rather then mark.
or you can use -m recent
Can you give detaille please.
regards.
 
Old 04-21-2010, 02:35 PM   #4
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
Quote:
Originally Posted by toure32 View Post
Can you give detaille please.
regards.
example with chain:
Code:
iptables -N m1
iptables -A INPUT -s 192.168.2.0/25 -j m1
iptables -A m1 -j DROP
 
  


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
Question Mark aemerick Linux - Server 1 03-30-2009 03:16 PM
How to mark up a pdf document? taxpayer Linux - Software 7 08-15-2008 07:40 AM
iptables MARK ImpactDNI Linux - Software 1 09-02-2006 01:40 PM
firewall mark HOW? dudulz Linux - Networking 2 06-05-2006 12:15 AM
-- Mark -- gbowden Slackware 2 02-01-2006 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:50 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
Open Source Consulting | Domain Registration