![将监听地址从 IPv6 更改为 IPv4](https://linux22.com/image/113698/%E5%B0%86%E7%9B%91%E5%90%AC%E5%9C%B0%E5%9D%80%E4%BB%8E%20IPv6%20%E6%9B%B4%E6%94%B9%E4%B8%BA%20IPv4.png)
我使用netstat -plnt
检查vsftpd
守护进程,它正在侦听 IPv6( tcp6
) 地址,因此我使用 FileZilla 无法连接虚拟机。
[root@localhost src]# netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2092/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1537/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1540/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1969/master
tcp6 0 0 :::21 :::* LISTEN 24464/vsftpd
tcp6 0 0 :::22 :::* LISTEN 1537/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1540/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 1969/master
那么,如何将vsftpd
侦听端口更改为 IPv4 ( tcp
)?
答案1
您应该更改vsftpd.conf
应位于的位置/etc/vsftpd.conf
并将 IPv6 选项更新为 NO 并监听为 Yes
listen Yes
listen_ipv6 NO
更多信息在vsftpd 手册页
NAME vsftpd.conf - config file for vsftpd DESCRIPTION vsftpd.conf may be used to control various aspects of vsftpd's behaviour. By default, vsftpd looks for this file at the location /etc/vsftpd.conf. However, you may override this by specifying a command line argument to vsftpd. The command line argument is the pathname of the configuration file for vsftpd. This behaviour is useful because you may wish to use an advanced inetd such as xinetd to launch vsftpd with different configuration files on a per virtual host basis.
监听ipv6
Like the listen parameter, except vsftpd will listen on an IPv6 socket instead of an IPv4 one. This parameter and the listen parameter are mutually exclusive. Default: NO
听
If enabled, vsftpd will run in standalone mode. This means that vsftpd must not be run from an inetd of some kind. Instead, the vsftpd executable is run once directly. vsftpd itself will then take care of listening for and handling incoming connections. Default: NO