Page 1 of 1

Public IP NAT Rule Issue

Posted: Sat Sep 21, 2024 11:36 pm
by davidolaj
Hello,

I want to assign one of my WAN IPs (public IPs) to my User and I have configured my Router as below but still not working;

NAT Rule
------------
Chain: srcnat
src-address: 192.168.100.20 (private ip)

Action: netmap
To Addresses: 301.102.XX.20 (public ip)

Note! The 301.102.XX.20 already added to WAN-Ethernet in Address list.

The User WAN IP not change to the assigned Public IP.

How do I make the assigned Public IP work for the User?

Re: Public IP NAT Rule Issue

Posted: Sat Sep 21, 2024 11:39 pm
by Kanta
use action src-nat, not netmap.

Re: Public IP NAT Rule Issue

Posted: Sun Sep 22, 2024 12:01 am
by davidolaj
Action changed to "src-nat" and still the same problem... user WAN IP not change to the 301.102.XX.20

Re: Public IP NAT Rule Issue

Posted: Sun Sep 22, 2024 12:05 am
by Kanta
ip 301.102.XX.20 is not a valid one, you can't change it to that. src-nat is the correct action, check the order of other nat rules and move the new one up on top.

Re: Public IP NAT Rule Issue

Posted: Sun Sep 22, 2024 12:22 am
by davidolaj
IP 301.102.XX.20 is just a sample here... I'm using valid public IP.

Yes, I understand that the rule is correct but is not working on my router, I don't understand what could be the problem.

Even the action netmap should work, if not the problem.

MikroTk Guru Guys, please help out!!

Re: Public IP NAT Rule Issue

Posted: Sun Sep 22, 2024 9:27 am
by mkx
What about order of NAT rules? They are evaluated from top to bottom, first one matching executes.

Re: Public IP NAT Rule Issue

Posted: Sun Sep 22, 2024 2:25 pm
by davidolaj
What about order of NAT rules? They are evaluated from top to bottom, first one matching executes.
Attached images here are my settings...

The advertised network IP not route in the route list...

Re: Public IP NAT Rule Issue

Posted: Mon Sep 23, 2024 8:19 am
by mkx
You have two rules in srcnat chain. The screenshots don't show all the gory details, but ... masquerade rule is higher than "normal" src-nat rule. If masquerade rule selection rules match the packets which src-nat rule is supposed to act on, then masquerade rule will do it's job and src-nat rule won't get evaluated (and executed).

If you're unsure about it, create text export of NAT section, and copy-paste them here (execute /ip/firewall/nat/export to show NAT rules only in full detail).

Re: Public IP NAT Rule Issue

Posted: Mon Sep 23, 2024 11:55 am
by davidolaj
What about order of NAT rules? They are evaluated from top to bottom, first one matching executes.
I moved the src-nat rule to top and now working perfectly.

Thanks.