Created on
11-29-2019
03:11 AM
Edited on
11-10-2025
06:24 AM
By
Jean-Philippe_P
Description
This article describes how to override default route settings: administrative distance and priority, for the default route received from DHCP.
When on the DHCP WAN interface, if the 'Retrieve default gateway from server' option is enabled as shown below:
Then the DHCP server can send a gateway address with Option 3 (Router) on a DHCP Offer message:


FGT # get router info routing-table all
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Routing table for VRF=0
config router static
edit 1
set distance 3
set priority 25
set device "port1"
set dynamic-gateway enable
next
end
GUI:
From the GUI, when creating a static route, after selecting the DHCP interface under interfaces, it will give an option to select the Dynamic as the gateway address:
With the dynamic gateway option enabled, the static route will update the default gateway by itself whenever there is a change in the default gateway.
Below is the output of the routing table:
FGT # get router info routing-table all
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Routing table for VRF=0
S* 0.0.0.0/0 [3/0] via 192.168.254.254, port1, [25/0]
Solution 2:
Edit distance and priority under the DHCP interface configuration.
config system interface
edit "port1"
set vdom "root"
set mode dhcp
set distance 3
set priority 10
set allowaccess ping https ssh http
set type physical
set snmp-index 1
next
end
Below is the output of the routing table:
FGT # get router info routing-table all
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Routing table for VRF=0
S* 0.0.0.0/0 [3/0] via 192.168.254.254, port1, [10/0]
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.