Community discussions

MikroTik App
 
jack2k
just joined
Topic Author
Posts: 7
Joined: Fri Oct 20, 2017 5:01 pm

NAT Pool with afinity

Sun May 26, 2024 3:24 am

Hello, I'm running some NAT rules to nat private users IPs within a public nat pool, about 16 Ips.
I guess and I hope, if there is any way to avoid changing public IP "randomly", and keep a stable mapping based on source ip, to prevent users from getting different public IPs in each outgoing packet. This behavior leads to problems with some web applications/games.

Here's my nat rule:
chain=srcnat action=src-nat to-addresses=****/28 src-address=10.49.251.0/25
 
User avatar
loloski
Member
Member
Posts: 420
Joined: Mon Mar 15, 2021 9:10 pm

Re: NAT Pool with afinity

Sun May 26, 2024 3:49 am

use netmap instead of src-nat it will work
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11114
Joined: Mon Dec 04, 2017 9:19 pm

Re: NAT Pool with afinity

Sun May 26, 2024 10:45 am

Just a remark, nat acts per connection, not per packet, so all packets belonging to the same connection (e.g. a TCP session) will have the same public address even with action=src-nat. But as @loloski wrote, action=netmap will make sure that all connections from a given private address will be src-nated to the same public address.
 
jack2k
just joined
Topic Author
Posts: 7
Joined: Fri Oct 20, 2017 5:01 pm

Re: NAT Pool with afinity

Sun May 26, 2024 4:09 pm

Thank you I'll investigate netmap.
Best regards!

Who is online

Users browsing this forum: ahmet82, CGGXANNX and 27 guests