Community discussions

MikroTik App
 
laurenettaieb91
just joined
Topic Author
Posts: 7
Joined: Sat Dec 31, 2022 3:41 pm

Question about NAT Virtual Address

Sat Dec 09, 2023 10:51 pm

Hi Forum,
I'm struggling to implement the following:
I have multiple web app on my NAS. Each of them is using a different port.
I'm trying to create virtual IP addresses outside of the dnspool and then redirect each IP address/port 80 to each app (i.e. sam IP address / unique port).
I have created both the IP address (outside of the pool) in the address list menu and attached it to an unused Ethernet port (not to the bridge) and then created a DNSNAT rule to redirect from virtual address/port 80 to NAS Address/true application port.
The log shows traffic when I'm using the browser to the virtual IP address but the browser doesn't provide any web page.
Any idea or have it done the wrong way ?
Thanks
Laurent
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11621
Joined: Thu Mar 03, 2016 10:23 pm

Re: Question about NAT Virtual Address

Sun Dec 10, 2023 11:31 am

If your browsing PC is in same IP subnet as actual server (IP address on router, used as NAT intermediate, doesn't matter), then you have to implement hairpin NAT. Either use official docs or search this forum to get an idea of what and how.
 
laurenettaieb91
just joined
Topic Author
Posts: 7
Joined: Sat Dec 31, 2022 3:41 pm

Re: Question about NAT Virtual Address

Sun Dec 10, 2023 4:54 pm

Yes, it is indeed.
Thanks for pointing into the right direction.
Laurent
 
laurenettaieb91
just joined
Topic Author
Posts: 7
Joined: Sat Dec 31, 2022 3:41 pm

Re: Question about NAT Virtual Address

Tue Dec 12, 2023 12:05 am

In fact, I'm unsure this is truly what I'm looking for.
My sole objective is to have specific url pointing to the same IP address but with different ports.
I'm using Synology DNS server and obviously my mikrotik router is pointing to the Synology DNS server for LAN address resolution.
But there is no record type I can use to achieve my objective like:

application A , url: applA.personal_domain -> Internal IP, Port X
application B, url appl B.personal_domain -> Internal IP, Port Y

I have tried to have a specific virtual IP address for Application A and for Application B and then use DNS Hairpin to redirect to Internal IP, Port X and do the same for Application B.

Unsure, what would be the best method.

If someone has encountered the same issue or requirement.
 
optio
Long time Member
Long time Member
Posts: 673
Joined: Mon Dec 26, 2022 2:57 pm

Re: Question about NAT Virtual Address

Tue Dec 12, 2023 5:41 pm

My sole objective is to have specific url pointing to the same IP address but with different ports.
You need some reverse proxy for this, like Nginx. Create hairpin nat for reverse proxy http service and configure it redirect traffic by host name to specific webapp ip:port.
 
laurenettaieb91
just joined
Topic Author
Posts: 7
Joined: Sat Dec 31, 2022 3:41 pm

Re: Question about NAT Virtual Address

Thu Dec 14, 2023 12:26 am

Thanks Optio.
I'll check the documentation

Who is online

Users browsing this forum: evellin, lostb1t, rolling, sid5632 and 61 guests