Search code examples
iptablesubuntu-serverseafile-serverfail2ban

How to access Seafile server in a virtual machine through IPtables?


I have installed Seafile-server 3.0.4 64bit on a Ubuntu-server 14.04 with default ports settings (i.e. 8000, 8082, 10001, 12001) but fail to access the instance with the client.

Infrastructure

The Ubuntu-server is running as a KVM machine on a Gentoo host.

Iptables rules

After some time I add the following Iptables rules to the host machine (gentoo), that seems to match the Seafile's requirements:

#Iptables-Rules for Seafile
iptables -A INPUT -p tcp -m multiport --dports 8000,8082,10001,12001 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A output -p tcp -m multiport --sports 8000,8082,10001,12001 -m state --state ESTABLISHED -j ACCEPT

However I'm still unable to connect even with telnet to the seafile-server either from Internet or the host machine.

Update: issue might be related to fail2ban


Solution

  • As I'm using NAT to link my virtual machine to my host, I had to edit the rules as follow to get it to work:

    #Iptables-Rules for Seafile
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10001 -j DNAT --to 192.168.8.8:10001
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 12001 -j DNAT --to 192.168.8.8:12001
    

    References