FortiGate IPsec: Setup, Configuration, and Troubleshooting

Learn how FortiGate IPsec VPNs work, how to configure them, and how to resolve common connection problems.
FortiGate IPsec is a VPN capability on FortiGate firewalls that encrypts traffic between locations or between remote users and a network. To establish a working tunnel, configure matching Phase 1 and Phase 2 settings, then provide the routes and firewall policies needed to carry traffic. A tunnel that shows as “up” is not necessarily passing traffic. Routing and policy configuration matter just as much as encryption settings.
Editor's pick: NordVPN — fast, secure VPN — Strong encryption, a no-logs policy and apps for every device. 30-day money-back guarantee. Get NordVPN →
Compare FortiGate IPsec deployment options
| Option | Typical use | Peer type | Phase 1 setup | Phase 2 setup | Main consideration |
|---|---|---|---|---|---|
| Site-to-site | Connect office networks | Another VPN gateway | Match IKE settings | Match traffic selectors | Both peers need compatible settings |
| Remote access | Connect individual users | User device or VPN client | Configure authentication | Allow intended network traffic | Plan user access and client setup |
| Route-based tunnel | Flexible network routing | VPN gateway | Establish IPsec security association | Define tunnel interface traffic | Requires appropriate routes and policies |
| Policy-based tunnel | Narrow, defined traffic | VPN gateway | Establish IPsec security association | Specify protected traffic | Selectors must match between peers |
| IKEv1 | Legacy interoperability | Compatible VPN peer | Use matching IKE version and proposals | Agree on Phase 2 proposals | Prefer IKEv2 where supported |
| IKEv2 | Modern VPN deployments | Compatible VPN peer | Use matching IKE version and proposals | Agree on Phase 2 proposals | Both peers must support IKEv2 |
| Pre-shared key | Shared-secret authentication | Configured peer | Use the same secret on both peers | Configure matching proposals | Protect and manage the secret |
| Certificate authentication | Certificate-based authentication | Configured peer | Validate certificates and identity | Configure matching proposals | Requires certificate management |
Compiled November 2026; check the provider's site for current details.
What FortiGate IPsec does
IPsec protects IP traffic by authenticating the other endpoint and encrypting data in transit. FortiGate uses Internet Key Exchange (IKE) to negotiate security settings and establish IPsec Security Associations (SAs).
Common deployment types include:
- Site-to-site VPN: Connects two or more networks, such as a branch office and headquarters.
- Remote-access VPN: Lets individual users connect to a private network, typically through a compatible VPN client.
- Hub-and-spoke VPN: Connects multiple branch sites through a central FortiGate hub.
Many deployments use IKEv2, though the correct choice depends on the peer device, client, FortiOS version, and security requirements. The settings at both ends must be compatible.
Phase 1 and Phase 2 explained
FortiGate IPsec configuration is commonly divided into two negotiation stages. FortiGate L2TP: Setup, Limitations, and Alternatives
Phase 1 establishes an authenticated IKE relationship between peers. Typical settings include:
- Remote gateway address or peer identification
- IKE version
- Authentication method and credentials
- Encryption and integrity algorithms
- Diffie-Hellman group
- Lifetime and, where used, NAT traversal settings
Phase 2 establishes the IPsec SAs that protect the actual data. It defines the traffic selectors, often called local and remote subnets, and settings such as encryption, integrity, perfect forward secrecy, and lifetime.
| Setting | Phase 1 | Phase 2 |
|---|---|---|
| Main purpose | Authenticate peers and establish IKE | Protect selected network traffic |
| Common parameters | IKE version, credentials, algorithms | Subnets, IPsec algorithms, PFS |
| Typical mismatch symptom | IKE negotiation fails | IKE may connect, but data SAs do not establish or traffic does not pass |
For a site-to-site tunnel, the local and remote network definitions must be reversed appropriately on the two FortiGate units. For example, if one side’s local network is 10.10.0.0/16 and its remote network is 10.20.0.0/16, the peer generally uses the reverse selection.
Basic site-to-site setup
The exact screens and options can vary by FortiOS release and whether you use the setup wizard or manual configuration. Before starting, record the public peer addresses, protected subnets, authentication details, and agreed algorithms for both ends. FortiGate VPN Client: Setup, Features, and Troubleshooting
A typical setup follows these steps:
- Create the IPsec tunnel. Choose a site-to-site configuration and specify the remote gateway. Select the IKE version and authentication method supported by both peers.
- Configure Phase 1. Set compatible proposals, Diffie-Hellman groups, lifetimes, and peer identification where required. Use a strong pre-shared key or certificate-based authentication.
- Configure Phase 2. Define the local and remote traffic selectors and matching IPsec proposals. Confirm that the peer uses the corresponding reversed subnet definitions.
- Add routing. Route the remote protected subnet through the IPsec interface or use the routing approach appropriate to the design. Dynamic routing may be suitable for larger networks.
- Create firewall policies. Allow traffic from the local network to the VPN interface and, if required, from the VPN interface back to the local network. Apply appropriate security profiles and logging.
- Test both directions. Generate traffic between hosts in the protected networks, then verify the tunnel, routes, policies, and traffic counters.
Avoid overly broad policies where narrower subnet and service rules will work. Also confirm that local hosts use the FortiGate as their gateway, or have another route that directs protected traffic to it.
Remote-access considerations
Remote-access IPsec has different requirements from a site-to-site tunnel. The FortiGate must authenticate users or devices, assign or provide access to client address ranges, and allow the intended destinations through firewall policies.
Plan for: Free VPN Where You Can Choose Location: What to Try and How to Choose
- A compatible client and IKE configuration
- User or certificate authentication
- Address assignment and DNS settings
- Routes to internal networks
- Policies from the VPN interface or zone to permitted destinations
- Multi-factor authentication where supported and appropriate
Check for overlap between the client address pool and internal networks. Overlapping ranges can cause confusing routing behavior even when the VPN successfully connects.
Phase 1 and Phase 2 configuration comparison
| Setting | Phase | Purpose | Must match peer? | Common check | If mismatched |
|---|---|---|---|---|---|
| IKE version | Phase 1 | Negotiates the VPN connection | Yes | Compare IKEv1 or IKEv2 | Phase 1 may not establish |
| Peer identity | Phase 1 | Identifies the remote gateway | Yes | Check configured IDs | Authentication may fail |
| Authentication method | Phase 1 | Verifies the peer | Yes | Compare key or certificate use | Peer authentication may fail |
| Encryption proposal | Both | Protects negotiated traffic | Yes | Compare supported algorithms | Negotiation may fail |
| Integrity proposal | Both | Checks data integrity | Yes | Compare integrity algorithms | Negotiation may fail |
| Diffie-Hellman group | Phase 1 | Creates shared key material | Yes | Compare configured groups | Phase 1 may fail |
| Lifetime | Both | Sets security association duration | Compatible values | Compare timers on both peers | Rekeying may be disrupted |
| Traffic selectors | Phase 2 | Defines protected networks | Yes | Compare local and remote subnets | Phase 2 may fail |
| PFS setting | Phase 2 | Adds key exchange during rekeying | Yes | Compare PFS and group settings | Phase 2 may fail |
Compiled November 2026; check the provider's site for current details.
Troubleshooting a FortiGate IPsec tunnel
Start by identifying where the failure occurs. Is the peer unreachable, is IKE negotiation failing, is Phase 2 missing, or is the tunnel established but traffic blocked? Free VPN Choose Location: How to Pick and Connect Safely
Useful checks in the FortiGate CLI include:
get vpn ipsec tunnel summary
diagnose vpn ike gateway list
diagnose vpn tunnel list
For live IKE negotiation details, an administrator may use:
diagnose debug reset
diagnose debug application ike -1
diagnose debug enable
Reproduce the connection attempt, review the output, then stop debugging:
diagnose debug disable
diagnose debug reset
Debug output can contain sensitive information. Use it carefully and share it only with trusted administrators. OVPN: What It Is, How It Works, and How to Use an.ovpn File
Common causes include:
- Phase 1 fails: Check peer reachability, IKE version, authentication, peer ID, and Phase 1 proposals.
- Phase 1 works but Phase 2 fails: Compare traffic selectors, Phase 2 proposals, PFS settings, and lifetimes.
- Tunnel is up but traffic fails: Check routes, firewall policies, NAT behavior, host gateways, and return paths.
- Only some traffic works: Review selectors, policy services, overlapping subnets, and asymmetric routing.
- Tunnel drops intermittently: Check peer connectivity, rekey settings, dead-peer detection, and logs on both devices.
Make configuration changes in a controlled way. Compare both peers’ settings side by side, change one relevant parameter at a time, and confirm that both sides use compatible proposals. FortiOS commands and available options vary by version, so consult the documentation for the installed release before applying CLI changes.
Security and maintenance
Use modern, mutually supported cryptographic algorithms and avoid legacy options unless compatibility requires them. Keep FortiOS and VPN clients updated, protect credentials, and limit VPN access to the networks and services users need.
Document peer addresses, subnets, authentication methods, and negotiated proposals. Review logs and tunnel status after upgrades or network changes, and test failover and recovery if the VPN supports redundancy. Proton Free VPN: What You Get and Whether It’s Worth Using
Troubleshooting checks by symptom
| Symptom | First check | FortiGate area | Peer-side check | Likely issue | Next step |
|---|---|---|---|---|---|
| Phase 1 is down | Reachability to peer | VPN status and logs | Public IP and IKE settings | Connectivity or proposal mismatch | Verify routing and Phase 1 settings |
| Phase 1 authentication fails | Peer ID and credentials | VPN configuration and logs | ID, key, or certificate | Authentication mismatch | Confirm identity and authentication method |
| Phase 1 is up, Phase 2 is down | Traffic selectors | Phase 2 settings and logs | Local and remote subnets | Selector or proposal mismatch | Compare Phase 2 settings |
| Tunnel is up, traffic fails | Policies and routes | Firewall policy and routing | Return route and selectors | Traffic not permitted or routed | Check both directions |
| Only one direction works | Return path | Routes and policies | Remote routes and policies | Asymmetric routing or missing rule | Confirm bidirectional reachability |
| Tunnel drops periodically | Timers and link stability | VPN events and interface status | Peer timers and connectivity | Rekey or connectivity problem | Compare lifetimes and inspect logs |
| Remote users cannot connect | Client settings and authentication | Remote-access configuration | Client version and credentials | Client or authentication mismatch | Verify supported settings and access rules |
Compiled November 2026; check the provider's site for current details.
Recommendation
For a reliable FortiGate IPsec deployment, first agree on Phase 1 and Phase 2 settings with the peer administrator, then configure routes and narrowly scoped firewall policies. Validate traffic in both directions and use FortiGate diagnostics to troubleshoot each negotiation stage separately.
