The website is not accessible from the local Rostelecom network when accessed through NAT and PPPoE. I have an external IP from Rostelecom, and a PPPoE connection is configured on my PfSense software router. The problem is that the website hosted behind NAT is accessible from any network except the local Rostelecom network in my city. From other Rostelecom cities, the website opens normally. It appears that users from the local Rostelecom network are trying to connect not through the external IP, but as if locally, which causes NAT not to redirect them to the web server. What router settings need to be configured to solve this problem?
NAT loopback (hairpin NAT) - NAT loopback (hairpin NAT) is a classic problem when devices on the same local network, as in your case, cannot access servers hosted behind NAT via an external IP address because traffic doesn’t go through proper routing. To solve this problem in pfSense, there are two main approaches: configuring NAT reflection or using Split DNS.
Contents
- NAT loopback problem and its causes
- Solution 1: Configuring NAT Reflection/Hairpin NAT
- Solution 2: Split DNS (recommended approach)
- Step-by-step setup of NAT reflection in pfSense
- Common problems and their solutions
- Conclusion and recommendations
NAT loopback problem and its causes
NAT loopback (also known as hairpin NAT or NAT reflection) occurs when a device on the local network tries to connect to a server that is in the same network but uses an external IP address instead of an internal one.
In your case, the problem is that users from the Rostelecom local network in your city resolve the domain name to an IP address that can be:
- The external IP address of your connection (if DNS resolves correctly)
- Or the internal IP address of the server (if a local Rostelecom DNS server is used)
When a connection attempt is made through the external IP, pfSense should redirect (reflect) this traffic back to the internal network, but in some cases, this doesn’t work correctly.
Important: As noted in the pfSense documentation, NAT reflection is a kind of “hack” that forces traffic to go through the firewall when it’s technically unnecessary. Therefore, there are limitations in its implementation.
Solution 1: Configuring NAT Reflection/Hairpin NAT
NAT reflection allows internal devices to access servers through an external IP address. In pfSense, there are three NAT reflection modes:
- Use system default - uses system-wide global settings
- Enable - always enables NAT reflection for this rule
- Disable - disables NAT reflection
NAT reflection implementation options:
Method 1: Pure NAT
- Uses only NAT rules in PF to redirect packets
- Doesn’t work with UDP, only TCP
- The source address of traffic from the server’s perspective is the firewall’s IP address
Method 2: NAT + Proxy
- Works through a proxy server
- Supports both TCP and UDP
- Has limitations: ports above 500 are not supported
Method 3: Manual creation of reflection rules
- Requires manual configuration of rules
- More flexible but more complex to set up
Solution 2: Split DNS (recommended approach)
Split DNS is a more elegant and recommended solution for accessing local servers. The essence of this method is that:
Internal and external clients resolve the same domain name to different IP addresses:
- Internal clients → internal IP of the server
- External clients → external IP address
Advantages of Split DNS:
- Preserves the client’s original IP address
- Doesn’t force traffic to go through the firewall unnecessarily
- Works with any protocols (TCP, UDP, ICMP)
- Has no limitations on the number of ports
Step-by-step setup of NAT reflection in pfSense
Step 1: Enabling NAT reflection globally
- Go to
System→Advanced - In the
Networkingsection, findNAT Reflection mode for port forwards - Select
Pure NAT(recommended for modern pfSense versions) - Check
Enable NAT Reflection - Click
Save
Step 2: Configuring port forwarding rule with reflection
-
Go to
Firewall→NAT→Port Forward -
Create or edit a port forwarding rule for your web server
-
In the
NAT Reflectionfield, select:Use system default(if configured globally)- Or
Enableto force enable reflection
-
Ensure the rule includes:
- External interface (WAN)
- External IP address
- External port (80/443)
- Internal IP address of your server
- Internal port (80/443)
Step 3: Setting up Split DNS (alternative approach)
- Go to
Services→DNS Resolver - In the
Host Overridessection, add an entry:Domain: your_site.com Domain Type: A IP Address: internal_IP_of_server Description: Local server access - In the
Forwardingsection, configure:- Internal requests → internal DNS (resolver)
- External requests → external DNS (ISP DNS)
Step 4: Checking firewall rules
Ensure you have appropriate firewall rules that allow access to your server:
- Go to
Firewall→Rules - Check rules for the LAN interface
- Add a rule allowing access to port 80/443 from internal IP addresses
Common problems and their solutions
Problem 1: NAT reflection doesn’t work
Possible causes:
- Incorrect NAT reflection mode
- Conflict with firewall rules
- Port number limitations
Solution:
- Check NAT reflection settings in port forwarding rules
- Ensure firewall rules allow the traffic
- Try switching to
NAT + ProxyorPure NATmode
Problem 2: Sites only open by IP but not by domain
Possible causes:
- Incorrect DNS configuration
- DNS caching on client devices
Solution:
- Set up Split DNS as described above
- Clear DNS cache on client devices
- Check domain name resolution using
nslookup
Problem 3: Slow website performance from local network
Possible causes:
- Additional traffic passing through the firewall
- pfSense CPU load
Solution:
- Use Split DNS instead of NAT reflection
- Optimize firewall rules
- Consider using more powerful hardware
Problem 4: HTTPS certificate errors
Possible causes:
- IP address mismatch in certificate
- Issues with SNI (Server Name Indication)
Solution:
- Use a wildcard certificate for your domain
- Configure correct Host headers in port forwarding rules
- Consider using an ACME client for automatic certificate renewal
Conclusion and recommendations
-
For your case with Rostelecom, it’s recommended to start with setting up Split DNS, as it’s a more reliable solution that doesn’t force traffic to go through the firewall unnecessarily.
-
If Split DNS isn’t suitable, use NAT reflection in Pure NAT mode, which works better in modern pfSense versions and has fewer limitations.
-
Always check firewall rules after setting up NAT reflection to ensure traffic is properly allowed.
-
For complex scenarios with multiple WAN interfaces or VLANs, manual configuration of reflection rules may be required.
-
Monitor performance of pfSense with active NAT reflection, as this creates additional load on the system.
The solution to your problem depends on the specific network configuration and requirements, but the approaches described should help ensure access to your servers from both local and external networks.
Sources
- NAT Reflection | pfSense Documentation
- Troubleshooting NAT Reflection | pfSense Documentation
- Accessing Port Forwards from Local Networks | pfSense Documentation
- pfSense: A Guide to NAT, Firewall Rules and some Networking 101
- NAT Reflection vs Split DNS Argument - Reddit
- Configure pfSense from LAN to WAN to LAN - Super User
- NAT loopback/hairpin mode between VLAN’s - Netgate Forum