My schema looks like this:
LAN1 (10.99.0.0/20) <-> Mikrotik (111.222.333.444) ..... OpenSWAN (444.333.222.111) <-> LAN2 (10.20.50.0/24)
Mikrotik:
Peer conf:
Code: Select all
ip ipsec peer add address=444.333.222.111/32 port=500 auth-method=pre-shared-key secret="verybigsecret" exchange-mode=main proposal-check=exact hash-algorithm=sha1 enc-algorithm=aes-128 dh-group=modp1024 generate-policy=no lifetime=4h dpd-interval=disable-dpd
Code: Select all
ip ipsec policy add src-address=10.99.0.0/20 src-port=any dst-address=10.20.50.0/24 dst-port=any sa-src-address=111.222.333.444 sa-dst-address=444.333.222.111 tunnel=yes action=encrypt proposal=ipsec-sha1-aes128
Code: Select all
ip firewall nat add chain=srcnat action=accept place-before=0 src-address=10.99.0.0/20 dst-address=10.20.50.0/24
OpenSWAN:
ipsec.conf:
Code: Select all
version 2.0 # conforms to second version of ipsec.conf specification
config setup
interfaces="ipsec0=eth0.1"
klipsdebug="none"
plutodebug="none"
nat_traversal=no
conn vpn1
auto=start
keyingtries=1
#IKE params (phase 1)
authby=secret
ike="aes128-sha1;modp1024"
keyexchange=ike
ikelifetime=240m
#IPsec Params (phase 2)
type=tunnel
auth=esp
esp="aes128-sha1;modp1024"
pfs=yes
keylife=60m
#Subnets
left=444.333.222.111
leftsubnet=10.20.50.0/24
right=111.222.333.444
rightsubnet=10.99.0.0/20
But after some time (around 15min), if no traffic goes from LAN2 to LAN1, VPN connection seems to be down, i can't ping LAN2 from LAN1, and can't do anything. Only thing that helps, that some one from LAN2 send any packet to LAN1, the tunnel is going up and every thing is ok.
Any way, when there is no traffic for 10-15min VPN again stops working, and i can't bring it UP from LAN1.
Output from "ip ipsec remote-peers print"
Code: Select all
0 local-address=111.222.333.444 remote-address=444.333.222.111 state=established side=responder established=50m13s
Help.
UPD.
I think the problem is in remote-peers state of Mikrotik, it can be only initiator or responder, but how can i make it BothDirections (so it can be initiator and responder at one time)?
Thanks.