vsftp IPv4、IPv6 Support


vsftp IPv4、IPv6 Support
OS:Oracle Enterprise Linux 6.2 64bit

安裝 vsftpd,放入光碟。
    # mount /dev/cdrom /media
    # cd /media/Server/Pageages/
    # rpm -ivh vsftpd-2.2.2-6.el6_0.1.x86_64.rpm

根據以下的說明,想要IPv4與IPv6共存的話,必須使用兩個設定檔,listen與listen_ipv6只能啟用一個。
    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.
    This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
    sockets, you must run two copies of vsftpd with two configuration files.
    Make sure, that one of the listen options is commented !!

複製vsftpd.conf
    # cp /etc/vsftpd/vsftpd.conf  /etc/vsftpd/vsftpd_ipv6.conf

修改 /etc/vsftpd/vsftpd_ipv6.conf,將 listen=YES 改為 listen_ipv6=YES

現在我們有兩個設定檔,vsftpd.conf、vsftpd_ipv6.conf:
    vsftpd.conf  -->  listen=YES
vsftpd_ipv6.conf -->  listen_ipv6=YES

重新啟用 vsftpd :
    # service vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
    Starting vsftpd for vsftpd:                                [  OK  ]
    Starting vsftpd for vsftpd_ipv6:                           [  OK  ]

測試:
    # ftp 127.0.0.1
    Connected to 127.0.0.1 (127.0.0.1).
    220 (vsFTPd 2.2.2)
    Name (127.0.0.1:root):

    ftp ::1
    Connected to ::1 (::1).
    220 (vsFTPd 2.2.2)
    Name (::1:root):

::1 是一個特殊IP,其功能與 127.0.0.1一樣

剛開始測試時,IPv6的FTP一直無法連線成功,後來發現是ip6tables的緣故:
    iptables  --> IPv4
ip6tables --> IPv6
    將它關閉之後就可以正常登入:
# service ip6tables stop

Windows 11安裝時跳過網路連線