Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi everybody
i have a problem with my ftp server
i have two network my Lan network 172.16.1.0/24 and external 192.168.1.0/24
my firewall server has 2 card eth0:172.16.1.1 and eth1 192.168.1.150
after i configured my ftp server with NAT-IN help external can access to my FTP server ip:172.16.1.10/24.i realize that My Lan can access to My FTP server but external client cann't access to my FTP server.
this is my rules on iptables
iptables –t nat –A PREROUTING –d 192.168.1.150 –i eth1 –p tcp –m tcp –dport 20 –j DNAT –to-destination 172.16.1.10:20
iptables –t nat –A PREROUTING –d 192.168.1.150 –i eth1 –p tcp –m tcp –dport 21 –j DNAT –to-destination 172.16.1.10:21
i also configure natin for webserver and mailserver.External can access but ftp then external cann't established port
i hope that everybody can help me resovle my problem thank a lot.
You only need to specify the forwarding of port 21. The other port(s) get picked up by the RELATED match. In any case, the port 20 rule you have wouldn't be the cause of this problem, so lets set that aside for now. How are you handling the packets in your FORWARD chain? What about SNAT/MASQUERADE in the POSTROUTING chain? Basically, you'd want something like this (example):
Code:
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -p TCP -i eth1 -o eth0 --dport 21 -d 172.16.1.10 -m state --state NEW -j ACCEPT
iptables -t nat -A PREROUTING -p TCP -i eth1 --dport 21 -j DNAT --to-destination 172.16.1.10
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Of course, make sure you have routing enabled and the FTP connection tracking module loaded:
thank you a lot but after i configured,external client access to my FTP Server then appear authentication dialog and i type user and pass.
but i wait 10s then appear error 425 falied for established connection hic.i use netstat -ano |grep 21 then realize Establish but port 20 then LIST.
My Lan access ftp OK but external then failed
Sorry, instead of ip_conntrack_ftp, the module I should have suggested is ip_nat_ftp, as this is a router. I think you'll be okay once you load it. If not, add a LOG rule to show us what the filtered packet looks like when the 425 happens.
thank you a lot and i'm very sorry because i'm a newbie so i don't know way to add LOG rule with iptables.
the host-based firewall on the server isn't blame because external client can access webserver and mailserver but only FTP not.you can help me add LOG rule with my iptables.
the host-based firewall on the server isn't blame because external client can access webserver and mailserver but only FTP not.
Well, technically, the host-based firewall could be configured to allow FTP only from the LAN (for example), while allowing WAN connections for everything else. That said, if you're sure the problem isn't on the server, then I'm out of ideas because the iptables setup on the router looks okay to me.
Quote:
you can help me add LOG rule with my iptables.
Typically you'd add a rule like this to the end of your FORWARD chain:
Code:
iptables -A FORWARD -j LOG --log-prefix "FORWARD DROP: "
...but since your FORWARD policy isn't set to DROP this wouldn't work. In fact, you aren't really using the FORWARD chain at all, as your first FORWARD rule sends all packets to another chain (RH-Firewall-1-INPUT), where they will get sent to REJECT if they don't match any of the rules. So I'd say stick the LOG rule right before the REJECT rule in that chain. Like:
Code:
iptables -A RH-Firewall-1-INPUT -j LOG --log-prefix "RH-Firewall-1-INPUT REJECT: "
thank you again.This's my vsftpd.conf.You can see.i'm not sure that i configure right or wrong.
i dont know detail to configure to external client can access My FTP server.
Quote:
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=FTP cua ftp.hmcuong.com
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
anon_root=/hmcuong
I was referring to iptables rules (and TCP wrapper) on the server, not the FTP daemon configuration. Did you add the LOG rule on the router? What shows up when the 425 happens? Please post the relevant log file snippet. The reason I keep asking for this is because it's a way to know with decent certainty whether the problem is on the router or not. I recommend you see this through before looking at other things.
oh i don't know sorry.i have a idea.If you can,we can use Teamview so you can understand my problem clearly.Because my level of linux's not good.so there's a lot of knowdelge i can't understand what you teach me.if you don't bother can you help me?
i use Vmware build my network.This's my lab before i do an exam at university
my nick chat (Yahoo): hmcuongth06
thank for your help.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.