Community discussions

MikroTik App
 
pospanko
Member Candidate
Member Candidate
Topic Author
Posts: 279
Joined: Sun Dec 18, 2005 4:23 pm

netmap to /23 or /22

Tue Sep 20, 2022 7:46 pm

Hi guys.

Is it possible to netmap 100.64.0.0/10 to X.X.X.X/23 or /22 in one rule?
Thanks
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: netmap to /23 or /22

Tue Sep 20, 2022 7:49 pm

Did you want to write that you have two IP pools, a /22 and a /23
and you want to use them as a source for a CGNAT that uses 100.64.0.0/10 ???

It is more logical than the reverse(²)…
 
pospanko
Member Candidate
Member Candidate
Topic Author
Posts: 279
Joined: Sun Dec 18, 2005 4:23 pm

Re: netmap to /23 or /22

Tue Sep 20, 2022 8:11 pm

I was wondering if MT can evenyl distribute 100.64.0.0/10 to 1024 addresses so I don't need to make multiple rules:
Example:
chain=srcnat src-address=100.64.0.0/10 action=netmap to-addresses=192.168.0.0/22

If it can't I need to write it like:
chain=srcnat src-address=100.64.0.0/24 action=netmap to-addresses=192.168.0.0/24
chain=srcnat src-address=100.64.1.0/24 action=netmap to-addresses=192.168.1.0/24
chain=srcnat src-address=100.64.2.0/24 action=netmap to-addresses=192.168.2.0/24
chain=srcnat src-address=100.64.3.0/24 action=netmap to-addresses=192.168.3.0/24
chain=srcnat src-address=100.64.4.0/24 action=netmap to-addresses=192.168.0.0/24
etc...

I was hoping that MT can do it for me this way :)
 
sindy
Forum Guru
Forum Guru
Posts: 10205
Joined: Mon Dec 04, 2017 9:19 pm

Re: netmap to /23 or /22

Tue Sep 20, 2022 8:40 pm

netmap has a precise meaning - it is a substitution of one prefix by another of the same length and keeping the suffix unchanged. If you want to src-nat (or dst-nat) one range of addresses to another range, you can use a standard src-nat action:

src-address=100.64.0.0/10 action=src-nat to-addresses=192.168.0.0/22

This rule will assign addresses from 192.168.0.0 to 192.168.3.255 as reply-dst addresses, using some distribution rule unknown to me. There is also the same action that should assign always the same reply-dst address to a connection from a given source address.

Who is online

Users browsing this forum: Ahrefs [Bot], Energizer, johnson73, straightslant and 80 guests