Community discussions

MikroTik App
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2509
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Mangle rules for all download and upload speed

Thu Nov 19, 2020 1:18 pm

Hello,
I want to limit the total download and upload speed and want to start marking the traffic.
Is this the correct method that I am showing here?
If not can you help me please
/ip firewall mangle
add action=mark-packet chain=prerouting comment=upload-all-bandwidth in-interface-list=WAN new-packet-mark=upload-all-bandwidth passthrough=yes src-address=0.0.0.0/0
add action=mark-packet chain=postrouting comment=download-all-bandwitdth dst-address=0.0.0.0/0 new-packet-mark=download-all-bandwidth out-interface-list=WAN passthrough=yes
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: Mangle rules for all download and upload speed

Thu Nov 19, 2020 11:52 pm

Suggest you mark connections first, then packets of these connections
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2509
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Mangle rules for all download and upload speed

Fri Nov 20, 2020 9:34 am

Thanks, i do that and try it out.
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2509
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Mangle rules for all download and upload speed

Fri Nov 20, 2020 10:48 am

Is this correct?
/ip firewall mangle
add action=mark-connection chain=prerouting comment=upload-conn-all-bandwidth in-interface-list=WAN new-connection-mark=upload-full-bandwidth-conn passthrough=yes src-address=0.0.0.0/0
add action=mark-connection chain=postrouting comment=download-conn-all-bandwitdth dst-address=0.0.0.0/0 new-connection-mark=download-full-bandwidth-conn out-interface-list=WAN passthrough=yes
add action=mark-packet chain=prerouting comment=upload-all-bandwidth connection-mark=upload-full-bandwidth-conn in-interface-list=WAN new-packet-mark=upload-all-bandwidth passthrough=yes src-address=0.0.0.0/0
add action=mark-packet chain=postrouting comment=download-all-bandwitdth connection-mark=download-full-bandwidth-conn dst-address=0.0.0.0/0 new-packet-mark=download-all-bandwidth out-interface-list=WAN passthrough=yes
add action=mark-packet chain=postrouting comment=download-all-bandwitdth dst-address=0.0.0.0/0 new-packet-mark=download-all-bandwidth out-interface-list=WAN passthrough=yes
 
WeWiNet
Long time Member
Long time Member
Posts: 597
Joined: Thu Sep 27, 2018 4:11 pm

Re: Mangle rules for all download and upload speed

Fri Nov 20, 2020 11:02 am

What works for me is:
/ip firewall mangle
add action=mark-connection chain=forward comment="DSL: DL: All traffic" in-interface=WAN1-DSL new-connection-mark=\
    All_DL_connection passthrough=yes
add action=mark-connection chain=forward comment="DSL: UL: All traffic" new-connection-mark=All_UL_connection out-interface=\
    WAN1-DSL passthrough=yes

Then from there I use the IP address to differentiate the sub queues... here I only show one IP range...
add action=mark-packet chain=forward comment="      DSL: DL: HOME_pkt_mark" connection-mark=All_DL_connection dst-address=\
    192.168.99.10-192.168.99.200 new-packet-mark=Home_DL_pkt_mark passthrough=no
add action=mark-packet chain=forward comment="      DSL: UL: HOME_pkt_mark" connection-mark=All_UL_connection \
    new-packet-mark=HOME_UL_pkt_mark packet-mark="" passthrough=no routing-mark="" src-address=192.168.99.10-192.168.99.200
    
Once this done and their traffic counter increase you know thye work.
Then go to Queue tree and set up rules...
/queue tree
add comment="DSL: DL: Main DL queue (all traffic)" limit-at=5M max-limit=5500k name="Main DL" parent=global priority=1 queue=\
    ethernet-default
add burst-limit=5500k burst-threshold=5M burst-time=3m20s comment="      DSL: DL: Home DL queue" limit-at=3500k max-limit=5M \
    name=Home_DL packet-mark=Home_DL_pkt_mark parent="Main DL" priority=2 queue=default
add comment="DSL: UL: Main UL queue (all traffic)" limit-at=760k max-limit=830k name="Main UL" parent=global priority=1 \
    queue=ethernet-default
add burst-limit=800k burst-threshold=600k burst-time=3m20s comment="      DSL: UL: Home UL queue" limit-at=500k max-limit=\
    650k name="Home UL" packet-mark=HOME_UL_pkt_mark parent="Main UL" priority=2 queue=default
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: Mangle rules for all download and upload speed

Fri Nov 20, 2020 2:34 pm

Is this correct?
...
I dont have full view of the environment you are doing this, but think it will be safe to say:

1. Remove src/dst ranges, you have in interface and the current src/dst ranges is for all anyway
2. I will not use interface list, but rather interface itself, you might have multiple interface in WAN as example
3. Add "connection-mark=no-mark" to the connection mark rules so when connection is already marked, does not have to redo it
4. Change the post routing to pre routing
 
plisken
Forum Guru
Forum Guru
Topic Author
Posts: 2509
Joined: Sun May 15, 2011 12:24 am
Location: Belgium
Contact:

Re: Mangle rules for all download and upload speed

Sun Nov 22, 2020 3:16 pm

Thanks for your reply
I want to determine the total down and upload to the internet for one subnet.
To then configure PCQ with the created total down and upload rule as parent.

Who is online

Users browsing this forum: BoraHorza and 189 guests