Can't connect on local network

Need help with FileZilla Server? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
dmirandaf
500 Command not understood
Posts: 3
Joined: 2021-06-21 15:56
First name: David
Last name: Miranda

Can't connect on local network

#1 Post by dmirandaf » 2021-06-21 16:11

Hello!

I have this problem: I'm setting up a server on my local ip 192.168.0.231. I can login via cmd from other computers on my local network no problem, I can see the files an get them, same with a remote computer (in a remote network via my public IP, ports en my router are open). But when I try to login from my local network via my public IP, I can't connect, gives me timeout error. I tried unchecking the "Don't use external IP for local connections" option with no luck. Every other option is on their default setting (excep for the "use the following ip" where I put my public ip)

Any help will be appreciated. Thanks!

User avatar
boco
Contributor
Posts: 25592
Joined: 2006-05-01 03:28
Location: Germany

Re: Can't connect on local network

#2 Post by boco » 2021-06-21 16:58

Simple answer: The public IP will not work (or work incorrectly) from inside the LAN, it is only valid for connections from the outside (as the public IP is assigned to your router). The commandline FTP client sends PORT commands including its LAN address, all data connections happen in pure LAN.

For reaching your FTP server in the LAN, you must use its LAN address (and the "Don't use external IP for local connections" must be checked). The computer LAN name may also work.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###

dmirandaf
500 Command not understood
Posts: 3
Joined: 2021-06-21 15:56
First name: David
Last name: Miranda

Re: Can't connect on local network

#3 Post by dmirandaf » 2021-06-21 18:47

boco wrote:
2021-06-21 16:58
Simple answer: The public IP will not work (or work incorrectly) from inside the LAN, it is only valid for connections from the outside (as the public IP is assigned to your router). The commandline FTP client sends PORT commands including its LAN address, all data connections happen in pure LAN.

For reaching your FTP server in the LAN, you must use its LAN address (and the "Don't use external IP for local connections" must be checked). The computer LAN name may also work.
Got it. Im trying to make a script that copies some files from this server into the local machine (Who executes the cmd file), whether this machine is in the LAN or out. Any ideas?
(I'm pretty noob on ftp so please bear with me😬)

Thanks!

User avatar
boco
Contributor
Posts: 25592
Joined: 2006-05-01 03:28
Location: Germany

Re: Can't connect on local network

#4 Post by boco » 2021-06-21 21:52

It's not so simple when dealing with NAT. What I would do is probing the FTP server before starting script operations.

Put a certain flag file (can be empty) in the FTP server root (so it is reachable from the client script). Try to give it a name fairly random, to minimize the chance of hitting a foreign server with the same file in the root by accident.

From the script, try to login and retrieve that file by using the LAN IP. If that succeeds, you can be almost 100% certain that you are in your LAN. In that case, continue using the LAN IP to get your files.
If the access via LAN IP fails, you are not in your LAN (or something else is wrong). In that case, repeat the probing with the public IP. If successful, get your files over the public network. Be aware that using plain FTP over public networks is dangerous.
Throw an error if both probing attempts fail.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###

dmirandaf
500 Command not understood
Posts: 3
Joined: 2021-06-21 15:56
First name: David
Last name: Miranda

Re: Can't connect on local network

#5 Post by dmirandaf » 2021-06-21 21:59

boco wrote:
2021-06-21 21:52
It's not so simple when dealing with NAT. What I would do is probing the FTP server before starting script operations.

Put a certain flag file (can be empty) in the FTP server root (so it is reachable from the client script). Try to give it a name fairly random, to minimize the chance of hitting a foreign server with the same file in the root by accident.

From the script, try to login and retrieve that file by using the LAN IP. If that succeeds, you can be almost 100% certain that you are in your LAN. In that case, continue using the LAN IP to get your files.
If the access via LAN IP fails, you are not in your LAN (or something else is wrong). In that case, repeat the probing with the public IP. If successful, get your files over the public network. Be aware that using plain FTP over public networks is dangerous.
Throw an error if both probing attempts fail.
Nice, that's an elegant solution. Will try that. I was thinking of a ping that on failure makes the script default to the public ip connection. But that logic fails if there's another server or machine with the same hostname or local ip (on the remote Lan) than the one I'm trying to reach.

Thank you!

User avatar
boco
Contributor
Posts: 25592
Joined: 2006-05-01 03:28
Location: Germany

Re: Can't connect on local network

#6 Post by boco » 2021-06-21 23:30

The problem is that LAN IP ranges are not unique. Traditionally, almost every LAN from a customer router uses IPs from the 192.168.0.0/16 range. Simply, just having a 192.168.x.y address does not mean anything, as other LANs probably use them, too.

Public IPs are unique, but often not static. Using a dynamic DNS provider (which will give you a URL pointing to your public IP) can get around that. Many routers support dynamic DNS settings and can update the IP stored on the DNS providers' server, whenever it changes.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###

Post Reply