Introduction#
This lab publishes a DMZ server on a different TCP port. The external client connects to 198.51.100.10:8443, and FortiGate forwards the connection to 10.20.20.10:443. The DMZ server sees the original client IP, 203.0.113.10.
Central DNAT uses an enabled virtual IP (VIP) to define the translation. A separate firewall policy permits the client to reach the mapped server and service. Fortinet Central DNAT guide
Lab Environment#
The client uses 203.0.113.1 on the Internet Router as its gateway. The DMZ server uses 10.20.20.1 on FortiGate port5 so its replies return through the firewall.
| Component | Lab configuration |
|---|---|
| External client | Win7-External, 203.0.113.10, address object EXT-HOST |
| Incoming interface | port3 at 198.51.100.2/24, zone Z-WAN1, facing ISP-1 at 198.51.100.1 |
| ISP transit | ISP-1 172.16.1.1/30 and Internet Router 172.16.1.2/30 |
| Published endpoint | 198.51.100.10:8443, VIP VIP-WAN1-WEB |
| Outgoing interface | port5, zone Z-DMZ, address 10.20.20.1/24 |
| DMZ server | 10.20.20.10/24, address object DMZ-WEB, TCP listener on port 443 |
| Firewall policy | WAN1-DMZ-WEB, ID 110 |

Figure 1. The inbound test follows WAN1 to the DMZ. FortiGate maps the published TCP port 8443 to port 443 on the server.
On ISP-1, route 203.0.113.0/24 through 172.16.1.2. On the Internet Router, route 198.51.100.0/24 through 172.16.1.1. The second route sends connections to the public VIP toward WAN1.
FortiGate Setup
On the lab FortiGate, configure the interfaces, zones, return route, and address objects below. In the GUI, use Network → Interfaces, Network → Static Routes, and Policy & Objects → Addresses. Enable Central SNAT in System → Settings to use Central NAT mode for this lab. FortiOS Central SNAT settings
1config system interface
2 edit "port3"
3 set mode static
4 set ip 198.51.100.2 255.255.255.0
5 next
6 edit "port5"
7 set mode static
8 set ip 10.20.20.1 255.255.255.0
9 next
10end
11
12config system zone
13 edit "Z-WAN1"
14 set interface "port3"
15 next
16 edit "Z-DMZ"
17 set interface "port5"
18 next
19end
20
21config router static
22 edit 0
23 set dst 203.0.113.0 255.255.255.0
24 set gateway 198.51.100.1
25 set device "port3"
26 next
27end
28
29config firewall address
30 edit "EXT-HOST"
31 set subnet 203.0.113.10 255.255.255.255
32 next
33 edit "DMZ-WEB"
34 set subnet 10.20.20.10 255.255.255.255
35 next
36end
37
38config system settings
39 set central-nat enable
40endConfigure Central DNAT#
The GUI and CLI below show two ways to configure the same VIP and firewall policy.
Virtual IP
VIP in the GUI
Go to Policy & Objects → DNAT & Virtual IPs and create an IPv4 DNAT entry.
| Setting | Value |
|---|---|
| Name | VIP-WAN1-WEB |
| Status | Enabled |
| Interface | any |
| Source interface filter | port3 |
| Type | Static NAT |
| External IP address | 198.51.100.10 |
| Map to IPv4 address | 10.20.20.10 |
| Port Forwarding | Enabled, TCP, One to one |
| External service port | 8443 |
| Map to IPv4 port | 443 |
The Interface field is set to any, and the Source interface filter limits the VIP to traffic arriving on port3.

Figure 2. VIP-WAN1-WEB maps the WAN1 endpoint to the DMZ server.
VIP in the CLI
1config firewall vip
2 edit "VIP-WAN1-WEB"
3 set extip 198.51.100.10
4 set mappedip "10.20.20.10"
5 set extintf "any"
6 set srcintf-filter "port3"
7 set portforward enable
8 set protocol tcp
9 set extport 8443
10 set mappedport 443
11 set status enable
12 next
13endFirewall Policy
Firewall Policy in the GUI
Go to Policy & Objects → Firewall Policy and create a policy named WAN1-DMZ-WEB. Set the destination to the mapped address object DMZ-WEB and select HTTPS for TCP port 443. The client still connects to TCP port 8443 on the VIP.
| Setting | Value |
|---|---|
| Incoming and outgoing zones | Z-WAN1 → Z-DMZ |
| Source | EXT-HOST (203.0.113.10/32) |
| Destination | DMZ-WEB (10.20.20.10/32) |
| Schedule | always |
| Service | HTTPS (TCP 443) |
| Action | ACCEPT |
| Log Allowed Traffic | All Sessions |

Figure 3. Firewall policy WAN1-DMZ-WEB allows the translated connection.
Firewall Policy in the CLI
The CLI below creates WAN1-DMZ-WEB with policy ID 110, using the zones and address objects defined above. For a policy created in the GUI, find WAN1-DMZ-WEB in show firewall policy to identify its assigned ID.
1config firewall policy
2 edit 110
3 set name "WAN1-DMZ-WEB"
4 set srcintf "Z-WAN1"
5 set dstintf "Z-DMZ"
6 set srcaddr "EXT-HOST"
7 set dstaddr "DMZ-WEB"
8 set action accept
9 set schedule "always"
10 set service "HTTPS"
11 set logtraffic all
12 set status enable
13 next
14endTest the Published Port#
Start the iperf3 listener on the DMZ server. The test sends iperf3 traffic over TCP. The HTTPS service object matches the translated port, and the lab uses a plain TCP listener.
1sudo iperf3 -s -p 443Start the packet capture on the FortiGate before connecting:
1diagnose sniffer packet any '(host 203.0.113.10 or host 10.20.20.10) and tcp' 4 40 lRun the test from Win7-External:
1iperf3.exe -c 198.51.100.10 -p 8443 -t 10The Win7 client completed the test, and the DMZ server reported 3.00 MBytes received. The original run used source port 1033 for the iperf3 control connection and 1034 for the data connection.

Figure 4. Win7-External connects to TCP port 8443 and completes the transfer.
Verify the Translation#
The FortiGate sniffer recorded the SYN and SYN-ACK for data connection 1034 on both interfaces. The client IP and source port stayed the same on the way to the DMZ. On the return path, FortiGate restored the VIP address and published port as the reply source.
| Capture point | Source | Destination |
|---|---|---|
SYN enters port3 | 203.0.113.10:1034 | 198.51.100.10:8443 |
SYN leaves port5 | 203.0.113.10:1034 | 10.20.20.10:443 |
SYN-ACK enters port5 | 10.20.20.10:443 | 203.0.113.10:1034 |
SYN-ACK leaves port3 | 198.51.100.10:8443 | 203.0.113.10:1034 |

Figure 5. The four capture points show the request destination changing on ingress and the reply leaving WAN1 with the VIP as its source.
Forward Traffic Log
The forward traffic list shows the iperf3 control connection on source port 1033 and the data connection on 1034. Both entries show destination NAT to 10.20.20.10:443 through port5 under policy 110.

Figure 6. The forward traffic list shows both connections from the iperf3 test.
Open Log Details for source port 1034 to see NAT Translation: Destination, NAT IP: 10.20.20.10, NAT Port: 443, and policy 110. The log records TCP reset from server at session closure. The packet capture shows the handshake, and the iperf3 results confirm that data reached the server before the session ended.

Figure 7. The log for the data connection identifies the translated destination and matched policy.
Inspect an Active Session
To see the translation while a test runs, prepare these filters in a second FortiGate console:
1diagnose sys session filter clear
2diagnose sys session filter src 203.0.113.10
3diagnose sys session filter proto 6
4diagnose sys session filter policy 110While iperf3 is transferring data, run diagnose sys session list. After saving the output, run diagnose sys session filter clear. Fortinet session table guide
A repeat test produced this session entry on source port 1038:
1hook=pre dir=org act=dnat 203.0.113.10:1038->198.51.100.10:8443(10.20.20.10:443)
2hook=post dir=reply act=snat 10.20.20.10:443->203.0.113.10:1038(198.51.100.10:8443)The first line shows the destination mapping. The reply line uses act=snat because FortiGate rewrites the reply's source from the DMZ server address and port back to the VIP address and port. This is the reverse translation of the original DNAT.
Troubleshooting#
| What you see | What to check |
|---|---|
No SYN arrives on port3 | Check that the upstream device can deliver traffic for 198.51.100.10 to WAN1. |
SYN arrives on port3 and no SYN leaves port5 | Check VIP status, the port3 filter, and the policy's source, mapped destination, and TCP service. |
SYN leaves port5 and no reply returns | Check the DMZ listener on TCP 443, the server firewall, and the gateway 10.20.20.1. |