Community discussions

MikroTik App
 
anwaar
just joined
Topic Author
Posts: 3
Joined: Tue Oct 19, 2021 11:56 am

Hairpin not working with PPPoe (static WAN)

Tue Oct 19, 2021 12:47 pm

Hi,
I have been to countless mikrotik forums and also watched youtube videos to implement hairpin NAT. But no luck with loopback.

I have a webserver running on 10.10.10.193:5050 which is accessible via LAN.
To access the webserver from WAN, I created a NAT rule in firewall to forward incoming traffic from my public static IP address (let's say 1.1.1.1:5050) to 10.10.10.193:5050.
/ip firewall nat add action=dst-nat chain=dstnat comment="web server port" dst-address=\
    1.1.1.1 dst-port=5050 log=yes log-prefix=\
    "webserver-prod-" protocol=tcp to-addresses=10.10.10.193 to-ports=5050
After above rule, I was able to hit the webserver from WAN -> 1.1.1.1:5050 from outside the network.
But due to hairpin issue, I cannot access web server from my LAN IP using public IP

To address this, I created two new rules
/ip firewall nat
add action=masquerade chain=srcnat comment="hairpin - same srcnat" \
    dst-address=10.10.10.0/24 log=yes log-prefix="hairpin-masq" \
    src-address=10.10.10.0/24
add action=masquerade chain=srcnat comment="hairpin nat" \
    src-address=10.10.10.0/24 log=yes log-prefix="hairpin-masq" \
    out-interface=pppoe-out1
The above two rules are at the top in NAT rules list. (see https://clb.sh/dfdbcf)

Interface list. (see https://clb.sh/edeb0a)

Address list (https://clb.sh/016a1c)

*All blue entries are my public IP address.

any help would be greatly appreciated

Please let me know if you need any info or screenshots.
 
anwaar
just joined
Topic Author
Posts: 3
Joined: Tue Oct 19, 2021 11:56 am

Re: Hairpin not working with PPPoe (static WAN)

Wed Oct 20, 2021 1:33 pm

How much time normally it takes to approve the post?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19112
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Hairpin not working with PPPoe (static WAN)  [SOLVED]

Thu Oct 21, 2021 4:14 pm

This link should provide some inspiration. Post back if still having issues.
viewtopic.php?t=179343

Also when you post back with isssues unresolved ensure you post the entire config.
/export hide-sensitive file-anynameyouwish
 
anwaar
just joined
Topic Author
Posts: 3
Joined: Tue Oct 19, 2021 11:56 am

Re: Hairpin not working with PPPoe (static WAN)

Fri Oct 22, 2021 9:44 am

Hi anav,

Thank you for your answer. I have been following your posts lately and did try the solution. At first, it didn't work. Perhaps, due to other settings that I had in router. But after resetting configuration and adding the same rules again (with correct order) it's working now.

Once again, thank you for the response. :)

Who is online

Users browsing this forum: baragoon and 55 guests