apt-get install racoon
IKE 3DES HASH SHA-1 Diffie Hellman Grupo 2 Life Time 86400 seconds Authentication by Preshared Key IPSec 3DES Integrity : ESP/SHA1 Mode: Tunel Perfect Forward Secrecy (Active) Lifetime 3600 seconds xxxx - IP , yyyy - IP Cisco zzzz - IP Cisco
diff -ur a/ipsec-tools-0.7.1/src/racoon/localconf.cb/ipsec-tools-0.7.1/src/racoon/localconf.c --- a/ipsec-tools-0.7.1/src/racoon/localconf.c 2006-09-09 11:22:09.000000000 -0500 +++ b/ipsec-tools-0.7.1/src/racoon/localconf.c 2010-08-06 16:35:18.000000000 -0500 <at> <at> -211,7 +211,8 <at> <at> if (*p == '\0') continue; /* no 2nd parameter */ p--; - if (strncmp(buf, str, len) == 0 && buf[len] == '\0') { + if (strncmp(buf, "*", 2) == 0 || + (strncmp(buf, str, len) == 0 && buf[len] == '\0')) { p++; keylen = 0;
apt-get install xl2tp ppp
# /etc/xl2tpd/xl2tpd.conf [global] ipsec saref = yes force userspace = yes [lns default] local ip = 10.1.2.1 ip range = 10.1.2.10-10.1.2.254 # refuse pap = yes require authentication = yes ppp debug = yes length bit = yes pppoptfile = /etc/ppp/options # /etc/ppp/options: ms-dns 10.1.2.1 ms-dns 8.8.8.8 require-mschap-v2 asyncmap 0 auth crtscts lock hide-password modem debug name l2tpd defaultroute proxyarp lcp-echo-interval 10 lcp-echo-failure 100 #/etc/ppp/chap-secrets: # Secrets for authentication using CHAP # client server secret IP addresses username * userpass * # . IP addresses , . alvelig 10.1.2.7 alvelig * alvelig 10.1.2.7
# /etc/racoon/racoon.conf: path include "/etc/racoon"; path pre_shared_key "/etc/racoon/psk.txt"; # PreShared Keys (. ) path certificate "/etc/racoon/certs"; # IKE Road Warrior remote anonymous { exchange_mode aggressive,main; passive on; proposal_check obey; support_proxy on; nat_traversal on; ike_frag on; dpd_delay 20; proposal { encryption_algorithm aes; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } proposal { encryption_algorithm 3des; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } } # IPSEC Road Warrior CISCO sainfo anonymous { pfs_group 2; lifetime time 3600 sec; encryption_algorithm 3des; authentication_algorithm hmac_sha1; compression_algorithm deflate ; } # IKE CISCO remote yyyy { exchange_mode main, aggressive; my_identifier address; lifetime time 86400 sec; nat_traversal on; dpd_delay 20; proposal { encryption_algorithm 3des; hash_algorithm sha1; authentication_method pre_shared_key; dh_group 2; } }
# /etc/racoon/psk.txt: # PSK Cisco 200.68.5.131 CiscoPSK # PSK NAT * RoadWarrior
# /etc/ipsec-tools.conf #!/usr/sbin/setkey -f # # Flush SAD and SPD flush; spdflush; # Create policies for racoon spdadd xxxx/32 zzzz/32 any -P out ipsec esp/tunnel/xxxx-yyyy/require; spdadd zzzz/32 xxxx/32 any -P in ipsec esp/tunnel/yyyy-xxxx/require; ########################## ## XL2TP ## ########################## spdadd 0.0.0.0/0[0] 0.0.0.0/0[1701] udp -P in ipsec esp/transport//require; spdadd 0.0.0.0/0[1701] 0.0.0.0/0[0] udp -P out ipsec esp/transport//require;
apt-get install openswan
# /etc/ipsec.conf config setup # nat_traversal=yes # NAT conn cisco # forceencaps=yes dpddelay=30 # Dead peer detection - 30 - keep-alive dpdtimeout=120 # dpd 120 , dpdaction=restart_by_peer # # IKE alg 3DES - HASH sha1 - DH group 2 (1024) ike=3des-sha1-modp1024 # IKE lifetime 86400 seconds (24 hours) ikelifetime=86400s # IKE auth method Pre-Shared Key (PSK secret) authby=secret # IPSEC params # OpenSWAN # phase2=esp # by default # phase2=3des-sha1 # by default the same as IKE # IPSec type tunnel type=tunnel # - # IPSEC (key) lifetime salifetime=3600s # Perfect Forward Secrecy PFS group the same as IKE (1024) pfs=yes # Perfect Forward Secrecy #left side (myside) left=xxxx # OpenSWAN side # , IPSec, netmask xxxx/32 leftsubnet=xxxx/32 #net subnet on left side to assign to right side leftnexthop=yyyy # CISCO side #right security gateway (CISCO side) right=yyyy #CISCO side rightsubnet=zzzz/32 #net on right side rightnexthop=xxxx # OpenSWAN side auto=start # Road Warrior conn L2TP authby=secret pfs=no auto=add keyingtries=3 rekey=no ikelifetime=8h keylife=1h type=transport left=xxxx leftprotoport=17/%any # 1701, iOS . %any , : iPad ! right=%any rightprotoport=17/%any compress=no dpddelay=30 dpdtimeout=120 dpdaction=clear # dpdaction=clear , .. ipsec # , , " peer", # ,
ipsec setup start ping zzzz 64 bytes from zzzz: icmp_req=1 ttl=254 time=7.53 ms 64 bytes from zzzz: icmp_req=2 ttl=254 time=6.59 ms 64 bytes from zzzz: icmp_req=3 ttl=254 time=6.41 ms 64 bytes from zzzz: icmp_req=4 ttl=254 time=6.77 ms
echo 1 > /proc/sys/net/ipv4/ip_forward
Or watch your iptablesSource: https://habr.com/ru/post/177223/
All Articles