Hello everyone,
first off, this is not a "this doesn't work, help me fix it"-thread. It works. My question is: why?
In detail: I wanted to set up an ftp server (vsftpd, port 21 for ftp-control, 40000 to 40100 for passive ftp). With nf_conntrack loaded, I modified my iptables as follows:
Code:
iptables -I INPUT -p tcp --dport 21 -j ACCEPT
iptables -I INPUT -p tcp -m mutliport --dports 40000:40100 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp -m mutliport --sports 40000:40100 -m state --state RELATED,ESTABLISHED -j ACCEPT
All chain policies are set to DROP.
Now, when I connect to port 21 (using an ftp client and passive mode) from a different host, /proc/net/nf_conntrack confirms that the connection is established:
Code:
ipv4 2 tcp 6 431991 ESTABLISHED src=10.0.52.1 dst=10.0.62.100 sport=57359 dport=21 packets=9 bytes=508 src=10.0.62.100 dst=10.0.52.1 sport=21 dport=57359 packets=6 bytes=465 [ASSURED] mark=0 secmark=0 use=1
However, when i try to get data/listings, the connection hangs. netstat confirms a passive port on the server is open, but the client can't connect. Why can't he connect? Shouldn't this connection be considered RELATED?
The problem is fixed entirely when i load the nf_conntrack_ftp module. The only iptables rule needed is the --dport 21 rule in the INPUT chain.
What does the nf_conntrack_ftp module do differently then applying similar rules than the ones I issued to iptables above?
Thanks in advance,
Chris