Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Marking packets (ipp2p)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wilu
n00b
n00b


Joined: 13 Apr 2006
Posts: 4
Location: Cracow (PL)

PostPosted: Sun Nov 11, 2007 4:55 pm    Post subject: Marking packets (ipp2p) Reply with quote

I need to perform a simple packet filtering - obviously against p2p...
So, the most elementary packets classification - p2p ant not p2p.
I've read ipp2p doc and there's an example, that nearly satisfies my needs.
Code:
01# iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark
02# iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT
03# iptables -t mangle -A PREROUTING -p tcp -m ipp2p --ipp2p -j MARK --set-mark 1
04# iptables -t mangle -A PREROUTING -p tcp -m mark --mark 1 -j CONNMARK --save-mark
So, iptables marks all known p2p packets. What about the rest of packets (not p2p)? I'd like to mark them too in order to perform some shaping afterwards. I've tried the simplest extension of above mentioned code, meaning
Code:
01# iptables -t mangle -A PREROUTING -p tcp -j CONNMARK --restore-mark
02# iptables -t mangle -A PREROUTING -p tcp -m mark ! --mark 0 -j ACCEPT
03# iptables -t mangle -A PREROUTING -p tcp -m ipp2p --ipp2p -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -j MARK --set-mark 2
04# iptables -t mangle -A PREROUTING -p tcp -m mark --mark 1 -j CONNMARK --save-mark
I expected that the packets which do not satisfy rule 3 will be marked in accordance with next rule, that doesn't impose any requirement.
The problem is, there are no differences in both two - indeed, p2p connections get appropriate mark, but all the other connections remain unchanged (mark=0).

I doubt if it makes any difference, but I'm trying to mark packets in a FORWARD chain (mangle table of course).

Suggestions?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum