Skip to contentSkip to conversation

tc and traffic established,related

DISCUSSION Fabio Marcone 3 participants 3 messages Jul 21, 2009

lore
Share & tools
lore
#0 lore raw

Hi!

I'm studying traffic shaping and I have some doubts...

I have a linux router and I mark packets from lan to wan and I use a tc class to limit datarate (selecting packets by mark). but how can I recognize answer packets? How can I know is a packet is about a connection previously established?

If I succeed I can limit upload and download rate of a particular connection...

Thanks in advance,
Fabio

#1 lore raw

Hello,

Quoted 3 lines · Fabio Marcone

I have a linux router and I mark packets from lan to wan and I use a tc class to limit datarate (selecting packets by mark). but how can I recognize answer packets? How can I know is a packet is about a connection previously established?

See the CONNMARK target and the connmark match.

#2 lore raw
Quoted 12 lines · Pascal Hambourg

Hello,

Fabio Marcone a écrit :

Quoted 5 lines

I have a linux router and I mark packets from lan to wan and I use a tc class to limit datarate (selecting packets by mark).
but how can I recognize answer packets? How can I know is a packet is about a connection previously established?

See the CONNMARK target and the connmark match.

When you mark a packet, you can propagate this mark to the connexion the packet is from using the rule:

iptables -t mangle -A OUTPUT -j CONNMARK --restore-mark

And then, the mark will appear in /proc/net/ip_conntrack and all the packets of this connexion will be marked.

Signature · 2 lines
julien
http://jve.linuxwall.info/blog