Hi,
I have a topology with 4 Mikrotik CHRs (version 6.43.13 - LongTerm):
- Edge: R1 and R2
- Core: R3 and R4
Edge routers have IPSEC toward Routers A and B with eBGP peering configured. Primary path from remote AS is through R1 and backup is through R2.
Edge and Core routers have IPIP tunnels with IPSEC and iBGP peering configured.
Image is on https://ibb.co/L0Grh4z
Routers A and B have routes to 1.1.1.1/32 and 1.1.2.1/32 and Core routers R3 and R4 have routes to 100.100.1.0/24 and 100.100.2.0/24.
Traffci goes fine if path is
- Router A => R1 => R3 or R4
- Router B => R2 => R3 or R4
I'm testing redundancy, and when links from R1 to R3&R4 are down, so only way for traffic is yellow arrrow, Router A => R1 => R2 and then R3 or R4 (doesn't matter), I have a problem.
When I sniff traffic on R2, I can see ingress traffic on IPIP tunnel R1-R2, but no egress traffic to R3 or R4. In log I can see:
[admin@R2 /ip route> /tool sniffer quick port=1812 freeze-frame-interval=10s
INTERFACE TIME NUM DIR SRC-MAC DST-MAC VLAN SRC-ADDRESS DST-ADDRESS PROTOCOL SIZE CPU FP
IPIP_R1-R2 5.656 1 <- 100.100.1.1:1812 (radius) 1.1.1.1:1812 (radius) ip:udp 581 1 no
IPIP_R1-R2 7.67 2 <- 100.100.2.2:1812 (radius) 1.1.2.1:1812 (radius) ip:udp 581 1 no
What is interesting; if I disable IPSEC policies on R2 for IPSEC to Router B, traffic goes as it should, so it seems to me that traffic is simply triggering wrong policy. On R2, policies to Router B are configured manually and for IPIP tunnels, Mikrotik configures dynamic policies of course.
Routers A and B are Junipers with route-based IPSEC configured. So I configured policies with level Require because on the other side, only one SA is up.
I also added those policies with action NONE:
/ip ipsec policy
add action=none dst-address=1.1.1.1/32 src-address=100.100.1.0/24
add action=none dst-address=1.1.1.1/32 src-address=100.100.2.0/24
add action=none dst-address=1.1.2.1/32 src-address=100.100.1.0/24
add action=none dst-address=1.1.2.1/32 src-address=100.100.2.0/24
add dst-address=100.100.2.0/24 proposal="PROPOSAL_1" sa-dst-address=4.4.4.4 sa-src-address=172.31.32.27 src-address=1.1.1.1/32 tunnel=yes
add dst-address=100.100.1.0/24 proposal="PROPOSAL_1" sa-dst-address=4.4.4.4 sa-src-address=172.31.32.27 src-address=1.1.1.1/32 tunnel=yes
add dst-address=100.100.2.0/24 proposal="PROPOSAL_1" sa-dst-address=4.4.4.4 sa-src-address=172.31.32.27 src-address=1.1.2.1/32 tunnel=yes
add dst-address=100.100.1.0/24 proposal="PROPOSAL_1" sa-dst-address=4.4.4.4 sa-src-address=172.31.32.27 src-address=1.1.2.1/32 tunnel=yes
Dynamic policy R2 to R1, R2 and R3:
16 DA ;;; IPIP_R1-R2
src-address=172.31.32.27/32 src-port=any dst-address=10.0.50.102/32 dst-port=any protocol=ipencap action=encrypt level=require ipsec-protocols=esp tunnel=no proposal=default ph2-count=2
17 DA ;;; IPIP_R2-R4
src-address=172.31.32.27/32 src-port=any dst-address=192.168.255.30/32 dst-port=any protocol=ipencap action=encrypt level=require ipsec-protocols=esp tunnel=no proposal=default ph2-count=2
19 DA ;;; IPIP_R2-R3
src-address=172.31.32.27/32 src-port=any dst-address=192.168.255.40/32 dst-port=any protocol=ipencap action=encrypt level=require ipsec-protocols=esp tunnel=no proposal=default ph2-count=2
For tshoot reasons, I configured mangle rules just to track packets.
In log I see:
10:50:01 firewall,info MANGLE_IN_NONE prerouting: in:IPIP_R1-R2 out:(unknown 0), proto UDP, 100.100.1.10:1812->1.1.2.1:1812, len 581
10:50:03 firewall,info MANGLE_IN_NONE prerouting: in:IPIP_R1-R2 out:(unknown 0), proto UDP, 100.100.2.20:1812->1.1.2.1:1812, len 581
When policies to Router A and B are disabled, then traffic goes fine and in sniff and log I see:
[admin@R2] /log> /tool sniffer quick port=1812 freeze-frame-interval=10s
INTERFACE TIME NUM DIR SRC-MAC DST-MAC VLAN SRC-ADDRESS DST-ADDRESS PROTOCOL SIZE CPU FP
IPIP_R1-R2 53.627 1 <- 100.100.2.20:1812 (radius) 1.1.1.1:1812 (radius) ip:udp 581 0 no
IPIP_R2-R3 53.627 2 -> 100.100.2.20:1812 (radius) 1.1.1.1:1812 (radius) ip:udp 581 0 no
IPIP_R2-R3 54.667 3 <- 1.1.1.1:1812 (radius) 100.100.2.20:1812 (radius) ip:udp 196 1 no
IPIP_R1-R2 54.667 4 -> 1.1.1.1:1812 (radius) 100.100.2.20:1812 (radius) ip:udp 196 1 no
11:02:20 firewall,info MANGLE_IN_NONE prerouting: in:IPIP_R1-R2 out:(unknown 0), proto UDP, 100.100.2.20:1812->1.1.1.1:1812, len 581
11:02:20 firewall,info FORWARD____LOG forward: in:IPIP_R1-R2 out:IPIP_R2-R3, proto UDP, 100.100.2.20:1812->1.1.1.1:1812, len 581
11:02:20 firewall,info MANGLE_TEST postrouting: in:(unknown 0) out:IPIP_R2-R3, proto UDP, 100.100.2.20:1812->1.1.1.1:1812, len 581
11:02:20 firewall,info MANGLE_TEST postrouting: in:(unknown 0) out:IPIP_R2-R3, proto UDP, 100.100.2.20:1812->1.1.1.1:1812, len 581
11:02:20 firewall,info MANGLE_POSTROUTING_OUT_NONE postrou: in:(unknown 0) out:IPIP_R2-R3, proto UDP, 100.100.2.20:1812->1.1.1.1:1812, len 581
11:02:21 firewall,info FORWARD____LOG forward: in:IPIP_R2-R3 out:IPIP_AWS_R1-R2, proto UDP, 1.1.1.1:1812->100.100.2.20:1812, len 196
Does anyone have a clue how to configure this to work even when IPSEC on R2 to Router B is enabled?
Tnx.