I need to make NAT hairpinning work and I’m no networking expert. All my past routers just had a checkbox, here I have guides, forum posts, even stack exchange questions. None of that helped me achieve the goal.
For example, the very command suggested in the official guide:
note how I replaced “out-interface=LAN” with “out-interface-list=LAN” because “out-interface” does not accept “LAN” as a value. I also tried to set “lan-interface=bridge” without success.
I also replaced the IPs with my actual ones. 192.168.254.20 is the server in question. It works when I connect to it from outside my home (e.g. 4G connection)
How exactly does one go about setting up hairpin NAT?
ip firewall nat add chain=srcnat action=masquerade dst-address=192.168.254.0/24 src-address=192.168.254.0/24
It doesn’t have any effect. Even if I add logging to the rule, no logs are generated. I moved it to the top of NAT rules, moved it to the bottom, no effect.
What’s even worse: this router has nigh same configuration than the office router and in office, hairpinning works without any intervention (there are no such rules defined), while at home I just can’t get it to work.
Ah. So if I want this to work, actually, I still need to implement the (A) point (I have a fixed static IP). Sorry, I took the “All solutions work” sentence too eagerly and didn’t understand that solution 1 wasn’t just that one entry.
I will try this, just for the heck of it, but ultimately I think I’m just going to create the DNS entry for the server in question. Looks easier and more straight-forward. It’s only one server.
And I also think I know why everything works in the office: we have a telecom router in between and it is likely the one thing doing the hairpinning…