How to make port forwarding for dynamic IPs?

Hello @ all,

I need to make a port forwarding for using an ip-cam. The problem is, that the user logs in with hotspot and not has a static IP. And at the other side I have a dynamic public IP.

How I have to make the rules in dnat for this case?

I read the wiki and some topics here, but every time they have rules with staic IPs.

PPPoE works at a RB 333 and the user connects with wlan-hotspot at a RB 435. The UM works at a RB 800. All used software is ROS 5.14.

Saludos

Uli

If i understand correctly what you want, then you don’t need to dnat a certain ip you can do it on an interface:

Ex: for RDP where Ether1 is the internet connection port and 10.124.175.5 is the private ip you can change Ether1 with the name of your pppoe connection or what interface you have.

/ip firewall nat
add action=dst-nat chain=dstnat disabled=no dst-port=3389 in-interface=Ether1
protocol=tcp to-addresses=10.124.175.5 to-ports=3389

Hello w4rh0und,

thank you for your answer. Hmm, but I do not understand what you mean with

10.124.175.5 is the private ip

There are no static IPs. The user logs in by hotspot and may get another IP every time. May be I have to make a binding?

Regards

Uli

If the private ip that you get from the hotspot is different everytime, you might try to make a dhcp reservation for that ip, to bind it so you get the same private ip address everytime on that host based on mac addess.


From the mikrotik the command to make static is:

/ip dhcp-server lease make-static

You need the private ip address to be static, you need an address to where to forward the port.

Thank you for your help. I will do so.

Saludos