
Here's a MikroTik script that configures load balancing, HotSpot, and PPPoE services according to your requirements:
# ======================== # BASIC CONFIGURATION # ======================== /interface list add name=WAN add name=LAN /interface ethernet set [ find default-name=ether1 ] name=wan1 set [ find default-name=ether2 ] name=wan2 set [ find default-name=ether3 ] name=lan-master set [ find default-name=ether4 ] name=lan-slave set [ find default-name=ether5 ] name=lan-slave2 /interface bridge add name=lan-bridge ports=lan-master,lan-slave,lan-slave2 /interface list member add interface=wan1 list=WAN add interface=wan2 list=WAN add interface=lan-bridge list=LAN /ip address add address=192.168.10.12/24 interface=wan1 network=192.168.10.0 add address=172.168.20.12/24 interface=wan2 network=172.168.20.0 add address=172.168.50.1/22 interface=lan-bridge network=172.168.48.0 /ip dns set servers=8.8.8.8,1.1.1.1 /ip route add distance=1 gateway=192.168.10.1 add distance=1 gateway=172.168.20.1 # ======================== # LOAD BALANCING (PCC) # ======================== /ip firewall mangle add action=mark-connection chain=prerouting connection-state=new \ in-interface=lan-bridge new-connection-mark=WAN1_conn per-connection-classifier=both-addresses:2/0 add action=mark-connection chain=prerouting connection-state=new \ in-interface=lan-bridge new-connection-mark=WAN2_conn per-connection-classifier=both-addresses:2/1 add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1 add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2 add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-interface=lan-bridge new-routing-mark=to_WAN1 add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-interface=lan-bridge new-routing-mark=to_WAN2 /ip route add distance=1 gateway=192.168.10.1 routing-mark=to_WAN1 add distance=1 gateway=172.168.20.1 routing-mark=to_WAN2 add distance=1 gateway=192.168.10.1 add distance=1 gateway=172.168.20.1 /ip firewall nat add action=masquerade chain=srcnat out-interface=wan1 add action=masquerade chain=srcnat out-interface=wan2 # ======================== # HOTSPOT CONFIGURATION # ======================== /ip pool add name=hotspot-pool ranges=172.168.50.100-172.168.50.200 /ip hotspot profile set [ find default=yes ] dns-name=hotspot.local add name=hs-profile dns-name=hotspot.local /ip hotspot add address-pool=hotspot-pool disabled=no interface=lan-bridge name=hs1 \ profile=hs-profile /ip hotspot user add name=user1 password=12345678 # ======================== # PPPoE SERVER CONFIGURATION # ======================== /interface pppoe-server server add authentication=pap,chap,mschap1,mschap2 default-profile=pppoe-profile \ disabled=no interface=lan-bridge service-name=PPPoE-Server /ip pool add name=pppoe-pool ranges=172.168.51.100-172.168.51.200 /ppp profile add name=pppoe-profile local-address=172.168.50.1 remote-address=pppoe-pool /ppp secret add name=pppoe-user password=securepassword profile=pppoe-profile service=pppoe # ======================== # FIREWALL RULES # ======================== /ip firewall filter add action=accept chain=input comment="Allow Established" connection-state=established,related add action=drop chain=input comment="Block Invalid" connection-state=invalid add action=accept chain=input comment="Allow ICMP" protocol=icmp add action=accept chain=input comment="Allow LAN" in-interface=lan-bridge add action=drop chain=input comment="Block WAN" in-interface-list=WAN # ======================== # FINAL SYSTEM CONFIG # ======================== /system identity set name=NikhilTech /system clock set time-zone-name=Asia/Kolkata /user set admin password=strongpassword
Important Notes:
Interface Configuration:
Assumes 5 ethernet ports (adjust if different)
wan1
andwan2
for WAN connectionsBridge
lan-bridge
combines multiple ports for LAN
Load Balancing:
Uses PCC (Per Connection Classifier)
Balances based on source+destination addresses
Separate routes and NAT for each WAN
HotSpot:
Enabled on LAN bridge
IP pool: 172.168.50.100-200
Test user: user1/12345678
Accessible via
hotspot.local
PPPoE Server:
Service name: "PPPoE-Server"
IP pool: 172.168.51.100-200
Test user: pppoe-user/securepassword
Uses PAP/CHAP/MSCHAP authentication
Security:
Basic firewall rules included
WAN interfaces blocked for incoming connections
Change default passwords (admin, PPPoE, HotSpot)
Before Implementation:
Verify physical interface names
Replace gateway addresses (192.168.10.1 & 172.168.20.1) with actual ISP gateways
Change all default passwords
Adjust IP pools according to your needs
Test during maintenance window
To implement:
Paste in Winbox/Terminal
Reboot router
Test connectivity:
ping 8.8.8.8 ping google.com
Test HotSpot authentication
Test PPPoE connection from client
For PPPoE client connection use:
Username: pppoe-user
Password: securepassword
Service: PPPoE-Server