{"id":3700,"date":"2012-04-14T23:27:53","date_gmt":"2012-04-15T05:27:53","guid":{"rendered":"http:\/\/gregsowell.com\/?p=3700"},"modified":"2012-04-14T23:37:29","modified_gmt":"2012-04-15T05:37:29","slug":"using-pcq-with-pppoe-mikrotik","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=3700","title":{"rendered":"Using PCQ With PPPoE &#8211; Mikrotik"},"content":{"rendered":"<p>I came up with a method about 2 years ago to use <a href=\"http:\/\/gregsowell.com\/?p=1725\">PCQs<\/a> with PPPoE instead of the traditional simple queue(SQ) method.  As you guys know SQs are more resource intensive and as they grow they can delay packet delivery.  Using PCQs can help the resources on heavily utilized routers.<\/p>\n<p><strong>Quick video of configuring everything:<\/strong><\/p>\n<div id=\"media\">\n            <object id=\"csSWF\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"640\" height=\"498\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,115,0\"><param name=\"src\" value=\"\/classes\/pppoe-address-list\/pppoe-address-list_controller.swf\"\/><param name=\"bgcolor\" value=\"#1a1a1a\"\/><param name=\"quality\" value=\"best\"\/><param name=\"allowScriptAccess\" value=\"always\"\/><param name=\"allowFullScreen\" value=\"true\"\/><param name=\"scale\" value=\"showall\"\/><param name=\"flashVars\" value=\"autostart=false\"\/><embed name=\"csSWF\" src=\"\/classes\/pppoe-address-list\/pppoe-address-list_controller.swf\" width=\"640\" height=\"498\" bgcolor=\"#1a1a1a\" quality=\"best\" allowScriptAccess=\"always\" allowFullScreen=\"true\" scale=\"showall\" flashVars=\"autostart=false&#038;thumb=FirstFrame.png&#038;thumbscale=45&#038;color=0x000000,0x000000\" pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash\"><\/embed><\/object>\n        <\/div>\n<p><strong>Diagram used in this example<\/strong><br \/>\n<a href=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/04\/diagram.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gregsowell.com\/wp-content\/uploads\/2012\/04\/diagram.png\" alt=\"\" title=\"diagram\" width=\"398\" height=\"177\" class=\"aligncenter size-full wp-image-3719\" srcset=\"https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/04\/diagram.png 398w, https:\/\/gregsowell.com\/wp-content\/uploads\/2012\/04\/diagram-300x133.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><\/a><\/p>\n<h2>Usermanager<\/h2>\n<p>One of the options in usermanager is address-list.  If you add something to the address-list entry it will cause a user&#8217;s IP address to be added to said list on the PPPoE server when they authenticate.<\/p>\n<p><strong>Usermanager router<\/strong><br \/>\nFirst things first, we add the PPPoE server to the router list in user manager.<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/tool user-manager router\r\nadd coa-port=1700 customer=admin disabled=no ip-address=192.168.0.1 log=\\\r\n    auth-fail name=test-pppoe shared-secret=test<\/code><\/pre>\n<p><strong>Usermanager profile limit<\/strong><br \/>\nThe limit allows you to specify different additional options.  We are adding a limit that dynamically adds a user&#8217;s IP address to an address-list upon authentication.  In the below example the limit is named 1 and the address-list is named 1.<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/tool user-manager profile limitation\r\nadd address-list=1 download-limit=0B group-name=&quot;&quot; ip-pool=&quot;&quot; name=1 \\\r\n    transfer-limit=0B upload-limit=0B uptime-limit=0s<\/code><\/pre>\n<p><strong>Usermanager profile<\/strong><br \/>\nWe now create a profile for customers to use.  We then associate the above limit with this profile.<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/tool user-manager profile\r\nadd name=1 name-for-users=&quot;&quot; override-shared-users=off price=0 starts-at=\\\r\n    logon validity=0s\r\n\/tool user-manager profile profile-limitation\r\nadd from-time=0s limitation=1 profile=1 till-time=23h59m59s weekdays=\\\r\n    sunday,monday,tuesday,friday,saturday<\/code><\/pre>\n<p><strong>Usermanager user<\/strong><br \/>\nNow create a user that will reference the created profile.<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/tool user-manager user\r\nadd customer=admin disabled=no name=1 password=test shared-users=1 \\\r\n    wireless-enc-algo=none wireless-enc-key=&quot;&quot; wireless-psk=&quot;&quot;<\/code><\/pre>\n<h2>Router config<\/h2>\n<p><strong>IP address<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/ip address\r\nadd address=192.168.0.1\/24 interface=ether5<\/code><\/pre>\n<p><strong>IP pool for pppoe server<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/ip pool\r\nadd name=pool1 ranges=192.168.0.10-192.168.0.200<\/code><\/pre>\n<p><strong>Setup ppp profile<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/ppp profile\r\nset 1 dns-server=8.8.8.8 local-address=192.168.0.1 remote-address=pool1<\/code><\/pre>\n<p><strong>Configure pppoe server<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/interface pppoe-server server\r\nadd authentication=pap,chap default-profile=default-encryption disabled=no \\\r\n    interface=ether5 service-name=service1<\/code><\/pre>\n<p><strong>Set pppoe to use radius<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/ppp aaa\r\nset use-radius=yes<\/code><\/pre>\n<p><strong>Setup radius profile and enable incoming radius.<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/radius\r\nadd address=192.168.0.1 secret=test service=ppp\r\n\/radius incoming\r\nset accept=yes<\/code><\/pre>\n<p><strong>Setup mangle rules to mark connections based on address-lists from usermanager.  Then packet mark based on connection marks.<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/ip firewall mangle\r\nadd action=mark-connection chain=prerouting new-connection-mark=1 \\\r\n    src-address-list=1\r\nadd action=mark-packet chain=prerouting connection-mark=1 in-interface=ether5 \\\r\n    new-packet-mark=1-download passthrough=no\r\nadd action=mark-packet chain=prerouting connection-mark=1 new-packet-mark=\\\r\n    1-upload passthrough=no<\/code><\/pre>\n<p><strong>Create in and out PCQs<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/queue type\r\nadd kind=pcq name=1-down-pcq pcq-classifier=dst-address \\\r\n    pcq-dst-address6-mask=64 pcq-src-address6-mask=64\r\nadd kind=pcq name=1-up-pcq pcq-classifier=src-address pcq-dst-address6-mask=\\\r\n    64 pcq-src-address6-mask=64<\/code><\/pre>\n<p><strong>Add the queues to the queue-tree structure<\/strong><\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">\/queue tree\r\nadd name=1-download packet-mark=1-download parent=global-in\r\nadd name=1-upload packet-mark=1-upload parent=global-in<\/code><\/pre>\n<p>As you can see, this isn&#8217;t a 100% complete config, but it does give you a good starting place.  I just can&#8217;t seem to come up with enough time to do anything these days \ud83d\ude41<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I came up with a method about 2 years ago to use PCQs with PPPoE instead of the traditional simple queue(SQ) method. As you\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,8],"tags":[],"class_list":["post-3700","post","type-post","status-publish","format-standard","hentry","category-mikrotik","category-networking"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3700"}],"version-history":[{"count":19,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3700\/revisions"}],"predecessor-version":[{"id":3721,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3700\/revisions\/3721"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}