IPsec (Internet Protocol Security) is a suite of protocols designed to secure data communication over potentially insecure networks like the Internet. It is widely used to create Virtual Private Networks (VPNs) for securely connecting remote sites or users.
IPsec operates in two distinct phases: Phase 1 (IKE SA) and Phase 2 (IPsec SA). Each phase has specific responsibilities in establishing a secure connection.
This section provides a practical example of configuring an IPsec VPN between two sites using Juniper SRX devices.
203.0.113.1.Create an IKE Policy:
set security ike policy ike-policy proposal-set standard
Define the IKE Gateway:
set security ike gateway remote-site ike-policy ike-policy address 203.0.113.1 external-interface ge-0/0/0
203.0.113.1.Create an IPsec Policy:
set security ipsec policy ipsec-policy proposal-set standard
Define the VPN Tunnel:
set security ipsec vpn vpn-to-remote-site bind-interface st0.0
set security ipsec vpn vpn-to-remote-site ike gateway remote-site
set security ipsec vpn vpn-to-remote-site ike ipsec-policy ipsec-policy
st0.0).Assign an IP address to the virtual interface:
set interfaces st0.0 family inet address 10.1.1.1/30
Configure static routes for the remote network:
set routing-options static route 192.168.2.0/24 next-hop 10.1.1.2
Verify IKE Phase 1 Status:
show security ike security-associations
Verify IPsec Phase 2 Status:
show security ipsec security-associations
Test Connectivity:
Ping a device in the remote network to confirm the tunnel is operational:
ping 192.168.2.10
IPsec VPNs can fail due to misconfigurations, connectivity issues, or protocol mismatches. Understanding common problems and their solutions ensures stable VPN connections.
Symptoms:
show security ike security-associations shows no active sessions.Possible Causes:
Troubleshooting Steps:
Verify the IKE configuration on both devices:
show configuration security ike
standard on both sides).Test connectivity to the remote peer:
ping 203.0.113.1
Check IKE logs:
show log messages | match IKE
Symptoms:
show security ipsec security-associations displays no active associations.Possible Causes:
Troubleshooting Steps:
Verify IPsec policies:
show configuration security ipsec
Check proxy ID settings:
set security ipsec vpn vpn-to-remote-site traffic-selector remote-subnet source 192.168.1.0/24 destination 192.168.2.0/24
View IPsec logs:
show log messages | match IPsec
Symptoms:
Possible Causes:
Troubleshooting Steps:
Verify security policies allow traffic through the tunnel:
show configuration security policies
Check routing table entries:
show route
Use flow trace to debug traffic:
set security flow traceoptions file flow-log
set security flow traceoptions flag basic-datapath
commit
show log flow-log
| Command | Purpose |
|---|---|
show security ike security-associations |
View the status of IKE Phase 1. |
show security ipsec security-associations |
View the status of IPsec Phase 2. |
| `show log messages | match IKE` |
| `show log messages | match IPsec` |
show security flow session |
Monitor traffic sessions through the tunnel. |
Configure redundant VPN tunnels with two Internet connections for high availability.
Configure two IKE Gateways:
set security ike gateway primary-gateway address 203.0.113.1 external-interface ge-0/0/0
set security ike gateway secondary-gateway address 198.51.100.1 external-interface ge-0/0/1
Create IPsec VPNs for each gateway:
set security ipsec vpn vpn-primary ike gateway primary-gateway
set security ipsec vpn vpn-secondary ike gateway secondary-gateway
Configure routing failover using static routes or BGP:
set routing-options static route 192.168.2.0/24 next-hop st0.0 preference 10
set routing-options static route 192.168.2.0/24 next-hop st0.1 preference 20
st0.x) for VPN traffic.Example:
set interfaces st0.0 family inet address 10.1.1.1/30
set security policies from-zone trust to-zone vpn policy allow-vpn then permit
Example:
set security policies from-zone trust to-zone untrust policy vpn-policy match application any
set security policies from-zone trust to-zone untrust policy vpn-policy then permit tunnel ipsec-vpn vpn-to-remote-site
Configuration:
set security ipsec policy ipsec-policy pfs-keys group5
Configuration:
set security ike policy ike-policy proposal-set standard
set security ipsec policy ipsec-policy proposal-set standard
This is a must-know distinction in IPsec — and almost guaranteed to appear in multiple-choice format.
| Protocol | ESP (Encapsulating Security Payload) | AH (Authentication Header) |
|---|---|---|
| Encryption | Yes – provides confidentiality (encryption of data) | No – does not encrypt data |
| Integrity & Authentication | Yes | Yes |
| Common Use | Most IPsec VPNs use ESP exclusively | Rare; used in specialized environments requiring authentication only |
| NAT Support | NAT-friendly | No - Breaks under NAT, as it includes immutable IP header fields |
“Which IPsec protocol provides both encryption and authentication?”
→ Correct answer: ESP
“Which protocol offers authentication only, without encryption?”
→ Correct answer: AH
Some firewalls and NAT devices block IPsec traffic because IPsec uses protocol numbers 50 (ESP) and 51 (AH), which are not TCP or UDP.
Enable NAT-Traversal (NAT-T), which encapsulates IPsec packets inside UDP (port 4500), allowing them to pass through NAT/firewall devices.
One or both VPN endpoints are behind NAT.
Intermediate firewall is dropping ESP/AH protocols.
VPN tunnels fail to establish or pass traffic despite correct configuration.
Detects NAT devices in the path.
Automatically switches to UDP encapsulation if NAT is present.
Juniper SRX enables NAT-T by default, but can be manually verified:
set security ike gateway remote-site nat-keepalive
“Which feature allows IPsec VPNs to work when NAT devices are in the path?”
→ Correct answer: NAT-T (NAT Traversal)
SRX uses route-based VPNs with secure tunnel interfaces (st0.x). These interfaces act like physical interfaces and must be treated accordingly.
st0 interface:set interfaces st0.0 family inet address 10.1.1.1/30
st0 to a security zone:set security zones security-zone vpn interfaces st0.0
If you forget either of these, the VPN tunnel may come up, but no traffic will pass through.
The SRX will drop packets due to missing zone or routing information.
st0.0 to a zone → traffic will not match any policy.“A VPN tunnel is up, but no traffic passes. What might be missing?”
→ Correct answer: “The st0 interface is not assigned to a security zone or lacks an IP address.”
| Concept | Key Detail |
|---|---|
| ESP vs AH | ESP encrypts and authenticates; AH only authenticates |
| NAT-T (NAT Traversal) | Allows IPsec to work through NAT/firewalls via UDP port 4500 |
| st0 interface setup | Must have both IP address and zone binding to pass traffic |
Why might an IPsec VPN tunnel remain down on an SRX firewall even though the configuration appears correct?
Because Phase1 parameters such as authentication method, encryption algorithm, or pre-shared key do not match between peers.
IPsec tunnel establishment begins with Phase1 (IKE negotiation). If the peers cannot agree on parameters such as encryption algorithm, hashing method, authentication type, or pre-shared key, the negotiation fails and the VPN tunnel never forms. A common troubleshooting step is verifying that both peers use identical IKE proposals and authentication settings. Engineers often overlook mismatches in encryption algorithms or incorrect shared keys. Logs and commands such as show security ike security-associations help identify negotiation failures.
Demand Score: 96
Exam Relevance Score: 97
Why would Phase1 of an IPsec VPN succeed but Phase2 fail?
Because the IPsec Phase2 parameters (such as encryption, authentication, or proxy identities) do not match between the peers.
After Phase1 establishes a secure control channel, Phase2 negotiates the actual data encryption parameters. If the IPsec proposals differ between the devices, Phase2 cannot establish the security association required for encrypted traffic. Another common cause is mismatched proxy identities or traffic selectors that define which networks should be protected by the VPN. Administrators should compare Phase2 settings on both devices and verify that the protected networks match exactly.
Demand Score: 94
Exam Relevance Score: 96
What is the main difference between route-based VPN and policy-based VPN on an SRX firewall?
Route-based VPN uses a virtual tunnel interface, while policy-based VPN relies on security policies to define encrypted traffic.
In route-based VPNs, traffic is routed into a tunnel interface (typically st0), allowing dynamic routing protocols and flexible configurations. Policy-based VPNs encrypt traffic based on firewall policies matching specific source and destination networks. Route-based VPNs are generally preferred because they support dynamic routing, simpler troubleshooting, and better scalability. For this reason, most modern SRX deployments use route-based VPNs rather than policy-based designs.
Demand Score: 92
Exam Relevance Score: 94
Why must the st0 tunnel interface be assigned to a security zone?
Because SRX security policies are evaluated based on zone-to-zone traffic.
SRX firewalls use a zone-based security model. Every interface, including VPN tunnel interfaces such as st0, must belong to a security zone. When traffic enters the VPN tunnel, the firewall evaluates security policies between the source zone and the zone containing the tunnel interface. If the tunnel interface is not assigned to a zone, the firewall cannot process security policies for that traffic. As a result, the configuration will not function properly and traffic may be dropped.
Demand Score: 89
Exam Relevance Score: 92
Why does a VPN tunnel show as established but no traffic passes through it?
Because routing or security policies do not allow traffic into the VPN tunnel.
Even when an IPsec tunnel is successfully established, traffic will not flow unless the routing table directs packets to the tunnel interface and security policies permit the traffic between the appropriate zones. Engineers often forget to add static routes pointing remote networks to the st0 interface or neglect to create security policies allowing traffic between internal and VPN zones. Verifying routes, policies, and session tables is critical when troubleshooting this issue.
Demand Score: 88
Exam Relevance Score: 92
Which command can verify active IPsec security associations on an SRX device?
show security ipsec security-associations
This command displays detailed information about active IPsec Phase2 security associations. It includes parameters such as encryption algorithm, authentication method, lifetime, and packet counters. Engineers frequently use this command during troubleshooting to confirm whether encrypted traffic is flowing through the VPN tunnel. If packet counters remain at zero, it indicates that traffic is not reaching the tunnel or is being blocked by routing or security policies.
Demand Score: 84
Exam Relevance Score: 90