>_nexthopreachable

JNCIS-ENT + NSE4: From Firewall to ISP

Ali Bahadır Coşkun10 min read

Labbing firewalls has always felt like practicing goalkeeping with no one shooting. You can build HA, write policies, enable UTM profiles, but until something actually tries to traverse the box, you're configuring in the dark. There's no equivalent of show ospf neighbor that tells you everything is healthy. A firewall either blocks something it shouldn't, permits something it shouldn't, or sits there doing nothing while you wonder if your policy order is correct. The verification loop is thin: ping passes, ping doesn't pass, session table has an entry or it doesn't. That's about it. The FortiGate HA pair is in this topology because NSE4 is next after JNCIS-ENT, and I wanted both exams covered in a single lab. This article covers the FortiGate perimeter and R3 as the simulated ISP.

WHERE THE FORTIGATE SITS

The FortiGate HA pair sits between the enterprise core (R1, R2) and R3, the simulated ISP. R1, R2, and the FortiGate share a /29 segment on the inside (10.1.2.0/29). On the outside, the FortiGate connects directly to R3 on a /30 (203.0.113.0/30). The FortiGate is not a BGP speaker. R1 peers eBGP with R3, and the FortiGate's job is to pass that TCP/179 session through without NAT while source-NAT'ing everything else. It also runs OSPF on the inside segment to redistribute a default route into the enterprise.

HA: FGCP ACTIVE-PASSIVE

FortiGate Clustering Protocol (FGCP) synchronizes configuration and session state between two units. One unit is active and processes all traffic. The passive unit monitors heartbeats and takes over if the active unit fails or if a monitored interface goes down. The key difference from VRRP or similar L3 redundancy: FGCP synchronizes the entire configuration and optionally the session table, so the failover is stateful. Established TCP sessions survive the switchover.

Navigate to System > HA on FGT1.

Set the mode to Active-Passive, device priority to 200 (higher wins, so FGT1 becomes the active unit), group name to ENTERPRISE-HA, and group ID to 1. The heartbeat interface is port3. Enable Session pickup so that established sessions survive failover. Enable Override so FGT1 reclaims the active role after recovery, similar to VRRP preempt. Under port monitoring, add port1 and port2. If either goes down on the active unit, the FortiGate triggers a failover.

FGT2 gets the same settings except priority 100 and a different management IP on port4. After both units boot with matching group-name, group-id, and password, the cluster forms over port3. FGT1 becomes active (priority 200 vs 100), and all config changes made on FGT1 automatically sync to FGT2.

The override setting is important for the exam. Without it, once FGT2 takes over as active, it stays active even after FGT1 recovers. With override enabled, FGT1 reclaims active status when it comes back.

HA management interfaces let you reach the passive unit directly for troubleshooting. Under System > HA > HA Management Interface, assign port4 with a unique IP per unit: 192.168.100.1 for FGT1, 192.168.100.2 for FGT2. These addresses are not synchronized.

To verify the cluster, use the CLI since there's no single GUI view that shows everything:

text
FGT1 # get system ha statusHA Health Status: OKModel: FortiGate-VM64Mode: HA A-PGroup: 1Master: FGT1, Prio: 200Slave:  FGT2, Prio: 100

Both units visible, FGT1 is master. If the slave doesn't appear, check that port3 is cabled directly between the two units and that the group-name, group-id, and password match exactly.

INTERFACES

Navigate to Network > Interfaces and configure each of the four ports.

port1 is the WAN interface toward R3. Set the IP to 203.0.113.1/30, role to WAN.

port2 is the LAN inside interface toward R1 and R2. IP 10.1.2.1/29, role LAN.

port3 is the HA heartbeat link. Alias: HA-HEARTBEAT. This interface is automatically configured during the HA setup.

port4 is out-of-band management. IP 192.168.100.1/24 on FGT1, 192.168.100.2/24 on FGT2.

STATIC ROUTES

Navigate to Network > Static Routes and create three entries.

The first route is the default: destination 0.0.0.0/0, gateway 203.0.113.2 (R3), interface port1. This sends all internet-bound traffic toward the ISP.

The second route covers the enterprise: destination 10.0.0.0/8, gateway 10.1.2.5 (R1), interface port2. This ensures that the FortiGate can reach enterprise destinations even if the OSPF adjacency drops.

The third route is for the branch LAN: destination 192.168.4.0/24, gateway 10.1.2.6 (R2), interface port2. Branch traffic from the internet side needs to reach R2 directly rather than routing through R1 first.

OSPF

The FortiGate participates in OSPF area 0 on the inside segment. Its primary job: originate a default route into the enterprise so R1 and R2 know to send internet-bound traffic toward the firewall.

text
config router ospf    set router-id 10.1.2.1    set default-information-originate enable    set default-information-metric 10    set default-information-metric-type 2    config area        edit 0.0.0.0        next    end    config network        edit 1            set prefix 10.1.2.0 255.255.255.248            set area 0.0.0.0        next    end    config redistribute "static"        set status enable        set metric 20        set metric-type 2    endend

default-information-originate injects 0.0.0.0/0 as a Type 5 External LSA into OSPF. Metric type 2 means the metric stays fixed regardless of the internal cost to reach the FortiGate. The network statement activates OSPF on port2 (the 10.1.2.0/29 segment). The redistribute static block pushes the FortiGate's static routes (enterprise summary, branch LAN) into OSPF as externals.

From R1, verify the FortiGate appears as a neighbor:

text
root@R1> show ospf neighborAddress          Interface     State     ID               Pri  Dead10.1.1.2         ge-0/0/0.0    Full      10.0.0.2         128    3710.1.2.1         ge-0/0/2.0    Full      10.1.2.1         1      33

The 10.1.2.1 neighbor is the FortiGate. Full state, area 0.

FIREWALL POLICIES

We have to configure three policies. Navigate to Policy & Objects > Firewall Policy. The FortiGate evaluates policies top-down and uses the first match, so the sequence is critical.

Policy 1: BGP Transit

R1 peers eBGP with R3. The TCP/179 session originates from R1's inside IP (10.1.2.5) toward R3 (203.0.113.2). This traffic must pass through the FortiGate without NAT. If the FortiGate source-NATs this session, R3 sees the connection coming from 203.0.113.1 (the FortiGate's WAN IP) instead of 10.1.2.5, and the BGP session fails because R3 expects its peer at 10.1.2.5.

Create a new policy at the top of the list:

  • Name: BGP-TRANSIT
  • Incoming interface: port2
  • Outgoing interface: port1
  • Source: R1
  • Destination: R3
  • Service: BGP
  • Action: Accept
  • NAT: Disabled
  • Log: All sessions

Policy 2: Enterprise to Internet

Everything else from the enterprise going outbound gets source-NAT'd to the FortiGate's WAN IP (203.0.113.1). This is standard overload PAT.

  • Name: ENTERPRISE-TO-INTERNET
  • Incoming interface: port2
  • Outgoing interface: port1
  • Source: SUMMARY
  • Destination: all
  • Service: ALL
  • Action: Accept
  • NAT: Enabled (use outgoing interface address)
  • Log: All sessions

Every enterprise host that hits this policy exits the FortiGate as 203.0.113.1. R3 sees all enterprise traffic coming from a single IP.

Policy 3: Inbound Test (Disabled)

A narrow inbound rule permitting ICMP from R3 to R1's inside IP. Disabled by default.

  • Name: INBOUND-TEST-DISABLED
  • Status: Disabled
  • Incoming interface: port1
  • Outgoing interface: port2
  • Source: R3-BGP-PEER
  • Destination: R1-INSIDE-IP
  • Service: PING
  • Action: Accept
  • Log: All sessions

The implicit deny at the bottom of the policy table handles all other inbound traffic. This rule exists to verify inbound reachability from the ISP side when needed. Toggle the status to Enabled in the policy list when you need it. A broadly permissive inbound accept is not a production pattern and shouldn't become a habit, even in a lab.

VERIFYING THE FORTIGATE

The GUI logs show matched policies and NAT translations, but for detailed session inspection the CLI is faster. Filter the session table and list:

text
FGT1 # diagnose sys session filter dport 179FGT1 # diagnose sys session listsession info: proto=6 proto_state=01 duration=3842 expire=3597 timeout=3600    policy=1 id=12345 dir=org act=accept    src=10.1.2.5:54321 dst=203.0.113.2:179    nat=no

policy=1 confirms the BGP session matched the BGP transit policy. nat=no confirms it's not being NAT'd. proto_state=01 indicates an established TCP connection.

For NAT'd enterprise traffic:

text
FGT1 # diagnose sys session filter src 10.10.10.100FGT1 # diagnose sys session listsession info: proto=1 proto_state=00 duration=2 expire=58 timeout=60    policy=2 id=12346 dir=org act=accept    src=10.10.10.100:8 dst=8.8.8.1:0    src_nat=203.0.113.1:12345

policy=2 and src_nat=203.0.113.1 confirm the traffic hit the NAT policy and translated correctly.

To test HA failover, start a continuous ping from R1 to 8.8.8.1, then force failover on the active unit:

text
FGT1 # diagnose sys ha reset-uptime

FGT2 takes over. You should see at most one or two dropped packets if session pickup is working. After FGT1 recovers, it reclaims active status because override is enabled.

R3: THE SIMULATED ISP

R3 is a vMX acting as a simple ISP. One interface toward the FortiGate, a loopback with 8.8.8.1/24 to simulate an internet destination, and eBGP peering with R1 through the firewall.

junos
set interfaces ge-0/0/0 description WAN-to-FGT-outsideset interfaces ge-0/0/0 unit 0 family inet address 203.0.113.2/30set interfaces lo0 unit 0 family inet address 10.0.0.3/32set interfaces lo0 unit 0 family inet address 8.8.8.1/24

The loopback carries two addresses. 10.0.0.3/32 is the router-id, and 8.8.8.1/24 is a fake internet prefix that R3 advertises to R1 via eBGP. When R1 or any enterprise host pings 8.8.8.1, R3 answers from this loopback.

R3 needs a static route to reach R1's peering address (10.1.2.5) through the FortiGate, and a discard route for the default it advertises:

junos
set routing-options router-id 10.0.0.3set routing-options autonomous-system 65100set routing-options static route 0.0.0.0/0 discardset routing-options static route 10.1.2.0/29 next-hop 203.0.113.1

The discard default exists solely to make the route active in R3's table so the export policy can advertise it. Without a route in the table, the export policy has nothing to match. The static to 10.1.2.0/29 via 203.0.113.1 (the FortiGate WAN IP) provides reachability to R1's inside address.

eBGP

junos
set protocols bgp group EBGP type externalset protocols bgp group EBGP multihop ttl 2set protocols bgp group EBGP local-address 203.0.113.2set protocols bgp group EBGP import ISP-IMPORTset protocols bgp group EBGP export ISP-EXPORTset protocols bgp group EBGP peer-as 65001set protocols bgp group EBGP neighbor 10.1.2.5

Multihop with TTL 2 because the FortiGate sits in the path between R3 and R1. Local-address is R3's directly connected WAN IP. The neighbor is R1's inside address (10.1.2.5), not a loopback, because there's no IGP between R3 and R1 to resolve loopback reachability.

The export policy sends two things: the 8.8.8.0/24 prefix (from the loopback) and the default route (from the discard static):

junos
set policy-options policy-statement ISP-EXPORT term internet from protocol directset policy-options policy-statement ISP-EXPORT term internet from route-filter 8.8.8.0/24 exactset policy-options policy-statement ISP-EXPORT term internet then acceptset policy-options policy-statement ISP-EXPORT term default from protocol staticset policy-options policy-statement ISP-EXPORT term default from route-filter 0.0.0.0/0 exactset policy-options policy-statement ISP-EXPORT term default then acceptset policy-options policy-statement ISP-EXPORT term reject then reject

The import policy accepts R1's enterprise aggregate and rejects everything else:

junos
set policy-options policy-statement ISP-IMPORT term enterprise from route-filter 10.0.0.0/8 orlongerset policy-options policy-statement ISP-IMPORT term enterprise then acceptset policy-options policy-statement ISP-IMPORT term reject then reject

The orlonger match accepts the /8 aggregate and any more-specific prefixes R1 might accidentally leak. In production, an ISP would use strict prefix-list filtering. Here it's permissive because R1's export policy already limits what it sends.

THAT'S IT!

Three articles, one topology. The switches handle L2, the routers handle L3 and tunneling, and the FortiGate sits in the middle passing BGP and NAT'ing everything else. That covers most of the JNCIS-ENT and NSE4 blueprint in a single lab. What it doesn't cover is the exam questions that start with "a network administrator reports that..." and end with four answers that all look correct. That part is between you and the practice tests. Next step is actually passing the exams.