Skip to content
HN On Hacker News ↗

HomeLab #1: MikroTik as a Home Router | Rafał Opiłowski

▲ 159 points 149 comments by rafal_opilowski 1mo ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is a mix of AI-generated, AI-assisted, and human-written content

77 %

AI likelihood · overall

Mixed
0% human-written 74% AI-generated
SEGMENTS · HUMAN 0 of 6
SEGMENTS · AI 4 of 6
WORD COUNT 848
PEAK AI % 87% · §1
Analyzed
Jul 19
backend: pangram/v3.3
Segments scanned
6 windows
avg 141 words each
Distribution
0 / 74%
human / AI fraction
Verdict
Mixed
Pangram v3.3

Article text · 848 words · 6 segments analyzed

Human AI-generated
§1 AI · 87%

How it all begin…

Know your ISP

IPoE or PPPoE

ProtocolWhat your ISP gives youTypical setup on MikroTikIPoEIP address, gateway, DNS via DHCP on the WANAdd DHCP client on the WAN portPPPoEUsername and password, sometimes over a VLANCreate VLAN if needed, then add PPPoE client Public or private WAN IPv4

WAN IPv4What it meansImpactPublicA routable address dedicated to your linePort forwarding, UPnP, and inbound connections work normallyPrivate (CGNAT)A shared address behind the ISP’s NATInbound connections generally don’t work unless the ISP sells a public IPv4 add-on

Setting up MikroTik router

MikroTikRouter12345678 MikroTikRouter12345678MikroTik router alone

Getting Internet

MikroTikRouter12345678ONT / ISP MikroTikRouter12345678ONT / ISPMikroTik router connected to ONT

# Check the current MAC before changing it /interface ethernet print where name=ether1 # Flags: X - disabled, R - running, S - slave # # NAME MTU MAC-ADDRESS ARP SWITCH # 0 R ether1 1500 48:A9:8A:11:22:33 enabled switch1 # Clone the ISP router's MAC (replace with the address

§2 Mixed · 70%

from its label) /interface ethernet set ether1 mac-address=AA:BB:CC:DD:EE:FF # Confirm the WAN port now advertises the cloned MAC /interface ethernet print where name=ether1 # Flags: X - disabled, R - running, S - slave # # NAME MTU MAC-ADDRESS ARP SWITCH # 0 R ether1 1500 AA:BB:CC:DD:EE:FF enabled switch1

/interface vlan add name=internet-vlan-35 vlan-id=35 interface=ether1 /interface vlan print # Flags: X - disabled, I - invalid, D - dynamic # NAME MTU ARP VLAN-ID INTERFACE # 0 internet-vlan-35 1500 enabled 35 ether1

MikroTikRouter12345678ONT / ISPVLAN 35 MikroTikRouter12345678ONT / ISPVLAN 35MikroTik router with ONT and VLAN 35

/interface pppoe-client add name=pppoe-out1 interface=internet-vlan-35 \ add-default-route=yes use-peer-dns=yes disabled=no /interface pppoe-client print # Flags: X - disabled, I - invalid, R - running, D - dynamic # NAME MTU INTERFACE USER SERVICE CALLER-ID ENCODING STATUS # 0 pppoe-out1 auto internet-vlan-35 internet linking

/interface pppoe-client set pppoe-out1 user=YOUR_ISP_USERNAME

§3 AI · 80%

password=YOUR_ISP_PASSWORD /interface pppoe-client print # Flags: X - disabled, I - invalid, R - running, D - dynamic # NAME MTU INTERFACE USER SERVICE CALLER-ID ENCODING STATUS # 0 R pppoe-out1 auto internet-vlan-35 YOUR_ISP_USERNAME internet connected

/ip route print where dst-address=0.0.0.0/0 # Flags: D - dynamic; X - disabled, R - running, S - static; + - active # DST-ADDRESS PREF-SRC GATEWAY DISTANCE # D 0.0.0.0/0 pppoe-out1 1

MikroTikRouter12345678ONT / ISPVLAN 35PPPoE MikroTikRouter12345678ONT / ISPVLAN 35PPPoEMikroTik router with ONT, VLAN 35 and PPPoE client Let’s get clean WiFi setup

# Physical step: run an Ethernet cable from router port 8 (ether8) to the wAP AP. # Then enable PoE output on port 8 so the wAP powers up: /interface ethernet poe set ether8 poe-out=auto-on /interface ethernet poe print # NAME POE-OUT VOLTAGE CURRENT # ether8 auto-on 24.0V 210mA

# --- On the router (CAPsMAN controller) --- /interface wifi security add name=home-sec \ authentication-types=wpa2-psk,wpa3-psk \ wps=disable passphrase=YOUR_WIFI_PASSWORD /interface wifi channel add name=ch-2ghz band=2ghz-n width=20mhz /interface wifi channel add name=ch-5ghz band=5ghz-ac width=20/40mhz /interface wifi datapath add name=home-dp bridge=bridge

§4 AI · 81%

disabled=no /interface wifi configuration add name=home-2g ssid=HomeNetwork \ country=YOUR_COUNTRY security=home-sec channel=ch-2ghz datapath=home-dp mode=ap /interface wifi configuration add name=home-5g ssid=HomeNetwork \ country=YOUR_COUNTRY security=home-sec channel=ch-5ghz datapath=home-dp mode=ap /interface wifi capsman set enabled=yes interfaces=bridge /interface wifi provisioning add action=create-dynamic-enabled \ master-configuration=home-2g supported-bands=2ghz-n /interface wifi provisioning add action=create-dynamic-enabled \ master-configuration=home-5g supported-bands=5ghz-ac # Verify the controller is listening /interface wifi capsman print # enabled: yes # package: wifi-qcom # interfaces: bridge # require-peer-certificate: no # upgrade-policy: none

# --- On the wAP (CAP / managed AP) --- /interface wifi cap set enabled=yes discovery-interfaces=bridge /interface wifi set wifi1 configuration.manager=capsman disabled=no /interface wifi set wifi2 configuration.manager=capsman disabled=no # Verify the wAP has joined the controller /interface wifi cap print # enabled: yes # discovery-interfaces: bridge # caps-man-addresses: # caps-man-names:

# Back on the controller, check that managed radios appeared /interface wifi print # Flags: D - dynamic # # NAME TYPE ACTUAL-CONFIGURATION # 0 D cap1@2.4GHz wifi home-2g # 1 D cap1@5GHz wifi home-5g

MikroTikRouter12345678ONT / ISPVLAN 35PPPoEWiFi APPoE MikroTikRouter12345678ONT / ISPVLAN 35PPPoEWiFi

§5 AI · 78%

APPoEMikroTik router with ONT, VLAN 35, PPPoE client and WiFi AP over PoE Fighting Bufferbloat

InternetRouterCounter-StrikeiOSupdatePhotosbackup InternetRouterCounter-StrikeiOSupdatePhotosbackupStep 1: only Counter-Strike traffic, latency stays low

InternetRouterCounter-StrikeiOSupdatePhotosbackup InternetRouterCounter-StrikeiOSupdatePhotosbackupStep 2: iOS update begins, queue fills and latency rises

InternetRouterCounter-StrikeiOSupdatePhotosbackup InternetRouterCounter-StrikeiOSupdatePhotosbackupStep 3: photo backup joins in, queue keeps growing

InternetRouterCounter-StrikeiOSupdatePhotosbackup InternetRouterCounter-StrikeiOSupdatePhotosbackupStep 4: queue full, game packets stuck behind bulk traffic

FQ-CoDel to the rescue

Queue disciplineHow it handles congestionBest forFIFO (default-small)One shared queue; first in, first outLow congestion, uniform trafficFQ-CoDelPer-flow fairness with active delay controlGaming and VoIP on shared links

/queue type add name=fq-codel kind=fq-codel /queue type print where name=fq-codel # Flags: * - default, X - disabled, I - invalid, D - dynamic # 0 name="fq-codel" kind=fq-codel fq-codel-target=5ms fq-codel-interval=100ms \ # fq-codel-ecn=yes fq-codel-flows=1024 fq-codel-quantum=1514 \

§6 Mixed · 64%

# fq-codel-limit=10240 fq-codel-memlimit=32.0MiB

/queue simple add name=shaping target=pppoe-out1 max-limit=<0.9xUPLOAD>M/<0.9xDOWNLOAD>M \ queue=fq-codel/fq-codel total-queue=fq-codel /queue simple print where name=shaping # Flags: X - disabled, I - invalid; D - dynamic # 0 name="shaping" target=pppoe-out1 dst-address=0.0.0.0/0 \ # interface=all parent=none priority=8/8 queue=fq-codel/fq-codel \ # limit-at=0/0 max-limit=<0.9xUPLOAD>M/<0.9xDOWNLOAD>M burst-limit=0/0 burst-threshold=0/0 \ # burst-time=0s/0s bucket-size=0.1/0.1 total-queue=fq-codel

# Find the fasttrack rule /ip firewall filter print where action=fasttrack-connection

# Option A: disable the rule /ip firewall filter disable [find action=fasttrack-connection]

# Option B: remove it entirely /ip firewall filter remove [find action=fasttrack-connection]

Footnotes