Hello all,
I am trying to put in place a VPN tunnel initiated by my Mikrotik router and have the traffic from one single host forced through that tunnel. To make things more complicated my LAN clients are natted twice and I am wondering if this could cause some issues.
My config is as follows:
[LAN Site A (192.168.88.0/24)]----[(192.168.88.1) Mikrotik (192.168.1.202)}----[(192.168.1.1) ISP Router (public IP A)]--- Internet ---[(public IP B) ISP Router B (192.168.1.1)]----[LAN Site B (192.168.1.0/24)]
The tunnel is established correctly:
id="<public IP B>" local-address=192.168.1.202 port=4500 remote-address=<public IP B> port=4500 state=established side=initiator uptime=14m31s last-seen=6s
ph2-total=1 spii="7c63fbe387947dea" spir="a3c132cf1a2fd729" spii="7c63fbe387947dea" spir="a3c132cf1a2fd729"
installed-sa print
Flags: H - HW-AEAD; E - ESP
Columns: SPI, STATE, SRC-ADDRESS, DST-ADDRESS, AUTH-ALGORITHM, ENC-ALGORITHM, ENC-KEY-SIZE
# SPI STATE SRC-ADDRESS DST-ADDRESS AUTH-ALGORITHM ENC-ALGORITHM ENC-KEY-SIZE
0 HE 0xE583387 mature <public IP B>:4500 192.168.1.202:4500 sha1 aes-cbc 128
1 HE 0xC0840D1F mature 192.168.1.202:4500 <public IP B>:4500 sha1 aes-cbc 128
But no traffic is going through:
[admin@MikroTik] /ip/ipsec/active-peers> print detail stats
Columns: ID, STATE, UPTIME, PH2-TOTAL, REMOTE-ADDRESS, RX-BYTES, TX-BYTES, RX-PACKETS, TX-PACKETS
# ID STATE UPTIME PH2-TOTAL REMOTE-ADDRESS RX-BYTES TX-BYTES RX-PACKETS TX-PACKETS
0 <public IP B> established 17m53s 1 <public IP B> 0 40 0 1
[admin@MikroTik] /ip/ipsec/statistics> print
in-errors: 0
in-buffer-errors: 0
in-header-errors: 0
in-no-states: 0
in-state-protocol-errors: 0
in-state-mode-errors: 0
in-state-sequence-errors: 0
in-state-expired: 0
in-state-mismatches: 0
in-state-invalid: 0
in-template-mismatches: 0
in-no-policies: 0
in-policy-blocked: 0
in-policy-errors: 0
out-errors: 0
out-bundle-errors: 0
out-bundle-check-errors: 0
out-no-states: 10812
out-state-protocol-errors: 0
out-state-mode-errors: 0
out-state-sequence-errors: 0
out-state-expired: 0
out-policy-blocked: 11056
out-policy-dead: 0
out-policy-errors: 0
I only want packets from the LAN host at the IP 192.168.88.212 to go through the tunnel, and for this I have the policy:
[admin@MikroTik] /ip/ipsec> policy/print
Flags: T - TEMPLATE; A - ACTIVE; * - DEFAULT
Columns: PEER, TUNNEL, SRC-ADDRESS, DST-ADDRESS, PROTOCOL, ACTION, LEVEL, PH2-COUNT
# PEER TUNNEL SRC-ADDRESS DST-ADDRESS PROTOCOL ACTION LEVEL PH2-COUNT
0 T * ::/0 ::/0 all
1 A IPSecTunnel yes 192.168.88.212/32 0.0.0.0/0 all encrypt require 1
I have a NAT rule that is automatically added:
[admin@MikroTik] /ip/ipsec> ../firewall/nat/print
Flags: X - disabled, I - invalid; D - dynamic
0 D ;;; ipsec mode-config
chain=srcnat action=src-nat to-addresses=192.168.1.220 src-address-list=ipsec-addr dst-address-list=!ipsec-addr
1 ;;; defconf: masquerade
chain=srcnat action=masquerade out-interface-list=WAN ipsec-policy=out,none
192.168.1.220 is the IP at the other end of the tunnel in the lan of Site B.
The address list contain only one IP:
[admin@MikroTik] /ip/firewall> address-list/print
Columns: LIST, ADDRESS, CREATION-TIME
# LIST ADDRESS CREATION-TIME
0 ipsec-addr 192.168.88.212 2025-03-15 22:04:34
It looks like my traffic is not matched by the policy.
Any help would be greatly appreciated.