I need to share bandwidth to all clients on a RB750 with a DSL PPPoE connection as the WAN port and ether2-local-master as LAN port. Everything is working great except bandwidth sharing. The DSL connection is 3Mbps. I want to allow users to get up to 3Mbps if available and to distribute bandwidth equally when needed. The RB750 is setup with DHCP server and NAT Masquerade. Just your typical router setup, but with bandwidth sharing. Why is the bandwidth sharing not working?
Here is the configuration:
/interface pppoe-client
add ac-name=“” add-default-route=yes allow=pap,chap,mschap2 comment=“” dial-on-demand=no disabled=no interface=ether1-gateway max-mru=1480 max-mtu=
1480 mrru=disabled name=pppoe-out1 password=xxxx profile=default service-name=“” use-peer-dns=yes user=user@islc.net
/ip pool
add name=default-dhcp ranges=192.168.2.10-192.168.2.50
add name=pptp ranges=192.168.2.230-192.168.2.240
/ip dhcp-server
add add-arp=yes address-pool=default-dhcp authoritative=after-2sec-delay bootp-support=static disabled=no interface=bridge1 lease-time=1d name=
default
/ip dhcp-server config
set store-leases-disk=5m
/ip dhcp-server network
add address=192.168.2.0/24 comment=“default configuration” dns-server=192.168.2.1 gateway=192.168.2.1
/ip firewall nat
add action=masquerade chain=srcnat comment=“default configuration” disabled=no out-interface=pppoe-out1
/ip firewall mangle add chain=forward src-address=192.168.2.0/24
action=mark-connection new-connection-mark=users-con
/ip firewall mangle add connection-mark=users-con action=mark-packet
new-packet-mark=users chain=forward
/queue type add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
/queue type add kind=pcq name=pcq-upload pcq-classifier=src-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=512k max-limit=3M name=Download packet-mark=“” parent=ether2-local-master
priority=8 queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue2 packet-mark=users parent=Download priority=8 queue=
pcq-download
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name=Upload packet-mark=“” parent=pppoe-out1 priority=8
queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue4 packet-mark=users parent=Upload priority=8 queue=
pcq-upload
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue5 packet-mark=users parent=ether2-local-master
priority=8 queue=pcq-download
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue6 packet-mark=users parent=pppoe-out1 priority=8
queue=pcq-upload
It seems that you have set up mangle so that all traffic initiated from LAN side will have the same mark. This way you will not be able to set any limits / priorities per user. If you have many users on the router then probably you should think about PCQ
Check this
http://www.tiktube.com/?video=247
http://www.tiktube.com/?video=214
rgs Pilgrim
I thought the mangle rules I used would mark each host IP in the network 192.168.2.0/24. Also, am I not using PCQ?
PCQ for download:
/queue type add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=512k max-limit=3M name=Download packet-mark=“” parent=ether2-local-master
priority=8 queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue2 packet-mark=users parent=Download priority=8 queue=
pcq-download
PCQ for upload:
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name=Upload packet-mark=“” parent=pppoe-out1 priority=8
queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue4 packet-mark=users parent=Upload priority=8 queue=
pcq-upload
Hmmm, you are right. The mangle rule mark all traffic initiated from 192.168.1.0/24 and the queue tree rules also looks right to me. Having said this. Then I also need to say that I do not have that much experience with PCQ and it would be good if someone would also comment.
To me it looks like if the two last rules are surplus. I think these two rules should just be deleted and then the structure will be right.
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=512k max-limit=3M name=Download packet-mark=“” parent=ether2-local-master
priority=8 queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue2 packet-mark=users parent=Download priority=8 queue=
pcq-download
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=128k max-limit=512k name=Upload packet-mark=“” parent=pppoe-out1 priority=8
queue=default
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue4 packet-mark=users parent=Upload priority=8 queue=
pcq-upload
The rules above are, as far as I can see, fine. But the two rules below is not needed and conflicts with queue2 and queue4.
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue5 packet-mark=users parent=ether2-local-master
priority=8 queue=pcq-download
/queue tree add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=0 name=queue6 packet-mark=users parent=pppoe-out1 priority=8
queue=pcq-upload
You are correct, the last two queues are not needed. I disabled them but the bandwidth is still not being managed. When I get this working I am going to post on the Wiki. Seems like this would be a basic configuration for a SOHO router.
I think I got a hint why it does not work - but I am not sure. I was listening to the presentation by Megis (QoS Prague 2008) and the setup does not work under masquerade. PCQ will not work for upload Because HTB is after scr-nat and will not be able to separate the upload by clients as the client IP has been replaced by the scr-nat.
rgs Pilgrim
Edit: Check this: http://wiki.mikrotik.com/wiki/PCQ_Examples
The example uses global-in and global-out as parent queues. Global-out is before scr-nat in the postrouting chain and HTB is after.
If PCQ will not work, what will work? Anyone?
I believe the bandwidth shaping is working now. My goal was to configured a RB750 as a customer CPE. It needed to be their gateway router with the following:
A PPPoE connection to their ISP.
Masquerade NAT.
DHCP Server for their LAN clients.
VPN Connections to the RB750 to access resources on their LAN.
Bandwidth shaping - Share available bandwidth equally with LAN clients.
The bandwidth sharing is working but I would like the MT to create individual queues that I would be able to see the usage for each client. I thought my original configuration would work. Does anyone know how to have individual queues created by PCQ?
Here is the configuration:
/interface pppoe-client
add ac-name=“” add-default-route=yes allow=pap,chap,mschap2 comment=“” dial-on-demand=no disabled=no interface=ether1-gateway max-mru=1480 max-mtu=
1480 mrru=disabled name=pppoe-out1 password=xxxx profile=default service-name=“” use-peer-dns=yes user=user@isp.com
/ip pool
add name=default-dhcp ranges=192.168.2.10-192.168.2.50
add name=pptp ranges=192.168.2.230-192.168.2.240
/ip dhcp-server
add add-arp=yes address-pool=default-dhcp authoritative=after-2sec-delay bootp-support=static disabled=no interface=bridge1 lease-time=1d name=
default
/ip dhcp-server config
set store-leases-disk=5m
/ip dhcp-server network
add address=192.168.2.0/24 comment=“default configuration” dns-server=192.168.2.1 gateway=192.168.2.1
/interface pptp-server server
set authentication=mschap1,mschap2 default-profile=pptp-in enabled=yes keepalive-timeout=30 max-mru=1460 max-mtu=1460 mrru=disabled
/ppp secret
add caller-id=“” comment=“” disabled=no limit-bytes-in=0 limit-bytes-out=0 local-address=192.168.2.1 name=username password=typepasswordhere profile=
pptp-in routes=“” service=any
/ip firewall nat
add action=masquerade chain=srcnat comment=“default configuration” disabled=no out-interface=pppoe-out1
/queue type add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
/queue type add kind=pcq name=pcq-upload pcq-classifier=src-address pcq-limit=50 pcq-rate=0 pcq-total-limit=2000
/queue simple add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment=“” direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=0/0 max-limit=512k/3M name=PCQ parent=none priority=8 queue=pcq-upload/pcq-download target-addresses=192.168.2.0/24 total-queue=default-small