Configuring Routers for FTP Server, Port Forwarding and So On – Explanatory Guide

Andrew Johnson
10 Dec 2012

I wrote this out for someone else to help them understand why a router has to be configured if you want to set up an FTP server on your LAN so that it can be accessed externally. I couldn’t find a suitable explanatory guide on the web easily, so I wrote it myself. I may add some links as I feel the need to!

Router Default IP Address and "Default Gateway"

The text below assumes that your router has an IP address of 192.168.2.1 – your router is likely to have a similar default address, such as 192.168.0.1 or 192.168.1.1. As far as a PC or device on your LAN is concerned, your router is the "default gateway" (mentioned below).

General Ideas

1) Internet traffic comes in to your router
2) Your router can be connected to several computers or devices.
3) When an FTP request comes in to your router, the router could forward it to all your computers and devices – but it doesn’t (as it’s not secure to forward it to all devices).
4) You therefore have to tell your router where you want the FTP request to go to… This means:
5) You have to give 1 or more computers attached to your router a specific IP address so that you can tell the router which computer to forward FTP requests to. The router is not smart enough to keep a tally of IP addresses it automatically gives to computers when they first connect to the router and then "just forward FTP to that address". You have to configure these things manually (as I mentioned, partly for security reasons).
6) You need to configure your FTP server computer with a specific IP address, which matches how the router is configured, so that they can communicate properly.
Mostly, routers are pre-configured with their *OWN* IP address – and yours happens to be 192.168.2.1. When you manually configure your computer’s IP address, you need to configure it to have an IP address which has the first 3 bytes the same as the router (192.168.2 I  your router’s case) and the last byte to be any address which is not 1.

TCP/IP Port Assignments

On your computer, there are many processes running which communicate with the internet – FTP, Skype, Web browser, Windows Update, e-mail (send and receive). In most cases, YOUR computer initiates the traffic – sending it to the router first. So, router KNOWS which computer sent the data packet. It can keep track of this internally, so that when the response comes back from the internet, it can be forwarded to the appropriate computer. 
So that e-mail, web, FTP traffic does not get "mixed together", a PORT NUMBER is designated for each process to communicate on – this is an agreed ("ad hoc") standard that has evolved over the last 30 years or so. E.g. the standard port number of requesting web pages is port 80. The standard port for FTP is 21. I think the standard port for POP3 e-mail is either 25 or 110 (can’t remember).

Port Forwarding

For services which are initiated from OUTSIDE your computer – and your own Local Area Network (LAN) – which includes your router, YOU have to TELL the router which computer you want traffic on a given port to be forwarded to (as I started by saying above). For example, you may have 2 computers on your LAN – one is a web server, and the other an FTP server. This means you would configure the router to forward web server incoming traffic (port 80) to one computer and FTP incoming traffic (port 21) to another. See below for more. Most people do not run Web servers or FTP servers (they are "consumers" of information rather than providers…)

Automatically and Manually Assigned IP Addresses 

A "thing" that the router uses is called DHCP "Dynamic Host Control Protocol" – simply, when devices connect to the router, it tells them an IP address to use to communicate with the router/network. You can change the router’s DHCP settings to tell it what address range to allocate to devices (for the last byte – e.g. you could set a range from 192.168.2.2 to 192.168.2.50) . You must then be careful that if you allocate an IP address manually, it does not fall in the range you set for DHCP – this is why I might choose to set the IP address on a laptop to 192.168.2.151 – if a  DHCP range is set from 10 to 100 or something.

Configuring your router

Routers can be configured and accessed by pointing your browser at the router’s preconfigured IP address – in your case 192.168.2.1. Guess what – your router has its own built in web server… It "listens" for traffic on Port 80. This then gives users a familiar way to configure the router itself through its own web interface, rather than using some complicated command line procedure or a special driver or other special software or something (it also saves manufacturers from having to develop this software). 

DNS – Domain Name System or Server

The internet works by having addresses for all computers on it – their IP addresses – and in of itself, it can’t really handle this "www" stuff. So, a system was developed to translate domain names to IP addresses "on the fly". When you reconfigure your computer’s IP address, it needs to know which IP address to go to – to look up these domain names, so that it can translate them into IP addresses (it can’t do this automatically – mainly because domain names are added all the time – and it also allows websites to be moved to different servers, with different IP addresses, but keep the same domain name – entries in the DNS server are updated when the website "moves"). So, certain machines on the internet are designated / set up as Domain Name Servers – and you need to configure the address of at least one of these servers into your computer. In your particular case, your DNS servers were set to 216.46.35.40 and a back up one of 216.46.36.40.
Skype will work without a DNS server, so if you misconfigure your DNS server, Skype will still work for video, voice and text chat, but perhaps not for everything else.
Your router can sometimes be configured as a DNS server – as it can forward a DNS request on your computer’s behalf and return the result, but this doesn’t always seem to work.

Summary

To configure a machine for something like FTP
1) Find out how your router is configured – in most cases, entering 192.168.2.1 or 192.168.1 will bring up the router configuration menu.
2) Find out your router password (often just "admin")
3) Look through the menus to find "DHCP settings" and "Port forwarding" (these are in different places depending on the make and model of router)
4) Check the range set for DHCP addresses and then choose an IP address out side this range to manually assign your IP address.
5) In the "port forwarding" menu, set it so that Port 21 gets forwarded to your chosen IP address, e.g. 151 was what I set.
6) On your PC, configure your network connection to use a fixed IP address such as 192.168.1.151. (When you do this, your machine will probably temporarily disconnect itself from the router and the internet, until the router realises what has happened and everything settles down again.
7) Configure the "default gateway" to be your router’s IP address – 192.168.2.1 in the example above.

Configuring your PC’s IP Address 

Links on this page may help for some versions of Windows and Linux:
Mac OS 10

Related articles...

Comments are closed.