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.
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.
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…
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.
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…
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
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…