# setting up FTP behind router



## sli4 (Dec 4, 2007)

Hey,
im trying to set up an FTP server so I can access files when im not at home.
Since I have my computer hooked up to a home router I'm not sure how to set up the FTP server/what ip to use since the ip of my computer is only the local ip address through the router - typical 192.168..

im using servu but if anyone has a better program that makes this easier let me know. I did this once before but can't recall how.

winxp sp3 
thanks


----------



## FreeNerd (Sep 16, 2009)

The first thing to do is get your FTP server working on your local network. (i.e. You can connect to your FTP host from another PC in your network and transfer files). Once you can connect inside your local network, you know the FTP part of your setup is done and we can work on port forwarding in your firewall.

---Firewall---
Your router should have a publicly routable IP address. The firewall in your router will restrict traffic from being routed into your private network that is not already Established or Associated to packets that you sent out. So you need a rule to allow new requests on a specific port to be allowed in to the IP address of your FTP server.

The default FTP port is 21, however for your security you do not want to forward port 21 form the public internet to port 21 on your internal FTP server. That is like broadcasting that you have an FTP server up and will invite attacks. You want to use a random high numbered port to forward in, pick a number you can easily remember.

How you set this up will vary based on your router make and model, but the rule should follow the flow of the example below.

Example Rule:
Allow port 46666 in to IP 192.168.1.X on port 21.

Don't forget that when you want to connect from outside your local network, the FTP port you use will be the high number port you configured. I used 46666 in this example but you can use anything you want between 0 through 65535. I would stay above 10000 for random ports.


----------



## sli4 (Dec 4, 2007)

thanks for getting back to me...
So I tried setting up the FTP to connect to locally - I went through the setup wizard and entered the FTP of my computer as the ip address @ port 21.. And when I clicked connect to run the server it says "unable to connect to server 192.168....." And that's it. Is there a different ip I should be putting in? Port 21 is forwarded as far as I can tell within the router settings.


----------



## FreeNerd (Sep 16, 2009)

You need to make a rule in your Windows firewall on your FTP server to allow port 21. Until you have it working locally the port forward won't matter.


----------



## sli4 (Dec 4, 2007)

well the good news is that it works locally. Just got the it all figured out. Now I just don't know if I can connect from somewhere outside of my house.
How do I find the public routable ip?... 
Do I just have to find the main ip and then use that forwarded port (in your example the 46666 port?)?

How do I set it up to forward that port on public and not private?


----------



## sli4 (Dec 4, 2007)

note: there is an option in the forwarding settings to specify a public ip... Am I supposed to do anything with that?
Currently the setting is routed from port 21 into a random port number through the up of my computer (192.168....)
Am I on the right track?


----------



## FreeNerd (Sep 16, 2009)

You can get your public IP address by going to www.whatismyip.com.

You don't want to forward from 21 to a random port. You want to forward from the high numbered port to port 21, a static port mapping that is forwarded into your local servers IP address.

You IP address will change, so if your router supports dynamic DNS I suggest you set it up so you can use a network name to connect and not worry about what your IP changes to each time your router gets a new DHCP IP address.


----------



## alpenadiver (Jul 31, 2007)

You can also go to DynDNS http://www.dyndns.com/ sign up for a Dynamic DNS account create a web address then you can use your FTP server with a dynamic IP, this is what I use for my FreeNAS server.


----------

