Answer the question
In order to leave comments, you need to log in
How to open access to FTP on OpenWRT from the Internet?
Greetings.
Such a seemingly simple task, but for some reason I can not do it.
There is a Xiaomi R3P router on OpenWRT 19.07.3 firmware r11063-85e04e9f46 with vsftpd 3.0.3-3 installed.
Everything works fine on the local network, but my task is to open access to the flash drive via FTP outside the local network.
I'm not an expert on setting up iptables, but I managed to forward ports to local devices, but I can't open a port on the router itself. For some reason, only 21 ports open through port forwarding, 20 is shown closed. Through "Firewall - Traffic Rules" for some reason, the ports do not open for me at all, although as I understand it, in this case, you need to configure this tab.
If you enable port 21 forwarding to a router with a local address, then in active mode the client connects to the server for a very long time and eventually sees an empty folder.
vsftpd.conf file:
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
session_support=NO
local_root=/mnt/sda1
listen_port=21
config rule
option src 'wan'
option name 'FTP'
option target 'ACCEPT'
option src_port '20-21'
option family 'ipv4'
list proto 'tcp'
Answer the question
In order to leave comments, you need to log in
In general, I solved the issue as follows, it turned out that by default for requests with wan to "reject" (not to the local network), there is a ban on incoming connections. Setting on the main page of the firewall, if you allow requests - everything works. Even in traffic rules, the port does not need to be opened, apparently the nat-helper package is working or the port is taken from the vsftpd config. Passive mode works just fine too.
The question remains only whether such a setting will affect security.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question