0

Sorry for the long question.

What it means is this: I am managing a small LAN that is protected by a router.

router     192.168.1.1
server     192.168.1.9
client     192.168.1.2
client     192.168.1.4

Since I have a static IP from my ISP, which is lets say 245.34.344.34, I can access my LAN at that address.

Now, I have set up my router's port forwarding config to this: when I SSH to 245.34.344.34 out from the internet, it forwards it to server 192.168.1.9:22. And when I FTP to 245.34.344.34, forwards it to client 192.168.1.2:21. Fine.

Then, when I am working from within the LAN, on my client 192.168.1.2 computer and that I want to access 192.168.1.9 through FTP, the router tries to forward it back to 192.168.1.2. But I am not sure what is happening.

On server 192.168.1.9 (which runs ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-47-generic i686), when I sudo ufw status:

To                         Action      From
--                         ------      ----
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
22                         ALLOW       Anywhere
3000                       ALLOW       Anywhere
21/tcp                     ALLOW       Anywhere
21                         ALLOW       Anywhere
80 (v6)                    ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)
3000 (v6)                  ALLOW       Anywhere (v6)
21/tcp (v6)                ALLOW       Anywhere (v6)
21 (v6)                    ALLOW       Anywhere (v6)

But if I do nmap localhost:

PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
631/tcp  open  ipp
3306/tcp open  mysql

Now on client 192.168.1.2, nmap 192.168.1.9:

PORT     STATE  SERVICE
21/tcp   closed ftp
22/tcp   open   ssh
80/tcp   open   http
443/tcp  closed https
3000/tcp closed ppp

It shows that the server's port 21 is closed.

I don't get it. Must be something obvious...

Can someone please help me understand how to reach my server through FTP from within the LAN?

Thanks

5
  • Can you explain this line: "And when I FTP to 245.34.344.34, forwards it to client 192.168.1.2:21. Fine.". It supposed to be forwarded to your ftp server and not client, or am I missing something? – Diamond Jan 27 '16 at 19:10
  • In which server is your ftp server running? Inside LAN your traffic wont be going through router, if you are using the LAN ip to access it, so you should be able to connect to it directly. What is the output of netstat -nltp | grep :21 inside the ftp server? – Diamond Jan 27 '16 at 19:20
  • @bengal I am correct, from outside i want to SSH to server and FTP to client. – Jeanmichel Cote Jan 27 '16 at 19:24
  • Oh, I have to be running an FTP server? It is not enough to just open port 21? The 192.168.1.2 client is running mac and the 192.168.1.9 server, Ubuntu. And I am using Filezilla on the client to FTP to the ubuntu server. – Jeanmichel Cote Jan 27 '16 at 19:25
  • Ok, you were right. I've just apt-get install vsftpd and I can now connect to the server with Filezilla. Thanks! – Jeanmichel Cote Jan 27 '16 at 19:29
0

First of all, inside LAN your traffic won't be routed through the router, when you are accessing the server with it's LAN IP address. This is a traffic inside the LAN, and you will be connected directly without port forwarding need.

Secondly, bot ftp client, but ftp server runs on port 21. So if you want to connect to the FTP server, then there should actually be a FTP server running on the server, which listens on port 21 and allows connections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.