Community discussions

MikroTik App
 
jopper
just joined
Topic Author
Posts: 1
Joined: Thu Jan 26, 2023 12:25 am

Can't seem to get 1:1 NAT working

Wed Feb 07, 2024 2:52 am

I have my network 10.0.30.0/24 in a vlan. DHCP is working and machines do have internet connectivity.

I want that network to use a specific IP address on ingress and egress

/ip address
add address=10.0.30.1/24 interface=RED_VLAN network=10.0.30.0
add address=[static ip 1]/29 interface=ether1 network=[static ip network]
add address=[static ip 2]/29 interface=ether1 network=[static ip network]

/ip firewall nat
add action=dst-nat chain=dstnat dst-address=[static ip 2] \
to-addresses=10.0.30.0/24
add action=src-nat chain=srcnat src-address=10.0.30.0/24 \
to-addresses=[static IP 2]

If I curl to whatismyip, it will not return the static address I assigned in the nat rules. It will only return [static ip 1]

I have tried assigning the to-address as individual endpoints as well to see if I could get it to use [static ip 2] to no avail.

Any ideas? What am I missing here?
 
DarkNate
Forum Guru
Forum Guru
Posts: 1017
Joined: Fri Jun 26, 2020 4:37 pm

Re: Can't seem to get 1:1 NAT working

Wed Feb 07, 2024 4:42 am

Use netmap for consistency all around, see the example here:
viewtopic.php?t=176358
 
User avatar
nichky
Forum Guru
Forum Guru
Posts: 1281
Joined: Tue Jun 23, 2015 2:35 pm

Re: Can't seem to get 1:1 NAT working

Wed Feb 07, 2024 6:05 am

e.g.

R1
/ip nat
add action=netmap chain=dstnat src-address=192.168.2.0/24 to-addresses=192.168.10.0/24
add action=netmap chain=srcnat dst-address=192.168.2.0/24 src-address=192.168.10.0/24 to-addresses=192.168.1.0/24

/ip route
add dst-address=192.168.2.0/24 gw=gw

Who is online

Users browsing this forum: No registered users and 2 guests