我在尝试将一个文件夹挂载到 CentOS 服务器上时遇到问题,该文件夹是从另一台 CentOS 服务器共享的。
我按照以下选项 2 进行设置https://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/
我成功地在 Windows 上挂载了共享,所以我认为托管服务器上没有防火墙问题。
我尝试使用 autofs 挂载它,这是我的配置:
winbox -fstype=cifs,rw,noperm,user=USERNAME,pass=PASSWORD ://MYIPADDRESS/Share
当我尝试通过 cd 进入相关文件夹时,我的日志中出现以下内容:
Sep 19 00:29:35 Base automount[28600]: handle_packet: type = 3
Sep 19 00:29:35 Base automount[28600]: handle_packet_missing_indirect: token 76, name winbox, request pid 24536
Sep 19 00:29:35 Base automount[28600]: attempting to mount entry /mymountfolder/winbox
Sep 19 00:29:35 Base automount[28600]: lookup_mount: lookup(file): looking up winbox
Sep 19 00:29:35 Base automount[28600]: lookup_mount: lookup(file): winbox -> -fstype=cifs,rw,noperm,user=USERNAME,pass=PASSWORD ://MYIPADDRESS/Share
Sep 19 00:29:35 Base automount[28600]: parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,noperm,user=USERNAME,pass=PASSWORD ://MYIPADDRESS/Share
Sep 19 00:29:35 Base automount[28600]: parse_mount: parse(sun): gathered options: fstype=cifs,rw,noperm,user=USERNAME,pass=PASSWORD
Sep 19 00:29:35 Base automount[28600]: parse_mount: parse(sun): dequote("://MYIPADDRESS/Share") -> ://MYIPADDRESS/Share
Sep 19 00:29:35 Base automount[28600]: parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,noperm,user=USERNAME,pass=PASSWORD, loc=://MYIPADDRESS/Share
Sep 19 00:29:35 Base automount[28600]: sun_mount: parse(sun): mounting root /mymountfolder, mountpoint winbox, what //MYIPADDRESS/Share, fstype cifs, options rw,noperm,user=USERNAME,pass=PASSWORD
Sep 19 00:29:35 Base automount[28600]: do_mount: //MYIPADDRESS/Share /mymountfolder/winbox type cifs options rw,noperm,user=USERNAME,pass=PASSWORD using module generic
Sep 19 00:29:35 Base automount[28600]: mount_mount: mount(generic): calling mkdir_path /mymountfolder/winbox
Sep 19 00:29:35 Base automount[28600]: mount_mount: mount(generic): calling mount -t cifs -s -o rw,noperm,user=USERNAME,pass=PASSWORD //MYIPADDRESS/Share /mymountfolder/winbox
Sep 19 00:29:35 Base automount[28600]: spawn_mount: mtab link detected, passing -n to mount
Sep 19 00:29:35 Base automount[28600]: >> Unable to find suitable address.
Sep 19 00:29:35 Base automount[28600]: mount(generic): failed to mount //MYIPADDRESS/Share (type cifs) on /mymountfolder/winbox
Sep 19 00:29:35 Base automount[28600]: dev_ioctl_send_fail: token = 76
Sep 19 00:29:35 Base automount[28600]: failed to mount /mymountfolder/winbox
Sep 19 00:29:35 Base automount[28600]: handle_packet: type = 3
Sep 19 00:29:35 Base automount[28600]: handle_packet_missing_indirect: token 77, name winbox, request pid 24536
Sep 19 00:29:35 Base automount[28600]: dev_ioctl_send_fail: token = 77
Sep 19 00:29:35 Base automount[28600]: handle_packet: type = 3
Sep 19 00:29:35 Base automount[28600]: handle_packet_missing_indirect: token 78, name winbox, request pid 24536
Sep 19 00:29:35 Base automount[28600]: dev_ioctl_send_fail: token = 78
据我所知,问题的根源在于:
>> Unable to find suitable address.
当我尝试直接安装它时,我遇到了同样的问题。但是我找不到任何可以指引我正确方向的东西。
我可以正常 ping IP 地址,这也不是本地服务器。
我认为我实际上已经将问题缩小到主机服务器上的防火墙。我的 iptables 中有以下内容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
如果我禁用 iptables,一切都会正常工作,所以我一定是遗漏了上面的某些内容。