I would like to create a site-to-site connection with IPSEC IKEv2. The connection should connecte two internal networks, as shown below:
The real IP addresses have been replaced with 1.2.3.188 and 1.2.3.161.
I could already setup the two routers. I’m going to post (most of) the configurations at the end of this post.
Here are some problems:
- I can ping the remote router 192.168.13.254 from the computer 192.168.14.2.
- But I cannot ping the remote device 192.168.13.252 from the computer 192.168.14.2
- From the routers, I cannot ping anything that is on the other side of the tunnel. E.g. I cannot ping 192.168.14.1 from 192.168.13.254 and vice versa.
In the begining, I was using policy templates. Later I switched to hand written policies because I wanted to understand what is happening and why.
Using the current config, IKE phase1 and phase2 are completed, there are SAs installed and the hand written policies are shown as active:
Flags: T - template, X - disabled, D - dynamic, I - invalid, A - active, * - default
# PEER TUN SRC-ADDRESS DST-ADDRESS
0 TX* 0.0.0.0/0 0.0.0.0/0
1 A pee.. yes 192.168.13.0/24 192.168.14.0/24
There will be various servers and workstations connected to both ends, and I need to be able to reach them from both sides. For example, if somebody asks for help in the office but I’m currently in branch01, then I want to be able to look at her screen with VNC. In other words, I do not want to put these networks behind NAT. I only need this tunnel to create a secure connection between the two networks so that I can route packets between them. (The end goal is to be able to add branch02 and branch03 etc. but I think I’m far away from that.)
Config for the initiator side
Initiator side
/ip address
add address=192.168.14.1/24 comment=defconf interface=ether2 network=192.168.14.0
/interface bridge
add admin-mac=AA:BB:CC:DD:EE:FF arp=proxy-arp auto-mac=no comment=defconf name=bridge
/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
/ip ipsec mode-config
add name=modeconf-branch01 responder=no
/ip ipsec policy group
add name=group-branch01
/ip ipsec profile
add dh-group=modp2048 enc-algorithm=aes-256 hash-algorithm=sha256 name=profile-branch01
/ip ipsec peer
add address=1.2.3.188/32 exchange-mode=ike2 name=peer-remote-office profile=profile-branch01
/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha512,sha256,sha1 enc-algorithms=aes-256-cbc,aes-128-cbc pfs-group=modp2048
add auth-algorithms=sha256 comment=none enc-algorithms=aes-256-cbc name=proposal-branch01 pfs-group=modp2048
/ip ipsec identity
add auth-method=digital-signature certificate=cert_export_laci@vpn.office.my.server.com.p12_0 generate-policy=port-strict mode-config=\
modeconf-branch01 peer=peer-remote-office policy-template-group=group-branch01
/ip ipsec policy
set 0 dst-address=0.0.0.0/0 src-address=0.0.0.0/0
add dst-address=192.168.13.0/24 peer=peer-remote-office proposal=proposal-branch01 sa-dst-address=1.2.3.188 sa-src-address=\
0.0.0.0 src-address=192.168.14.0/24 tunnel=yes
/ip firewall filter
add action=accept chain=input port=1701,500,4500 protocol=udp
add action=accept chain=input protocol=ipsec-esp
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 src-address=192.168.13.0/24
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="accept out ipsec policy" ipsec-policy=out,ipsec
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=accept chain=forward src-address=192.168.14.0/24
add action=accept chain=forward src-address=192.168.13.0/24
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 nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
Responder side
/ip address
add address=192.168.13.254/24 comment=defconf interface=ether2 network=192.168.13.0
/interface bridge
add admin-mac=11:22:33:44:55:66 auto-mac=no comment=defconf name=bridge
/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
/ip ipsec mode-config
add address=10.0.88.1 address-prefix-length=32 name=modeconf-office static-dns=192.168.13.254 system-dns=no
/ip ipsec policy group
add name=group-office
/ip ipsec profile
add dh-group=modp2048 enc-algorithm=aes-256 hash-algorithm=sha256 name=profile-office
/ip ipsec peer
add exchange-mode=ike2 local-address=1.2.3.188 name=peer-local-office passive=yes profile=profile-office
/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha512,sha256,sha1 enc-algorithms=aes-256-cbc,aes-128-cbc pfs-group=modp2048
add auth-algorithms=sha256 enc-algorithms=aes-256-cbc lifetime=4h name=proposal-office pfs-group=modp2048
/ip ipsec identity
add auth-method=digital-signature certificate=vpn.office.my.server.com generate-policy=port-strict match-by=certificate mode-config=\
modeconf-office peer=peer-local-office policy-template-group=group-office remote-certificate=laci@vpn.office.my.server.com \
remote-id=user-fqdn:laci.vpn.office.my.server.com
/ip ipsec policy
set 0 disabled=yes dst-address=0.0.0.0/0 src-address=0.0.0.0/0
add dst-address=192.168.14.0/24 peer=peer-local-office proposal=proposal-office sa-dst-address=1.2.3.161 sa-src-address=\
1.2.3.188 src-address=192.168.13.0/24 tunnel=yes
/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="Allow UPD 500,4500 for IPSec for vpn.office.my.server.com" dst-address=1.2.3.188 dst-port=500,4500 protocol=udp
add action=accept chain=input comment="Allow IPSec-ESP for vpn.office.my.server.com" dst-address=1.2.3.188 protocol=ipsec-esp
add action=accept chain=input ipsec-policy=in,ipsec src-address=192.168.14.0/24
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=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=accept chain=forward src-address=192.168.13.0/24
add action=accept chain=forward src-address=192.168.14.0/24
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN