Community discussions

MikroTik App
 
justdude
just joined
Topic Author
Posts: 6
Joined: Sun Jun 24, 2018 11:02 pm

Help with WAN bandwidth limiting

Mon Mar 04, 2019 9:42 am

I want to limit WAN (regular vdsl in bridge mode) upload speed. WAN is 20/2mbit, and if upload manages to saturate uplink, keepalive packets start to timeout, so WAN link gets dropped. Since I use bridge, I have pppoe-client as wan interface, and ether1 is directly connected to vdsl modem. Fasttrack is disabled.
Currently I struggle with mangle settings.
What chains am I supposed to use? All wan bandwidth limit tutorials use forward chain, but that did not work or work opposite (marking download traffic as upload).
Currently I mark download connection using prerouting and in interface WAN
For upload connection using postrouting and out interface WAN.
And then for further package marking, I use prerouting for DL and postrouting for UL. Is this correct?
Asking because something is also wrong with this setup, since I cant even finish speedtest (to verify rules). It just hangs on download speed testing.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21908
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Help with WAN bandwidth limiting

Mon Mar 04, 2019 2:54 pm

You can also limit the number of connections as well to assist in providing equal sharing amongst users.........
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 1:38 pm

you are over doing it. the tutorials are probably policy based bandwidth limiting where one type of traffic gets x amount of bandwidth.
you don't need this.

all you need is to create a simple queue ,
/queue simple
add max-limit=1M/2M name="bandwidth limit" target=pppoe-interface
this example limits download to 2Mbps and upload to 1Mbps
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21908
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 1:45 pm

Solar are you telling us that to set up bw limits on a per user basis is that simple, no other commands?
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 2:33 pm

Hi Anav, no the PO wants limit the WAN bandwidth as a whole so that the keep-alive packets (assuming from the isp) to the vdsl modem does not get dropped.
So limiting upload to 1.8Mbps would probably enough. So the queue is applied to the PPPoE interface.

that's my understanding anyway.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21908
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 5:00 pm

I understand but what affect does that have on users...........
Is limiting sessions per user an option here as another component of the solution or not required......
 
User avatar
Steveocee
Forum Guru
Forum Guru
Posts: 1189
Joined: Tue Jul 21, 2015 10:09 pm
Location: UK
Contact:

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 5:27 pm

OP has stated line saturation is causing the PPPoE connection to drop and has sensibly suggested a limit of the PPPoE interface, I honestly don't know where the logic in limiting users individually came from there?

@OP the solution from @solar77 is perfect for you. Be aware though I think when you set the rule up the TX & RX values are actually back to front for you as a user but testing will show that. There is no mangle needed to do this and it takes absolutely minimal CPU up in comparison.

Once you have it created, have a play with queue types, pfifo can be useful but I find using an SFQ is a touch "fairer" on the LAN.
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 5:32 pm

@anav I don't think limiting sessions is a solution here.
if you watch under firewall - > connections, and do a speed test, such as speedtest.net, you will find it likes to use TCP port 80 over multiple connections. Some streaming services will do the same, (where I thought they should use UDP ). so all it takes is a few of these connections then the bandwidth from that particular user will flat out your up-link.

the only case I use limit connections, is where I use L7 rule to catch torrent traffic, then limit their connection to 100 per IP, along with blocking most of the ports on their outgoing traffic.

when you only use simple queue to limit bandwidth on WAN interface, it in theory have no effect on how much bandwidth a LAN IP can get as long as it's within the overall limit.
to improve on this, you can add a PCQ rule to LAN subnet, then even with very high Max limit, heavy user will have to give up their bandwidth if there is a request from another user, until all bandwidth request is equalised.

you can play with this by running btest from your laptop / computers, to the Mikrotik, starting off with 1, then start 2, then 3, and watch the sessions in Btest server, it's good fun.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21908
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 6:23 pm

Thanks solar, at tad complicated for me, perhaps in five years when I retire I will be able to play and learn more depth on these routers..........
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Help with WAN bandwidth limiting

Tue Mar 05, 2019 7:10 pm

ha ha avav, that makes the two of us. :D I am more into traffic management and know less about routing. there is always something new to pick up when I visit this forum. Keeps working fun.
 
justdude
just joined
Topic Author
Posts: 6
Joined: Sun Jun 24, 2018 11:02 pm

Re: Help with WAN bandwidth limiting

Wed Mar 06, 2019 3:21 pm

you are over doing it. the tutorials are probably policy based bandwidth limiting where one type of traffic gets x amount of bandwidth.
you don't need this.

all you need is to create a simple queue ,
/queue simple
add max-limit=1M/2M name="bandwidth limit" target=pppoe-interface
this example limits download to 2Mbps and upload to 1Mbps

Thanks, will give it a try! But arent simple queue highly discouraged because of [forgot the reason] :D Could be routing performance, cpu usage or something else?
Found it:
Simple Queues used to have a performance hit, but ever since 6.30, performance On simple queues has been better than queue trees.
So I will give it a try ;)

EDIT: it works, only weird this is that directions are reversed :) Total upload is active when I download and total download when I upload - meaning max-limit=1M/2M would translate to 1M download and 2M upload. Happens on 6.44beta28 and 6.44 stable. Could be bug, could be normal :D
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Help with WAN bandwidth limiting

Fri Mar 08, 2019 5:12 pm

it's rx/tx , I think, so upload or download depending on that interface / target you apply it to.
 
User avatar
Steveocee
Forum Guru
Forum Guru
Posts: 1189
Joined: Tue Jul 21, 2015 10:09 pm
Location: UK
Contact:

Re: Help with WAN bandwidth limiting

Sun Mar 10, 2019 8:21 am

it's rx/tx , I think, so upload or download depending on that interface / target you apply it to.
Correct, however it is done from client of interface perspective so for pppoe interface the values do reverse.

Who is online

Users browsing this forum: No registered users and 12 guests