Hi all!
Short and to the point, I have a gigabit fiber connection that drops occasionally. I setup a 5G Cell WAN using TMobile Home Internet for load balancing and to act as failover when Fiber goes out. Fiber has a static public IPV4 delivered to the MikroTik router (PUBLIC_IP in config below). 5G gateway can’t bridge and isn’t customizable, so MikroTik gets a DHCP address from the 5G Gateway in the 192.168.12.0/24 range, and gateway is 192.168.12.1. I’ve static configured the gateway in RouterOS, then use DHCP Client for IP.
ECMP load balancing works perfect. I’ve pushed around 1.6 gigabit total through the gigabit fiber and 5G combined. My issue is with port forwards and Wireguard VPN. The port forwards work occasionally, despite the mangle rules to mark the connections. Seemingly ignoring the mangle mark-routing rules and picking a load balanced gateway. I have seen in packet sniffer traffic coming in ether1-WAN(Fiber), dst-nat to server, server reply back out, then we send reply out ether2-CellWAN. I also am totally unable to connect to the Wireguard server on the Router, sending handshake initiations, but not finishing handshake. Mobile device doesn’t appear to receive anything at all. Disabling ECMP, port forwards and Wireguard work perfect.
I am fairly new to RouterOS, so still learning as I go. I’ve followed countless guides and tutorials, tried building rules 100 different ways and have never succeeded. Hoping you smart people can help! Thanks!
Configuration (Removed static LAN DHCP Leases as it was a giant block and Wireguard Peers):
[admin@MikroTik] > /export hide-sensitive
# dec/11/2022 11:16:57 by RouterOS 7.7beta9
# model = CCR2004-16G-2S+
/interface bridge
add name=dockers
/interface ethernet
set [ find default-name=ether1 ] advertise=\
10M-half,10M-full,100M-half,100M-full,1000M-full mac-address=\
2A:99:D3:A5:1D:06 name=ether1-WAN
set [ find default-name=ether2 ] advertise=\
10M-half,10M-full,100M-half,100M-full,1000M-full name=ether2-CellWAN
set [ find default-name=sfp-sfpplus2 ] name=sfp2-LAN
/interface veth
add address=172.17.0.2/24 gateway=172.17.0.1 name=veth1-PiHole
/interface wireguard
add listen-port=51820 mtu=1420 name=wg1-Trusted
add listen-port=51825 mtu=1420 name=wg2-Untrusted
/interface vlan
add interface=sfp2-LAN name=vlan10-CAMS vlan-id=10
add interface=sfp2-LAN name=vlan20-ISO vlan-id=20
add interface=sfp2-LAN name=vlan30-NoInt vlan-id=30
/container mounts
add dst=/etc/pihole name=etc_pihole src=/disk1/pihole-mnt/etc
add dst=/etc/dnsmasq.d name=dnsmasq_pihole src=/disk1/pihole-mnt/etc-dnsmasq.d
/disk
set pcie1-usb1-part1 parent=pcie1-usb1 partition-offset=512 partition-size=\
"32 080 199 680"
/interface list
add name=WAN
add name=LAN
add name=VLANS
add name=WG1
add name=VLAN20andUWG
add name=Untrusted
add name=Trusted
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip ipsec policy group
add name=MobileClients
/ip ipsec profile
add enc-algorithm=aes-128 name=MobileClients
/ip ipsec peer
add exchange-mode=ike2 name=MobileDevices passive=yes profile=MobileClients
/ip ipsec proposal
add name=MobileClient
/ip pool
add name=LAN ranges=10.0.0.100-10.0.0.200
add name=CAMS ranges=10.0.10.100-10.0.10.200
add name=ISO ranges=10.0.20.100-10.0.20.200
add name=NOINT ranges=192.168.146.100-192.168.146.200
/ip dhcp-server
add address-pool=LAN interface=sfp2-LAN name=dhcp1
add address-pool=CAMS interface=vlan10-CAMS name=dhcp2
add address-pool=ISO interface=vlan20-ISO name=dhcp3
add address-pool=NOINT interface=vlan30-NoInt name=dhcp4
/port
set 0 name=serial0
set 1 name=serial1
/routing table
add disabled=no fib name=Fiber_WAN
add disabled=no fib name=Cell_WAN
/container
add envlist=pihole_envs interface=veth1-PiHole mounts=etc_pihole,dnsmasq_pihole \
root-dir=disk1/pihole
/container config
set registry-url=https://registry-1.docker.io tmpdir=disk1/pull
/container envs
add key=TZ name=pihole_envs value=America/Chicago
add key=WEBPASSWORD name=pihole_envs value=PASSWORDREMOVED
/interface bridge port
add bridge=dockers interface=veth1-PiHole
/ip settings
set max-neighbor-entries=8192
/ipv6 settings
set max-neighbor-entries=8192
/interface list member
add interface=ether1-WAN list=WAN
add interface=sfp2-LAN list=LAN
add interface=vlan10-CAMS list=VLANS
add interface=vlan20-ISO list=VLANS
add interface=wg1-Trusted list=WG1
add interface=vlan20-ISO list=VLAN20andUWG
add interface=wg2-Untrusted list=VLAN20andUWG
add interface=vlan10-CAMS list=Untrusted
add interface=vlan20-ISO list=Untrusted
add interface=vlan30-NoInt list=Untrusted
add interface=wg2-Untrusted list=Untrusted
add interface=sfp2-LAN list=Trusted
add interface=wg1-Trusted list=Trusted
add interface=vlan30-NoInt list=VLANS
add interface=vlan10-CAMS list=LAN
add interface=vlan30-NoInt list=LAN
add interface=dockers list=LAN
add interface=vlan20-ISO list=LAN
add interface=wg1-Trusted list=LAN
add interface=wg2-Untrusted list=LAN
add interface=ether2-CellWAN list=WAN
/interface ovpn-server server
set auth=sha1,md5
/ip address
add address=PUBLIC_IP/21 interface=ether1-WAN network=WAN_NETWORK
add address=10.0.0.1/24 interface=sfp2-LAN network=10.0.0.0
add address=10.0.10.1/24 interface=vlan10-CAMS network=10.0.10.0
add address=10.0.20.1/24 interface=vlan20-ISO network=10.0.20.0
add address=172.30.0.1/24 interface=wg1-Trusted network=172.30.0.0
add address=172.31.0.1/24 interface=wg2-Untrusted network=172.31.0.0
add address=192.168.146.1/24 interface=vlan30-NoInt network=192.168.146.0
add address=172.17.0.1/24 interface=dockers network=172.17.0.0
/ip dhcp-client
add add-default-route=no interface=ether2-CellWAN use-peer-dns=no use-peer-ntp=\
no
/ip dhcp-server network
add address=10.0.0.0/24 dns-server=10.0.0.254,172.17.0.2 domain=dill gateway=\
10.0.0.1 netmask=24
add address=10.0.10.0/24 dns-server=1.1.1.1,1.0.0.1 gateway=10.0.10.1
add address=10.0.20.0/24 dns-server=1.1.1.1,1.0.0.1 domain=dilliso gateway=\
10.0.20.1
add address=192.168.146.0/24 dns-server=192.168.146.1 gateway=192.168.146.1
/ip dns
set allow-remote-requests=yes servers=1.1.1.1,1.0.0.1
/ip firewall address-list
add address=10.0.0.254 list=LocalDNS
add address=172.17.0.2 list=LocalDNS
add address=10.0.0.251 list=RemoteADInternal
add address=10.0.20.80 list=RemoteADInternal
add address=172.31.0.10 list=RDPFriends
add address=172.31.0.20 list=RDPFriends
add address=172.31.0.30 list=RDPFriends
add address=172.31.0.40 list=RDPFriends
add address=172.31.0.41 list=RDPFriends
add address=172.31.0.150 list=RDPFriends
add address=10.0.20.5 list=RDPFriends-Devices
add address=10.0.20.6 list=RDPFriends-Devices
add address=10.0.0.0/8 list=RFC1918
add address=172.16.0.0/12 list=RFC1918
add address=192.168.0.0/16 list=RFC1918
add address=0.0.0.0/8 list=RFC6890
add address=172.16.0.0/12 list=RFC6890
add address=192.168.0.0/16 list=RFC6890
add address=10.0.0.0/8 list=RFC6890
add address=169.254.0.0/16 list=RFC6890
add address=127.0.0.0/8 list=RFC6890
add address=224.0.0.0/4 list=RFC6890
add address=198.18.0.0/15 list=RFC6890
add address=192.0.0.0/24 list=RFC6890
add address=192.0.2.0/24 list=RFC6890
add address=198.51.100.0/24 list=RFC6890
add address=203.0.113.0/24 list=RFC6890
add address=100.64.0.0/10 list=RFC6890
add address=240.0.0.0/4 list=RFC6890
add address=192.88.99.0/24 list=RFC6890
/ip firewall filter
add action=accept chain=forward connection-state=established,related
add action=accept chain=input connection-state=established,related
add action=drop chain=input comment="Drop Invalid Connections" \
connection-state=invalid
add action=accept chain=forward comment="Accept DST-NAT Packets" \
connection-nat-state=dstnat
add action=accept chain=output comment="Allow Router Output" log-prefix=\
ALLOWOUT
add action=accept chain=input comment="Allow Connections to WireGuard1" \
dst-port=51820 protocol=udp
add action=accept chain=input comment="Allow Connections to WireGuard2" \
dst-port=51825 protocol=udp
add action=accept chain=forward comment="Allow MikroTik PiHole to WAN" \
out-interface-list=WAN src-address=172.17.0.2
add action=accept chain=forward comment="Allow Trusted to Everything" \
in-interface-list=Trusted
add action=accept chain=input in-interface-list=Trusted
add action=accept chain=forward comment="Allow AD Server to DH Network IPs" \
dst-address-list=RemoteADInternal in-interface=wg2-Untrusted src-address=\
172.31.0.200
add action=accept chain=forward comment="Allow VLAN20 and UWG to Access PiHole" \
dst-address-list=LocalDNS dst-port=53 in-interface-list=VLAN20andUWG \
protocol=udp
add action=accept chain=forward dst-address-list=LocalDNS dst-port=53 \
in-interface-list=VLAN20andUWG protocol=tcp
add action=accept chain=forward comment="Allow VLAN20 to Access Plex" \
dst-address=10.0.0.20 dst-port=32400 in-interface-list=VLAN20andUWG \
out-interface=sfp2-LAN protocol=tcp
add action=accept chain=forward comment="Allow VLAN20 to WAN" in-interface=\
vlan20-ISO out-interface-list=WAN
add action=accept chain=forward comment=\
"Allow Friends to Udoo Bolt (20.5) and LuckyVM (20.6)" dst-address-list=\
RDPFriends-Devices src-address-list=RDPFriends
add action=drop chain=forward comment="Drop Everything Else" log-prefix=DROP
add action=drop chain=input log-prefix=DROPINPUT
/ip firewall mangle
add action=accept chain=prerouting dst-address=!192.168.12.0/24 \
dst-address-list=RFC1918 src-address=!192.168.12.0/24 src-address-list=\
RFC1918
add action=mark-connection chain=prerouting connection-mark=no-mark \
in-interface=ether1-WAN new-connection-mark=Fiber_Mark passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark \
in-interface=ether2-CellWAN new-connection-mark=Cell_Mark passthrough=yes
add action=mark-routing chain=output connection-mark=Fiber_Mark \
new-routing-mark=Fiber_WAN passthrough=yes
add action=mark-routing chain=output connection-mark=Cell_Mark \
new-routing-mark=Cell_WAN passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat comment="Base WAN Masquerade" out-interface=\
ether1-WAN
add action=masquerade chain=srcnat out-interface=ether2-CellWAN
add action=dst-nat chain=dstnat comment="NAT ADMASTER LAN IP thru Wireguard" \
dst-address=10.10.0.4 to-addresses=172.31.0.200
add action=dst-nat chain=dstnat comment="Plex Server" dst-address=PUBLIC_IP \
dst-port=32400 protocol=tcp to-addresses=10.0.0.20
add action=dst-nat chain=dstnat comment="Lucky's Game Server" dst-address=\
PUBLIC_IP dst-port=25560-25575 protocol=tcp to-addresses=10.0.20.6 \
to-ports=25560-25575
add action=dst-nat chain=dstnat dst-address=PUBLIC_IP dst-port=25560-25575 \
protocol=udp to-addresses=10.0.20.6 to-ports=25560-25575
add action=dst-nat chain=dstnat dst-address=PUBLIC_IP dst-port=4379-4380 \
protocol=udp to-addresses=10.0.20.6 to-ports=4379-4380
add action=dst-nat chain=dstnat dst-address=PUBLIC_IP dst-port=3478 \
protocol=udp to-addresses=10.0.20.6 to-ports=3478
/ip firewall service-port
set ftp disabled=yes
set sip disabled=yes
/ip ipsec identity
add generate-policy=port-strict mode-config=MobileDevices peer=MobileDevices \
policy-template-group=MobileClients
/ip ipsec mode-config
add address-pool=*5 address-prefix-length=32 name=MobileDevices
/ip ipsec policy
set 0 disabled=yes
add group=MobileClients proposal=MobileClient template=yes
/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
WAN_GATEWAY pref-src="" routing-table=main scope=30 suppress-hw-offload=no \
target-scope=10
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.12.1 pref-src=\
"" routing-table=Cell_WAN scope=30 suppress-hw-offload=no target-scope=10
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=WAN_GATEWAY pref-src=\
"" routing-table=Fiber_WAN scope=30 suppress-hw-offload=no target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
192.168.12.1 pref-src="" routing-table=main scope=30 suppress-hw-offload=no \
target-scope=10
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www address=10.0.0.0/24,172.30.0.0/24
set ssh address=10.0.0.0/24 disabled=yes
set api address=10.0.0.20/32 disabled=yes
set winbox address=10.0.0.0/24,172.30.0.0/24
set api-ssl disabled=yes
/ip smb
set allow-guests=no
/ip smb shares
add directory=/disk1 name=disk1
/ip smb users
add name=john
/ip ssh
set strong-crypto=yes
/snmp
set enabled=yes
/system clock
set time-zone-name=America/Chicago
/system ntp client
set enabled=yes
/system ntp client servers
add address=0.us.pool.ntp.org
add address=1.us.pool.ntp.org
add address=2.us.pool.ntp.org
add address=3.us.pool.ntp.org
/system package update
set channel=testing
/tool bandwidth-server
set enabled=no
/tool mac-server
set allowed-interface-list=Trusted
/tool mac-server mac-winbox
set allowed-interface-list=Trusted
/tool mac-server ping
set enabled=no
/tool sniffer
set filter-ip-address=172.58.105.140/32 filter-port=32400
/user aaa
set default-group=full use-radius=yes
