NAT
In WinBox you can configure NAT in IP -> Firewall -> NAT, or you can use terminal with command /ip firewall nat
NAT is essential for sharing internet connections and providing services through port forwarding while maintaining network security.
NAT fundamentals
How NAT works
NAT types:
Source NAT (SRCNAT) - Modifies source addresses (typically for internet access)
Destination NAT (DSTNAT) - Modifies destination addresses (port forwarding, load balancing)
Masquerade - Special SRCNAT for dynamic IP addresses
Redirect - Redirects packets to local services
NAT processing:
DSTNAT chain - Processed before routing decision
Routing - Determine packet destination
SRCNAT chain - Processed after routing decision
Connection tracking - Maintains connection state for return traffic
Connection tracking states
Basic internet sharing (Masquerade)
Simple masquerade setup
Most common NAT configuration for sharing internet:
Masquerade with specific networks
Control which networks can access internet:
Port forwarding (DSTNAT)
Basic port forwarding
Forward external ports to internal services:
Port forwarding with specific source
Limit port forwarding to specific source addresses:
Range port forwarding
Forward port ranges for applications:
Advanced NAT scenarios
Load balancing with NAT
Distribute connections across multiple servers:
Conditional NAT with packet marks
Use mangle marks for conditional NAT:
Hair-pin NAT (NAT loopback)
Allow internal access to services using external IP:
Multi-WAN NAT scenarios
Dual WAN with policy routing
NAT configuration for multiple internet connections:
Failover NAT configuration
Primary/backup WAN setup with NAT:
NAT for VPN and tunnels
NAT with OpenVPN
Configure NAT for OpenVPN clients:
NAT with site-to-site VPN
Configure NAT for site-to-site connections:
Source NAT (SRCNAT) advanced
Source NAT to specific addresses
Use specific source addresses instead of masquerade:
Policy-based source NAT
Different source NAT based on destination:
Redirect and local NAT
Redirect to local services
Redirect traffic to router services:
Captive portal NAT
NAT rules for captive portal implementations:
Monitoring and troubleshooting NAT
Monitor NAT rules
Debug NAT issues
Performance monitoring
NAT best practices
Performance optimization
Security considerations
Common NAT scenarios
Home office setup
Branch office with central services
Troubleshooting checklist
Common NAT issues
Port forwarding not working
Check firewall filter rules
Verify NAT rule order
Confirm destination server is accessible
Test from external source
Internet access issues
Verify masquerade interface
Check default route
Confirm DNS configuration
Test with direct IP addresses
Hair-pin NAT problems
Add both DSTNAT and SRCNAT rules
Check internal routing
Verify address lists
Test from correct source networks
Performance issues
Enable FastTrack
Optimize rule order
Monitor connection table
Check hardware capabilities
Last updated
Was this helpful?