Don't forget to always configure the inside and outside interfaces.
Static NAT:
Maps one private IP to one public IP.
ip nat inside source static 192.168.1.2 203.0.113.5
Dynamic NAT:
Maps a private IP range to a public IP pool.
ip nat pool NAT_POOL 203.0.113.10 203.0.113.20 netmask 255.255.255.0 access-list 1 permit 192.168.1.0 0.0.0.255 ip nat inside source list 1 pool NAT_POOL
PAT (Port Address Translation):
Maps multiple private IP addresses to a single public IP address.
access-list 1 permit 192.168.1.0 0.0.0.255 ip nat inside source list 1 interface FastEthernet0/2 overload
Hairpin NAT:
Allows internal devices to access the public IP and reach an internal server.
ip nat inside source static 192.168.1.2 203.0.113.5 80 extendable ip nat inside source list NAT-Hairpin interface FastEthernet0/2 overload
3. FortiGate
Static NAT:
Maps a private IP to a specific public IP.
config firewall vip edit "Static-NAT-Example" set extip 203.0.113.5 set mappedip 192.168.1.2 end
Dynamic NAT:
Uses a pool of public IPs to map to private IP addresses.
config firewall ippool edit "pool1" set startip 203.0.113.10 set endip 203.0.113.20 set netmask 255.255.255.0 set overload disable end
config firewall policy config firewall policy edit 1 set srcintf "lan1" set dstintf "wan1" set srcaddr "all" set dstaddr "all" set schedule "always" set service "ALL" set nat enable set action accept set ippool enable set poolname "pool1" end
PAT (Masquerading):
Maps many private IPs to a single public IP.
config firewall policy edit 1 set srcintf "lan1" set dstintf "wan1" set srcaddr "all" set dstaddr "all" set schedule "always" set service "ALL" set nat enable set action accept end
Hairpin NAT:
Allows internal clients to access an internal resource using the external IP.
config firewall vip edit "Hairpin-NAT" set extip 203.0.113.5 set mappedip 192.168.1.2 set portforward enable set extport 80 set mappedport 80 end
config firewall policy edit 1 set name "Hairpin-NAT-Policy" set srcintf "lan1" set dstintf "lan1" set srcaddr "all" set dstaddr "Hairpin-NAT" set schedule "always" set service "HTTP" (you can adjust) set nat disable set action accept end
Conclusion:
MikroTik: Configurations are relatively simple with masquerade for dynamic NAT and PAT, and it supports Hairpin NAT with a few straightforward commands.
Cisco: Offers powerful flexibility but requires more detailed configuration, including access lists for Hairpin NAT.
FortiGate: Easy to manage through the GUI or CLI with structured configuration for both static and dynamic NAT, as well as Hairpin NAT