Hello! My name is Guillermo. This is my first attempt at configuring a setup more complex than what the basic setup wizard offers. Due to poor internet quality in my area, I’ve opted for two PPPoE connections through air antennas to ensure better connectivity. I aim to implement package-based load balancing and have crafted a script by combining my current SSH configuration with advice from chatbots and tutorials. My background in programming, though not directly related to networking, has made me more comfortable using code for this task.
Additionally, I have two Ubiquiti APs in my setup. The first AP is connected to the ether3 interface of the MikroTik router, and the second AP is configured to extend the Wi-Fi network, effectively acting as a repeater.
I would really appreciate if you can review this code and see if i’m doing something wrong:
/interface bridge
add admin-mac=mac auto-mac=no comment=defconf name=bridge
/interface pppoe-client
add add-default-route=no disabled=no interface=ether1 name=pppoe-out1 password=password1 use-peer-dns=yes user=user1
add add-default-route=no disabled=no interface=ether2 name=pppoe-out2 password=password2 use-peer-dns=yes user=user2
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=dhcp disabled=no interface=bridge name=defconf
/interface bridge port
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add interface=pppoe-out1 list=WAN
add comment=defconf interface=ether2 list=WAN
add interface=pppoe-out2 list=WAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge #network=192.168.88.0
/ip dhcp-server lease
add address=192.168.88.18 client-id=mac mac-address=mac server=defconf
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1 # dns-server=8.8.8.8,8.8.4.4
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
# add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
# Mark packets for load balancing
/ip firewall mangle
add action=mark-packet chain=prerouting new-packet-mark=packets_to_wan1 passthrough=yes src-address=192.168.88.0/24 connection-state=new nth=2,1,0
add action=mark-packet chain=prerouting new-packet-mark=packets_to_wan2 passthrough=yes src-address=192.168.88.0/24 connection-state=new nth=2,1,1
# Routing marked packets through specific WAN interfaces
/ip route
add distance=1 gateway=pppoe-out1 packet-mark=packets_to_wan1
add distance=1 gateway=pppoe-out2 packet-mark=packets_to_wan2
# Ensure masquerade rules are present for both WAN interfaces
/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe-out1
add action=masquerade chain=srcnat out-interface=pppoe-out2
# Misc
/system clock
set time-zone-name=time-zone-name
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
Thanks!