Hi all.
I have a Hex S with a Wireguard interface that works as a “client”, so that I can selectively send traffic out through the tunnel whenever I want. This interface is called “VPN-Remote” in my export.
The Wireguard config itself seems to be OK, as I am also using a simple IP route that sends all the traffic with destination 192.168.1.0/24 over the Wireguard tunnel, and that part works well.
What I want to do as well, however, is use some mangle rules to select traffic that meets specific conditions (source devices, destination IPs, etc.) and send it through the tunnel. And here’s where the problems come.
I’ve reduced the mangle rules to be as simple as possible for this export: just pick the traffic coming from my phone (by MAC address) and mark it so that it’s routed through the tunnel. But it’s not working.
I’ve looked at the counters in the mangle rules and they do seem to detect traffic that meets the criteria… however, the traffic still goes out through my normal internet connection instead of the tunnel.
Could you please take a look at my config and let me know if you see anything that looks off to you? Thanks in advance!
# 2025-02-20 16:59:57 by RouterOS 7.17.2
# software id = 9A99-M04C
#
# model = RB760iGS
# serial number = [redacted]
/interface bridge
add admin-mac=[redacted] auto-mac=no comment=defconf name=bridge
/interface wireguard
add listen-port=19850 mtu=1420 name=VPN-Local
add listen-port=51821 mtu=1420 name=VPN-Remote
/interface vlan
add interface=sfp1 name=Internet vlan-id=63
/interface pppoe-client
add add-default-route=yes disabled=no interface=Internet name=PPPoE user=\
[redacted]
/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=default-dhcp ranges=192.168.10.1-192.168.10.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
/routing rip instance
add afi=ipv4 disabled=no name=rip
/routing table
add comment="Routing table for VPN-Remote" disabled=no fib name=\
VPN-Remote-table
/disk settings
set auto-media-interface=bridge auto-media-sharing=yes auto-smb-sharing=yes
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge interface=ether1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add interface=PPPoE list=WAN
add interface=sfp1 list=WAN
add interface=VPN-Local list=LAN
add interface=*D list=LAN
/interface ovpn-server server
add mac-address=[redacted] name=ovpn-server1
/interface wireguard peers
add allowed-address=10.251.53.2/32 client-address=10.251.53.2/32 \
endpoint-address=[local_public_IP] endpoint-port=51820 interface=\
VPN-Local name="Pixel 9 Pro" public-key=\
[redacted] responder=yes
add allowed-address=10.251.53.3/32 client-address=10.251.53.3/32 \
endpoint-address=[local_public_IP] endpoint-port=51820 interface=\
VPN-Local name="MacBook Pro" public-key=\
[redacted] responder=yes
add allowed-address=0.0.0.0/0 endpoint-address=[remote_public_IP] \
endpoint-port=51820 interface=VPN-Remote name="MikroTik Hex S" \
preshared-key=[redacted] public-key=\
[redacted]
/ip address
add address=192.168.10.1/24 comment=defconf interface=bridge network=\
192.168.10.0
add address=192.168.2.100 interface=sfp1 network=192.168.2.1
add address=10.251.53.1/24 interface=VPN-Local network=10.251.53.0
add address=10.184.203.4/24 interface=*D network=10.184.203.0
add address=10.184.203.4 interface=VPN-Remote network=10.184.203.4
/ip cloud
set ddns-enabled=yes
/ip dhcp-client
# DHCP client can not run on slave or passthrough interface!
add comment=defconf interface=ether1
/ip dhcp-server network
add address=192.168.10.0/24 comment=defconf dns-server=192.168.10.1 gateway=\
192.168.10.1
/ip dns
set allow-remote-requests=yes servers=1.1.1.1,1.0.0.1
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan type=A
/ip firewall address-list
[redacted_domain_list_here-not_used_now]
/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=accept chain=input comment="Allow Wireguard traffic to VPN-Local" \
dst-port=19850 protocol=udp
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-mark=!remote-vpn-traffic-mark connection-state=\
established,related hw-offload=yes
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
/ip firewall mangle
add action=change-mss chain=forward new-mss=clamp-to-pmtu out-interface=\
VPN-Local protocol=tcp tcp-flags=syn
add action=change-mss chain=forward new-mss=clamp-to-pmtu out-interface=\
VPN-Remote protocol=tcp tcp-flags=syn
add action=mark-connection chain=prerouting connection-state=new \
new-connection-mark=remote-vpn-traffic-mark src-mac-address=\
[mac_address_of_target_device]
add action=mark-routing chain=prerouting connection-mark=\
remote-vpn-traffic-mark dst-address-type=!local in-interface-list=LAN \
new-routing-mark=VPN-Remote-table passthrough=no
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat out-interface=VPN-Remote
/ip proxy
set enabled=yes
/ip route
add dst-address=192.168.1.0/24 gateway=VPN-Remote routing-table=\
VPN-Remote-table
/ip upnp
set enabled=yes
/ip upnp interfaces
add interface=PPPoE type=external
add interface=bridge type=internal
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 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 ICMPv6" protocol=\
icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" \
dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
"defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=input comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
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 packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
"defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=forward comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
/routing rule
add action=lookup disabled=no dst-address=192.168.1.0/24 table=\
VPN-Remote-table
/system clock
set time-zone-name=Europe/Madrid
/system note
set show-at-login=no
/system routerboard settings
set silent-boot=yes
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN