Dynamic DNS - FTP Server

I am trying to access my FTP Server from the outside world but my ISP changes my real IP Address when there is an outage or I have a power blackout. I have a dstnat rule added but have to put my current IP Address in the (destination address) it after it changes. Is there a way for it to be changed automatically for me.

I am running MikroTik RouterOS 2.9.29, my FTP Server changes its ip automatically with a dns updater.

Thanks

Do not use dst-address, only use in-interface. This will mean ‘anything’ coming into your wan port on port X, no matter what the current IP is.

Sam

Just tried that and it didn’t work, I then put ip address back in aswell but still didn’t work untill I took out in interface.
Philip

You can register with the dyndns.com service, get a dns name with them and then use the

[:resolve www.yourdnsname.com]

command instead of the IP address in a scheduled script to set your dst-nat rule…

Seriously, don’t specify the IP…

add chain=dstnat in-interface=MYCABLEMODEM protocol=tcp src-port=20-21
action=dst-nat to-addresses=10.20.1.2 to-ports=0-65535 comment=“EXAMPLE PORT 20-21 for FTP”
disabled=no

If you don’t specify the IP, how will you ever dst-nat?

I understand the question as how to put the IP of the dst-nat address to redirect to…

am I wrong?

Leaving the ip address out of the filter will force anything coming into that interface to be dst-natted … if you have a single IP or 8 ips, anything coming to any of them will use those rules.

Sam

I think the question is referring to a different field than the one you are…

Are you talking about the dst-address field as found in the ‘General’ tab in winbox, while I am indicating the dst-nat address in the action=dst-nat to-addresses=10.20.1.2…?

add chain=dstnat in-interface=MYCABLEMODEM protocol=tcp src-port=20-21
action=dst-nat to-addresses=10.20.1.2 to-ports=0-65535 comment=“EXAMPLE PORT 20-21 for FTP”
disabled=no

sure, and then add

/system script
add name="resolve-ip" source="ip firewall nat set EXAMPLE \
PORT 20-21 for FTP to-addresses=[:resolve yourdns.homedns.org]"
/
/system scheduler
add name="resolve-ip" on-event=resolve-ip start-date=jan/01/1970 \
    start-time=05:00:00 interval=12h comment="" disabled=no 
/

This will check, resolve and reset your IP in the dst-nat rule at whatever interval you specify from whatever your dyndns registered name is - and voila! Automatic IP address-changing…

Surely that’s what you meant…

:wink:

I am trying to access my FTP Server from the outside world but my ISP changes my real IP Address when there is an outage or I have a power blackout.

LuckyPhil said he didn’t want to have to change his IP address on the dst-address of the dst-nat rule everytime it changes. Well, leaving it out will solve that. No need for a script in this case, just don’t specify it and it will automatically apply that rule to incoming traffic.

Sam

I thought he said:

I am trying to access my FTP Server from the outside world

and

Is there a way for it to be changed automatically for me.

and

my FTP Server changes its ip automatically with a dns updater

so I assumed he was using something like dyndns and connecting to his FTP by a dns name to a dynamic ip… and trying to get the MT to accomplish this automatically…

:wink:

ah well…

Gwisa,

Thats it exactly, I have a dyndns that updates by itself but if i’m on the outside and don’t know that my ip has changed I can’t access the ftp.
By having mt find the ip and change it in the dstnat rule or something would be great.
Philip

:smiling_imp:

Told you so!

Just follow my instructions above with the [:resolve yourdyndns.homedns.org] command…

Take note that the only way you can refer to a (for e.g.) NAT rule is by the Comment - so if you comment your NAT rule as ‘resolve-dyndns’ then you’ll use ‘resolve-dyndns’ instead of the ‘EXAMPLE PORT 20-21 for FTP’ etc etc comment above…

cheers!

Thanks everyone for you input have it working now.

Philip