Good morning everyone.
I have a routerboard with a configuration like this: two internet connections via pppoe, one in fiber optic and one in FWA Wireless. The fiber optic has distance 1, while the FWA line has distance 2 so that if the fiber optics fails, the system will use the FWA line to navigate. A VoIP ATA is connected to the routerboard (with IP: 10.100.3.20) and a third Firewall (with IP: 192.168.3.2).
Here is the complete configuration:
/interface bridge
add frame-types=admit-only-vlan-tagged name=bridge1 pvid=100 vlan-filtering=yes
/interface ethernet
set [ find default-name=ether2 ] comment=Firewall
set [ find default-name=ether4 ] comment=VoIP
set [ find default-name=ether5 ] comment=Management
set [ find default-name=ether7 ] comment=Fiber Pppoe Port
set [ find default-name=ether8 ] comment=FWA Pppoe Port
/interface pppoe-client
add add-default-route=yes comment="Fiber" disabled=no interface=\
ether7 name=pppoe-out1 use-peer-dns=yes user=********
add add-default-route=yes comment="FWA" default-route-distance=2 \
disabled=no interface=ether8 name=pppoe-out2 user=********
/interface wireguard
add listen-port=18731 mtu=1420 name=wireguard1
/interface vlan
add comment=Management interface=bridge1 name=vlan100 vlan-id=100
add comment="To Firewall" interface=bridge1 name=vlan200 vlan-id=200
add comment=VoIP interface=bridge1 name=vlan700 vlan-id=700
/interface list
add name=WAN
add name=LAN
add name=MANAGEMENT
/ip dhcp-server
add interface=vlan700 name=server700
/ip pool
add name=dhcp_pool0 ranges=10.100.100.100-10.100.100.200
/ip dhcp-server
add address-pool=dhcp_pool0 interface=vlan100 name=dhcp1
/port
set 0 name=serial0
/routing table
add disabled=no fib name=secondaria
/interface bridge port
add bridge=bridge1 interface=ether1
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether2 pvid=200
add bridge=bridge1 interface=ether3
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether4 pvid=700
add bridge=bridge1 frame-types=admit-only-untagged-and-priority-tagged \
interface=ether5 pvid=100
/ip neighbor discovery-settings
set discover-interface-list=MANAGEMENT
/interface bridge vlan
add bridge=bridge1 tagged=bridge1 vlan-ids=100
/interface list member
add interface=pppoe-out1 list=WAN
add interface=pppoe-out2 list=WAN
add interface=vlan100 list=LAN
add interface=vlan200 list=LAN
add interface=vlan700 list=LAN
add interface=vlan100 list=MANAGEMENT
/interface wireguard peers
add allowed-address=10.100.90.2/32 interface=wireguard1 name=Simone public-key=\
"********************"
/ip address
add address=10.100.100.1/24 interface=vlan100 network=10.100.100.0
add address=10.100.3.1/24 interface=vlan700 network=10.100.3.0
add address=192.168.3.1/24 interface=vlan200 network=192.168.3.0
add address=10.100.90.1/24 interface=wireguard1 network=10.100.90.0
/ip dhcp-server lease
add address=10.100.3.20 comment="VoIP ATA" mac-address=***********
/ip dhcp-server network
add address=10.100.3.0/24 dns-server=10.100.3.1 gateway=10.100.3.1
add address=10.100.100.0/24 dns-server=10.100.100.1 gateway=10.100.100.1
/ip dns
set allow-remote-requests=yes cache-max-ttl=1d servers=8.8.8.8,8.8.4.4
/ip firewall address-list
add address=************** list="Simone IP"
add address=************** list="Simone IP"
add address=************** list=VoipVoice
/ip firewall filter
add action=accept chain=input comment="Accept Established, Related, Untracked" \
connection-state=established,related
add action=accept chain=input comment="Accept ICMP from Simone IP" \
protocol=icmp src-address-list="Simone IP"
add action=accept chain=input comment="Accept WinBox from Simone IP" \
dst-port=8291 protocol=tcp src-address-list="Simone IP"
add action=accept chain=input comment="Accept www-ssl" dst-port=**** protocol=\
tcp
add action=accept chain=input comment="Accept DNS requests from LAN" dst-port=\
53 in-interface-list=LAN protocol=tcp
add action=accept chain=input dst-port=53 in-interface-list=LAN protocol=udp
add action=accept chain=input comment="Accept Wireguard" dst-port=***** \
protocol=udp
add action=accept chain=input comment="Accept from Simone Wireguard IP" \
in-interface=wireguard1 src-address=10.100.90.2
add action=drop chain=input
add action=fasttrack-connection chain=forward hw-offload=yes
/ip firewall mangle
add action=mark-connection chain=input comment=\
"Marca tutte le connessioni in ingresso dall'interfaccia WAN2" \
in-interface=pppoe-out2 new-connection-mark=route-secondaria-conn
add action=mark-routing chain=output comment="Sposta il routing in output sulla \
tabella di route secondaria di tutti i pacchetti in ingresso dalla WAN2" \
connection-mark=route-secondaria-conn new-routing-mark=secondaria \
passthrough=no
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
add action=accept chain=dstnat comment="Accept ICMP from Simone IP" \
in-interface-list=WAN protocol=icmp src-address-list="Simone IP"
add action=accept chain=dstnat comment="Accept WinBox from Simone IP" \
dst-port=8291 protocol=tcp src-address-list="Simone IP"
add action=accept chain=dstnat comment="Accept www-ssl" dst-port=***** \
in-interface-list=WAN protocol=tcp
add action=accept chain=dstnat comment="Accept Wireguard" dst-port=***** \
in-interface-list=WAN protocol=udp
add action=dst-nat chain=dstnat comment="Accept VoipVoip SIP " dst-port=5060 \
in-interface-list=WAN protocol=tcp src-address-list=VoipVoice to-addresses=\
10.100.3.20
add action=dst-nat chain=dstnat dst-port=5060 in-interface-list=WAN protocol=\
udp src-address-list=VoipVoice to-addresses=10.100.3.20
add action=accept chain=dstnat comment="Accept DNS Requests" dst-port=53 \
in-interface-list=LAN protocol=tcp
add action=accept chain=dstnat dst-port=53 in-interface-list=LAN protocol=udp
add action=dst-nat chain=dstnat comment="DMZ to Firewall" in-interface-list=WAN \
to-addresses=192.168.3.2
/ip firewall service-port
set sip disabled=yes
/ip ipsec profile
set [ find default=yes ] dpd-interval=2m dpd-maximum-failures=5
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out2 \
routing-table=secondaria suppress-hw-offload=no
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set www-ssl certificate="cert1 www-ssl" disabled=no port=******
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-name=Europe/Rome
/system identity
set name=******************
/system note
set show-at-login=no
/system routerboard settings
set enter-setup-on=delete-key
/tool mac-server
set allowed-interface-list=MANAGEMENT
/tool mac-server mac-winbox
set allowed-interface-list=MANAGEMENT
Everything works perfectly. I had to create this new routing table:
/routing table
add disabled=no fib name=secondaria
These two mangle rules:
/ip firewall mangle
add action=mark-connection chain=input comment=\
"Marca tutte le connessioni in ingresso dall'interfaccia WAN2" \
in-interface=pppoe-out2 new-connection-mark=route-secondaria-conn
add action=mark-routing chain=output comment="Sposta il routing in output sulla \
tabella di route secondaria di tutti i pacchetti in ingresso dalla WAN2" \
connection-mark=route-secondaria-conn new-routing-mark=secondaria \
passthrough=no
And this static routing rule:
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out2 \
routing-table=secondaria suppress-hw-offload=no
Since I wanted to reach the routerboard also from the secondary WAN regardless of whether the primary WAN was Up or not.
Now the router responds correctly even on the secondary WAN, with the exception of Wireguard.
Wireguard seems to always follow the main routing table, I don’t understand why.
Furthermore, I would like to make the firewall reachable from the secondary WAN, regardless of whether the primary WAN was Up or not. In this case I tried to use mark connection rules in prerouting and mark routing, always in prerouting, but it doesn’t seem to work.
Does anyone have any advice to give me?
Thank you very much
