Hi,
I.m trying to setup PBR to route certain subnets stored in a "address-list" through a wireguard tunnel. Wireguard works fine, static routes work fine, however, I am not able to figure out why "routing-mark" doesn't work. Here are the relevant parts of my setup:
# software id = Y6VN-URPQ
# model = RB750Gr3
...
/interface wireguard
add listen-port=52311 mtu=1420 name=wg1 private-key="*******************"
/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=mysecretgw.com \
endpoint-port=52311 interface=wg1 preshared-key="************=" public-key="**********"
...
/ip address add address=10.6.1.2/24 comment=mysecretgw.com interface=wg1 network=10.6.1.0
...
/routing table
add fib name=VIA_WG1
...
/ip firewall address-list
add address=5.2.128.0/19 list=DIGI-NETWORK
add address=5.2.160.0/21 list=DIGI-NETWORK
add address=5.2.174.0/24 list=DIGI-NETWORK
add address=5.2.178.0/23 list=DIGI-NETWORK
...
/ip route add comment=VIA_WG1 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
10.6.1.1 pref-src="" routing-table=VIA_WG1 scope=30 suppress-hw-offload=\
no target-scope=10
...
/routing rule add action=lookup disabled=no routing-mark=VIA_WG1 table=VIA_WG1
...
/interface list member
add interface=ether2 list=LAN
add interface=ether1 list=WAN
add interface=ether3 list=LAN
add interface=ether4 list=LAN
add interface=ether5 list=WAN
add interface=vlan1 list=WAN
add interface=wg1 list=LAN
...
/ip firewall filter
add action=accept chain=output
add action=accept chain=input comment=\
"Accept all input:established, input:related" connection-state=established,related
add action=accept chain=input comment="Ping from WAN" in-interface-list=WAN protocol=icmp
add action=accept chain=input comment="Wireguard Service" dst-port=52311 in-interface-list=WAN protocol=udp
add action=accept chain=input comment="DHCP Service" dst-port=67 in-interface-list=!WAN protocol=udp src-address-list=PRIVATE_NETWORKS
add action=accept chain=input comment="DNS Service" dst-port=53 in-interface-list=!WAN protocol=udp src-address-list=PRIVATE_NETWORKS
add action=accept chain=input comment="Ping from LAN" in-interface-list=LAN protocol=icmp src-address-list=PRIVATE_NETWORKS
add action=accept chain=input comment="Mikrotik Winbox Access" dst-port=8291 in-interface-list=!WAN protocol=tcp src-address-list=PRIVATE_NETWORKS
add action=accept chain=input comment="SSH Service" dst-port=22 in-interface-list=!WAN protocol=tcp src-address-list=PRIVATE_NETWORKS
add action=accept chain=input comment="NTP Service" dst-port=123 in-interface-list=!WAN protocol=udp src-address-list=PRIVATE_NETWORKS
add action=drop chain=input
add action=fasttrack-connection chain=forward comment=FastTrack connection-state=established,related disabled=yes hw-offload=yes
add action=accept chain=forward comment="forward:established, forward:related" connection-state=established,related
add action=drop chain=forward comment="Drop invalid" connection-state=invalid log=yes log-prefix=invalid
add action=drop chain=forward comment="Drop incoming packets that are not NAT`ted" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN log=yes log-prefix=!NAT
add action=jump chain=forward comment="Jump to ICMP filters" jump-target=icmp protocol=icmp
add action=drop chain=forward comment="Drop private subnets incoming from internet" in-interface-list=WAN log=yes log-prefix=!public src-address-list=PRIVATE_NETWORKS
add action=accept chain=icmp comment="echo reply" icmp-options=0:0 protocol=icmp
add action=accept chain=icmp comment="net unreachable" icmp-options=3:0 protocol=icmp
add action=accept chain=icmp comment="host unreachable" icmp-options=3:1 protocol=icmp
add action=accept chain=icmp comment="host unreachable fragmentation required" icmp-options=3:4 protocol=icmp
add action=accept chain=icmp comment="allow echo request" icmp-options=8:0 protocol=icmp
add action=accept chain=icmp comment="allow time exceed" icmp-options=11:0 protocol=icmp
add action=accept chain=icmp comment="allow parameter bad" icmp-options=12:0 protocol=icmp
add action=drop chain=icmp comment="deny all other types"
/ip firewall mangle
add action=mark-packet chain=prerouting dst-address-list=DIGI-NETWORK log=\
yes new-packet-mark=VIA_WG1 passthrough=yes
add action=mark-connection chain=prerouting log=yes new-connection-mark=\
conn_WG1 packet-mark=VIA_WG1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=conn_WG1 log=yes \
new-routing-mark=VIA_WG1 passthrough=no
...
I would expect when pinging an IP that's part of a "DIGI-NETWORK" to get logged, but the PBR does not work and nothing shows up in the logs. Any ideas? what am I doing wrong ?