How to nat local dynamic IP addresses

Is there any way to forward ports into local dynamic IP-s?
for example, how to forward port 8291 to a routerboard
which gets dynamic ip address from PPPoE?
further more, how to make routes to dynamic IP-s?

/ip firewall nat
add chain=dst-nat dst-address=80.70.xx.xx protocol=tcp port=8291 action=dst-nat
to-addresses= (dynamic IP Address)
/ip route
add dst-address=192.168.1.0/24 gateway=(dynamic IP address)

Thank you, Toni

not ideal for dynamic IP. i also found this question, until now still haven’t get it! -.-|

here have very professor person can help u…

AOA
i think is not possible

au contraire…

You CAN do this, but it’s not quite like was originally asked. Try this for an option:

On the CLIENT (the router you want to do NAT for) do this:

/interface bridge add name=loopbackiface
/ip address add interface=loopbackiface address=10.10.10.10/32

This will create a null bridge and add an IP to it
Then, on the server, set up the pppoe secret like:

/ppp secret add name=test password=testpw routes=10.10.10.10

Now, just do your NAT so that it points to the 10.10.10.10 address, with no need to manually add the route since ppp server will do it for you. :slight_smile:

AOA
butche
10.10.10.10 address is dynamic IP ???
i think is manual!
Post subject: How to nat local dynamic IP addresses

You are correct in this statement, however, the “problem” is in how to create a NAT to a device that has a dynamic address., which the posted solution does. If you want, I can create for you a script that WILL create this NAT to an actual dynamic IP address, but THAT is not a “free” solution.

Post subject: How to nat local dynamic IP addresses

Read the post to see the original question. The question pertained to dynamic IP addresses, but the “problem” that needed to be solved is solved by my solution.

Hi Caci99

I am not sure how you have this set up. Is the challenge just the device needs dhcp rather than setting a static IP? If the device that provides the dhcp server service is a MikroTik box, you can make a dynamic lease a static lease. It is still dhcp, but It always gets the same IP. Then you can point stuff at it. I do this with network printers. Would that help?

He (she?) said it’s pppoe. Either way, the solution I posted is one I’ve used for various situations and it does work. Your solution works for the purpose you stated (printers, computers, etc). He could, also, set static IPs for the pppoe account, but if he wants to keep it dynamic, then my solution works.

AOA
butche u r right
good idea

not working for this command?

/ip address add interface=loopbackiface address=10.10.10.10/32

You have to create the bridge named “loopbackiface” first.