Community discussions

MUM Europe 2020
 
Lucky Phil
just joined
Topic Author
Posts: 16
Joined: Sun Sep 24, 2006 2:08 pm
Location: Australia

Dynamic DNS - FTP Server

Sun Oct 01, 2006 1:13 am

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
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Sun Oct 01, 2006 5:10 am

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
 
Lucky Phil
just joined
Topic Author
Posts: 16
Joined: Sun Sep 24, 2006 2:08 pm
Location: Australia

Sun Oct 01, 2006 7:34 am

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
 
User avatar
GWISA
Member
Member
Posts: 394
Joined: Tue Jan 31, 2006 2:37 pm
Location: Johannesburg, South Africa

Mon Oct 02, 2006 1:32 am

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...
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Mon Oct 02, 2006 4:09 am

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
 
User avatar
GWISA
Member
Member
Posts: 394
Joined: Tue Jan 31, 2006 2:37 pm
Location: Johannesburg, South Africa

Mon Oct 02, 2006 11:55 am

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?
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Mon Oct 02, 2006 6:46 pm

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
 
User avatar
GWISA
Member
Member
Posts: 394
Joined: Tue Jan 31, 2006 2:37 pm
Location: Johannesburg, South Africa

Mon Oct 02, 2006 11:24 pm

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

;)
 
changeip
Forum Guru
Forum Guru
Posts: 3804
Joined: Fri May 28, 2004 5:22 pm

Tue Oct 03, 2006 12:02 am

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
 
User avatar
GWISA
Member
Member
Posts: 394
Joined: Tue Jan 31, 2006 2:37 pm
Location: Johannesburg, South Africa

Tue Oct 03, 2006 1:16 am

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

;)

ah well...
 
Lucky Phil
just joined
Topic Author
Posts: 16
Joined: Sun Sep 24, 2006 2:08 pm
Location: Australia

Tue Oct 03, 2006 11:36 am

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
 
User avatar
GWISA
Member
Member
Posts: 394
Joined: Tue Jan 31, 2006 2:37 pm
Location: Johannesburg, South Africa

Tue Oct 03, 2006 1:11 pm

:twisted:

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!
 
Lucky Phil
just joined
Topic Author
Posts: 16
Joined: Sun Sep 24, 2006 2:08 pm
Location: Australia

Thu Oct 05, 2006 1:49 pm

Thanks everyone for you input have it working now.

Philip

Who is online

Users browsing this forum: No registered users and 88 guests