Created on
05-31-2022
05:36 AM
Edited on
10-13-2025
10:26 PM
By
Jean-Philippe_P
| Description |
This article describes how to configure OSPF over an IPsec dynamic tunnel with net-device disable and mode config. |
| Scope | FortiGate |
| Solution |
The topology consists of two FortiGates in a hub-and-spoke topology:
While the VPN tunnel IP addresses (aka 'overlay IPs') of the spoke can be assigned manually, a more scalable solution for larger environments is to utilize IKE mode-config for dynamic address assignment. IKE mode-config will be used in this example deployment.
Configuration on the Hub: IPsec Tunnel Interface configuration:
config system interface edit 'TO_SPOKE' set vdom 'root' next end
Notes:
IPsec VPN configuration:
config vpn ipsec phase1-interface edit 'TO_SPOKES' set type dynamic next end
config vpn ipsec phase2-interface edit 'TO_SPOKES' set phase1name 'TO_SPOKES' next end
Notes:
'mode-config' has a behavior with net-device enable where it allocates a /30 subnet for each dialup client if the Hub does not have a tunnel IP statically assigned (one IP for the Hub's VPN kernel interface, another IP for the Spoke, and the remaining two IPs are for the network and broadcast addresses). This results in 4x the IPs being consumed from the mode-config pool per Spoke. It may cause IP exhaustion; IKE debug will show 'could not allocate IPv4 address'. Switch to net-device disable (as recommended in this article) and statically assigning an address to the Hub tunnel interface is recommended to prevent this issue.
OSPF configuration:
config router ospf set router-id 10.10.10.1 edit 0.0.0.0 end edit 'TO_SPOKES' set interface 'TO_SPOKES' next end edit 1 set prefix 172.16.103.0 255.255.255.0 next set prefix 10.10.10.0 255.255.255.0 <----- Enable OSPF for the VPN overlay subnet. next end end
Notes:
Configuration on the Spoke: IPsec Tunnel Interface configuration:
config system interface edit 'TO_HUB' set vdom 'root' next end
Note: There is no need for manual IP address assignment on the Spokes since the Hub FortiGate will dynamically assign an IP address via mode-config.
IPsec VPN configuration:
config vpn ipsec phase1-interface edit 'TO_HUB' set interface 'port6' next end
edit 'TO_HUB' set phase1name 'TO_HUB' next end
Notes:
OSPF configuration:
config router ospf set router-id 10.10.10.2 edit 0.0.0.0 end edit 'TO_HUB' set interface 'TO_HUB' next end edit 1 set prefix 172.16.104.0 255.255.255.0 next set prefix 10.10.10.0 255.255.255.0 <--- Enable OSPF for the VPN overlay subnet. next end end
Note: Spokes are set to network-type point-to-point since they only form neighborships back to the Hub FortiGate (the dialup VPN is a non-broadcast network, and so Spokes will not form neighborships with other Spokes).
Result: Once the above configurations are applied to the Hub and Spoke, the Spoke FortiGates will be able to:
get router info ospf neighbor |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.