Community discussions

MikroTik App
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Best connection mark practise?

Mon Dec 06, 2010 3:04 pm

In manlge we have several options to filter traffic.

Example:
;;; http (browsing) conn. mrk
chain=prerouting action=mark-connection new-connection-mark=normal-traffic passthrough=yes protocol=tcp dst-port=80
;;; All normal` marked con. traffic get packet mark "MED"
chain=prerouting action=mark-packet new-packet-mark=MED passthrough=no connection-mark=normal-traffic

As we see I only use one connection marker.

But I see some examples and in router exists "connection state" as well. How, and when to use these?
Should I mark a connection first with "Connection state=new" and then have a second filter just looking to existing connections with "Connection state=established"?

Any advices on this with explanation why please?

[my QoS works fine at this moment I believe but to avoid future problems due growth of traffic flow I want to optimize my QoS as much as possible]
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7056
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Best connection mark practise?

Mon Dec 06, 2010 3:08 pm

if you use connection-state=new it means that connection mark is assigned only once at the time when first packet arrives. If you don't have connection-state=new then connection mark is rewritten every time when packet arrives belonging to particular connection.
Obviously first method uses less resources.
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: Best connection mark practise?

Mon Dec 06, 2010 3:21 pm

OK,

So my example should then read:

;;; http (browsing) conn. mrk
chain=prerouting action=mark-connection new-connection-mark=normal-traffic passthrough=yes connection-state=new protocol=tcp dst-port=80

;;; All normal` marked con. traffic get packet mark "MED"
chain=prerouting action=mark-packet new-packet-mark=MED passthrough=no connection-mark=normal-traffic


As long as this connection exists in conn tracker all packages belonging to this connection get the mark "MED"

For what purpose is now the "established" option of conn. state? I mean, as long as the connection is there it already gets marked? Is there any need for this "established" option?
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: Best connection mark practise?

Mon Dec 06, 2010 6:59 pm

if you use connection-state=new it means that connection mark is assigned only once at the time when first packet arrives. If you don't have connection-state=new then connection mark is rewritten every time when packet arrives belonging to particular connection.
Obviously first method uses less resources.
For what purpose is now the "established" option of conn. state? I mean, as long as the connection is there it already gets marked? Is there any need for this "established" option?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Best connection mark practise?

Mon Dec 06, 2010 7:08 pm

Usually not in marking/mangling packets. It's useful in other situations, such as statefully permitting packets through firewall filters.
 
WirelessRudy
Forum Guru
Forum Guru
Topic Author
Posts: 3119
Joined: Tue Aug 08, 2006 5:54 pm
Location: Spain

Re: Best connection mark practise?

Mon Dec 06, 2010 8:07 pm

Ok fewi, many thanks. You are worth your karma.

Have you seen my other topic: http://forum.mikrotik.com/viewtopic.php?f=2&t=47218 ?
I got no replies to it. Is my question too complicated or too stupid to get any replies?

I am trying to discover all finesses of mangle and QoS but I need some confirmation or other opinions at times to se if my thinking is in the right direction. Please comment.

Who is online

Users browsing this forum: Bing [Bot], diasdm, mansuramir and 184 guests