In all the vendor documentation I find, examples for setting up IPSec tunnels use some of the worst encryption possible.
This is documenting better alternatives between vendors (not necessarily ideal, but the idea is to provide the best solution given the options).
This is an example of a tunnel between a Juniper SRX and Cisco ASA using
- AES256 CBC (Debatable whether AES-CBC is better than AES-GCM, but GCM is easier on your CPU)
- SHA1 (SHA256 would be better)
- PFS Group 5 (Group 19 would be better)
Juniper SRX IPSec
set version 15.1X49-D75.5
set system root-authentication encrypted-password "password"
set system login user louisk uid 2000
set system login user louisk class super-user
set system login user louisk authentication encrypted-password "password"
set system services ssh
set security ike traceoptions file ike-debug
set security ike traceoptions file size 10m
set security ike traceoptions file files 2
set security ike traceoptions flag general
set security ike traceoptions level 3
set security ike proposal ike-proposal-ite-1 authentication-method pre-shared-keys
set security ike proposal ike-proposal-site-1 dh-group group5
set security ike proposal ike-proposal-site-1 authentication-algorithm sha1
set security ike proposal ike-proposal-site-1 encryption-algorithm aes-256-cbc
set security ike proposal ike-proposal-site-1 lifetime-seconds 86400
set security ike policy ike-policy-site-1 mode main
set security ike policy ike-policy-site-1 proposals ike-proposal-site-1
set security ike policy ike-policy-site-1 pre-shared-key ascii-text "password"
set security ike gateway ike-gate-site-1 ike-policy ike-policy-site-1
set security ike gateway ike-gate-site-1 address 192.0.0.2
set security ike gateway ike-gate-site-1 dead-peer-detection optimized
set security ike gateway ike-gate-site-1 dead-peer-detection interval 10
set security ike gateway ike-gate-site-1 dead-peer-detection threshold 5
set security ike gateway ike-gate-site-1 external-interface ge-0/0/0
set security ike gateway ike-gate-site-1 version v1-only
set security ipsec traceoptions flag security-associations
set security ipsec proposal ipsec-proposal-site-1 protocol esp
set security ipsec proposal ipsec-proposal-site-1 authentication-algorithm hmac-sha1-96
set security ipsec proposal ipsec-proposal-site-1 encryption-algorithm aes-256-cbc
set security ipsec proposal ipsec-proposal-site-1 lifetime-seconds 28800
set security ipsec policy ipsec-policy-site-1 perfect-forward-secrecy keys group5
set security ipsec policy ipsec-policy-site-1 proposals ipsec-proposal-site-1
set security ipsec vpn ipsec-vpn-site-1 bind-interface st0.0
set security ipsec vpn ipsec-vpn-site-1 ike gateway ike-gate-site-1
set security ipsec vpn ipsec-vpn-site-1 ike ipsec-policy ipsec-policy-site-1
set security ipsec vpn ipsec-vpn-site-1 traffic-selector ts1-trust-site-1 local-ip 192.168.250.224/29
set security ipsec vpn ipsec-vpn-site-1 traffic-selector ts1-trust-site-1 remote-ip 10.10.64.32/27
set security ipsec vpn ipsec-vpn-site-1 establish-tunnels immediately
set security policies from-zone trust to-zone site-1 policy trust-site-1-site-1 match source-address net-site-1_192.168_250_224_m29
set security policies from-zone trust to-zone site-1 policy trust-site-1-site-1 match destination-address net-site-1_10.10_64_32_m27
set security policies from-zone trust to-zone site-1 policy trust-site-1-site-1 match application any
set security policies from-zone trust to-zone site-1 policy trust-site-1-site-1 then permit
set security policies from-zone site-1 to-zone trust policy site-1-trust-site-1 match source-address net-site-1_10.10_64_32_m27
set security policies from-zone site-1 to-zone trust policy site-1-trust-site-1 match destination-address net-site-1_192.168_250_224_m29
set security policies from-zone site-1 to-zone trust policy site-1-trust-site-1 match application any
set security policies from-zone site-1 to-zone trust policy site-1-trust-site-1 then permit
set security zones security-zone trust address-book address net-site-1_192.168_250_224_m29 192.168.250.224/29
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services all
set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic protocols all
set security zones security-zone site-1 address-book address net-site-1_10.10_64_32_m27 10.10.64.32/27
set security zones security-zone site-1 interfaces st0.0
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ping
set security zones security-zone untrust interfaces ge-0/0/0.0 host-inbound-traffic system-services ike
set interfaces ge-0/0/0 unit 0 family inet address 192.0.0.1/24
set interfaces ge-0/0/1 unit 0 family inet address 192.168.250.225/29
set interfaces fxp0 unit 0 family inet dhcp-client
set interfaces st0 unit 0 description "Cisco ASA IPSec"
set interfaces st0 unit 0 family inet
set routing-options static route 10.10.64.32/27 next-hop st0.0
Cisco ASA IPSec
ASA Version 9.2(4)
!
hostname ciscoasa
names
!
interface Ethernet0/0
!
interface Ethernet0/1
switchport access vlan 2
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Ethernet0/4
!
interface Ethernet0/5
!
interface Ethernet0/6
!
interface Ethernet0/7
!
interface Vlan1
nameif inside
security-level 100
ip address 10.10.64.33 255.255.255.224
!
interface Vlan2
nameif outside
security-level 0
ip address 192.0.0.2 255.255.255.0
!
ftp mode passive
object network obj_any
subnet 0.0.0.0 0.0.0.0
access-list s2s extended permit ip 10.10.64.32 255.255.255.224 192.168.250.224 255.255.255.248
access-list from_outside extended permit icmp any any echo
pager lines 24
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
!
object network obj_any
nat (inside,outside) dynamic interface
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
user-identity default-domain LOCAL
http server enable
http 10.10.64.32 255.255.255.224 inside
no snmp-server location
no snmp-server contact
crypto ipsec ikev1 transform-set CISCO esp-aes-256 esp-sha-hmac
crypto ipsec security-association pmtu-aging infinite
crypto map outside_map 20 match address s2s
crypto map outside_map 20 set pfs group5
crypto map outside_map 20 set peer 192.0.0.1
crypto map outside_map 20 set ikev1 transform-set CISCO
crypto map outside_map 20 set security-association lifetime seconds 28800
crypto map outside_map interface outside
crypto ca trustpool policy
crypto isakmp identity address
no crypto isakmp nat-traversal
crypto ikev1 enable outside
crypto ikev1 am-disable
crypto ikev1 policy 20
authentication pre-share
encryption aes-256
hash sha
group 5
lifetime 86400
telnet timeout 5
no ssh stricthostkeycheck
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
tunnel-group 192.0.0.1 type ipsec-l2l
tunnel-group 192.0.0.1 ipsec-attributes
ikev1 pre-shared-key *****
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
inspect icmp
!
service-policy global_policy global
prompt hostname context
no call-home reporting anonymous
Functional tunnel status
SRX
louisk> show security ike sa
Index State Initiator cookie Responder cookie Mode Remote Address
37052 UP f68955764fc31224 9dc48b4d2398a8c5 Main 192.0.0.2
louisk> show security ipsec sa detail index 67108867
ID: 67108867 Virtual-system: root, VPN Name: ipsec-vpn-site-1
Local Gateway: 192.0.0.1, Remote Gateway: 192.0.0.2
Traffic Selector Name: ts1-trust-site-1
Local Identity: ipv4(10.10.250.224-10.10.250.231)
Remote Identity: ipv4(192.168.64.32-192.168.64.63)
Version: IKEv1
DF-bit: clear, Copy-Outer-DSCP Disabled, Bind-interface: st0.0
Port: 500, Nego#: 0, Fail#: 0, Def-Del#: 0 Flag: 0x2c608b29
Tunnel events:
Tue Feb 19 2019 21:32:05: IPSec SA negotiation successfully completed (1 times)
Tue Feb 19 2019 21:32:04: IKE SA negotiation successfully completed (27 times)
Tue Feb 19 2019 21:31:27: IPSec SA delete payload received from peer, corresponding IPSec SAs cleared (1 times)
Tue Feb 19 2019 21:01:05: IPSec SA negotiation successfully completed (1 times)
Tue Feb 19 2019 21:00:27: IPSec SA delete payload received from peer, corresponding IPSec SAs cleared (1 times)
Tue Feb 19 2019 20:30:05: IPSec SA negotiation successfully completed (1 times)
Direction: inbound, SPI: 4724138f, AUX-SPI: 0
, VPN Monitoring: -
Hard lifetime: Expires in 27411 seconds
Lifesize Remaining: 4608000 kilobytes
Soft lifetime: Expires in 26792 seconds
Mode: Tunnel(0 0), Type: dynamic, State: installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
Anti-replay service: counter-based enabled, Replay window size: 64
Direction: outbound, SPI: fc21b380, AUX-SPI: 0
, VPN Monitoring: -
Hard lifetime: Expires in 27411 seconds
Lifesize Remaining: 4608000 kilobytes
Soft lifetime: Expires in 26792 seconds
Mode: Tunnel(0 0), Type: dynamic, State: installed
Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
Anti-replay service: counter-based enabled, Replay window size: 64
louisk>
ASA
iscoasa# sh crypto isakmp sa
IKEv1 SAs:
Active SA: 1
Rekey SA: 0 (A tunnel will report 1 Active and 1 Rekey SA during rekey)
Total IKE SA: 1
1 IKE Peer: 192.0.0.1
Type : L2L Role : responder
Rekey : no State : MM_ACTIVE
There are no IKEv2 SAs
ciscoasa# show crypto ipsec sa
interface: outside
Crypto map tag: outside_map, seq num: 20, local addr: 192.0.0.2
access-list s2s extended permit ip 192.168.64.32 255.255.255.224 10.10.250.224 255.255.255.248
local ident (addr/mask/prot/port): (192.168.64.32/255.255.255.224/0/0)
remote ident (addr/mask/prot/port): (10.10.250.224/255.255.255.248/0/0)
current_peer: 192.0.0.1
#pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0
#pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts comp failed: 0, #pkts decomp failed: 0
#pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
#PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
#TFC rcvd: 0, #TFC sent: 0
#Valid ICMP Errors rcvd: 0, #Invalid ICMP Errors rcvd: 0
#send errors: 0, #recv errors: 0
local crypto endpt.: 192.0.0.2/0, remote crypto endpt.: 192.0.0.1/0
path mtu 1500, ipsec overhead 74(44), media mtu 1500
PMTU time remaining (sec): 0, DF policy: copy-df
ICMP error validation: disabled, TFC packets: disabled
current outbound spi: 9E267F5A
current inbound spi : 6D64FD16
inbound esp sas:
spi: 0x6D64FD16 (1835334934)
transform: esp-aes-256 esp-sha-hmac no compression
in use settings ={L2L, Tunnel, PFS Group 5, IKEv1, }
slot: 0, conn_id: 512000, crypto-map: outside_map
sa timing: remaining key lifetime (kB/sec): (4374000/27884)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
outbound esp sas:
spi: 0x9E267F5A (2653323098)
transform: esp-aes-256 esp-sha-hmac no compression
in use settings ={L2L, Tunnel, PFS Group 5, IKEv1, }
slot: 0, conn_id: 512000, crypto-map: outside_map
sa timing: remaining key lifetime (kB/sec): (4374000/27884)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
ciscoasa# show crypto ipsec sa detail
interface: outside
Crypto map tag: outside_map, seq num: 20, local addr: 192.0.0.2
access-list s2s extended permit ip 192.168.64.32 255.255.255.224 10.10.250.224 255.255.255.248
local ident (addr/mask/prot/port): (192.168.64.32/255.255.255.224/0/0)
remote ident (addr/mask/prot/port): (10.10.250.224/255.255.255.248/0/0)
current_peer: 192.0.0.1
#pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0
#pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts comp failed: 0, #pkts decomp failed: 0
#pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
#PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
#TFC rcvd: 0, #TFC sent: 0
#Valid ICMP Errors rcvd: 0, #Invalid ICMP Errors rcvd: 0
#pkts no sa (send): 0, #pkts invalid sa (rcv): 0
#pkts encaps failed (send): 0, #pkts decaps failed (rcv): 0
#pkts invalid prot (rcv): 0, #pkts verify failed: 0
#pkts invalid identity (rcv): 0, #pkts invalid len (rcv): 0
#pkts invalid pad (rcv): 0,
#pkts invalid ip version (rcv): 0,
#pkts replay rollover (send): 0, #pkts replay rollover (rcv): 0
#pkts replay failed (rcv): 0
#pkts min mtu frag failed (send): 0, #pkts bad frag offset (rcv): 0
#pkts internal err (send): 0, #pkts internal err (rcv): 0
local crypto endpt.: 192.0.0.2/0, remote crypto endpt.: 192.0.0.1/0
path mtu 1500, ipsec overhead 74(44), media mtu 1500
PMTU time remaining (sec): 0, DF policy: copy-df
ICMP error validation: disabled, TFC packets: disabled
current outbound spi: 9E267F5A
current inbound spi : 6D64FD16
inbound esp sas:
spi: 0x6D64FD16 (1835334934)
transform: esp-aes-256 esp-sha-hmac no compression
in use settings ={L2L, Tunnel, PFS Group 5, IKEv1, }
slot: 0, conn_id: 512000, crypto-map: outside_map
sa timing: remaining key lifetime (kB/sec): (4374000/27861)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
outbound esp sas:
spi: 0x9E267F5A (2653323098)
transform: esp-aes-256 esp-sha-hmac no compression
in use settings ={L2L, Tunnel, PFS Group 5, IKEv1, }
slot: 0, conn_id: 512000, crypto-map: outside_map
sa timing: remaining key lifetime (kB/sec): (4374000/27859)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
ciscoasa#