samba正常启动,但是不能用IP访问

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
chinaz
帖子: 232
注册时间: 2007-02-07 9:23
送出感谢: 3 次
接收感谢: 0

samba正常启动,但是不能用IP访问

#1

帖子 chinaz » 2022-08-15 23:25

之前一直使用debian10搭建的samba服务器,匿名文件存储一直正常。手机电脑都能正常访问。
近期全新安装了debian11系统,安装配置好了samba,使用caja文件管理器,在本机上匿名访问smb://127.0.0.1完全没有问题,在本机上使用本机IP地址访问就出错,提示:
无法显示“smb://192.168.10.170”
出错:从服务器获取共享列表失败,连接超时。。。

selinux是关闭状态
ufw防火墙137/138/139/445等端口都是allow状态
在手机上使用es文件浏览器访问立刻就提示登陆失败,访问其他不同网段的samba机器还转几圈才提示错误,反而是访问本网段的这台samba机器失败提示倒很干脆。

搜了好多文章都没有用,请有经验的高手给点提示,谢谢!
user@work:~$ testparm
Load smb config files from /etc/samba/smb.conf
WARNING: No path in service print$ - making it unavailable!
NOTE: Service print$ is flagged unavailable.
Global parameter server string found in service section!
NOTE: Service print$ is flagged unavailable.
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]
disable netbios = Yes
dns proxy = No
domain master = No
interfaces = enp2s0 192.168.10.0/24
log file = /var/log/samba/log.%m
map to guest = Bad User
max log size = 1000
obey pam restrictions = Yes
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd program = /usr/bin/passwd %u
security = USER
server role = standalone server
unix password sync = Yes
usershare allow guests = Yes
winbind separator = %
winbind use default domain = Yes
wins support = Yes
idmap config * : backend = tdb
cups options = raw
force create mode = 0666
force directory mode = 0777
hosts allow = 192.168.10.

[homes]
comment = Home Directories
create mask = 0777
directory mask = 0777
read only = No
valid users = %S

[print$]
available = No
comment = Printer Drivers
guest ok = Yes
path = /var/lib/samba/printers

[公共]
comment = samba共享服务器
create mask = 0666
guest ok = Yes
hosts allow = 192.168.10.0/24
path = /home/user/公共
read only = No
vfs objects = full_audit
write list = guest
full_audit:priority = notice
full_audit:facility = local7
full_audit:failure = none
full_audit:success = mkdir rename unlink rmdir open pwrite
full_audit:prefix = %u|%I|%m|%S

[printers]
browseable = No
comment = All Printers
create mask = 0700
path = /var/spool/samba
printable = Yes
宠辱不惊,闲看庭前花开花落;去留无意,漫随天外云卷云舒。
头像
astolia
论坛版主
帖子: 5973
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 1039 次

Re: samba正常启动,但是不能用IP访问

#2

帖子 astolia » 2022-08-17 11:59

去查samba的日志啊
头像
chinaz
帖子: 232
注册时间: 2007-02-07 9:23
送出感谢: 3 次
接收感谢: 0

Re: samba正常启动,但是不能用IP访问

#3

帖子 chinaz » 2022-08-17 22:31

日志查了一下,看不懂,看不出啥有价值的信息

===========================
首先是/var/log/samba/log.smbd
[2022/08/17 08:23:55.195565, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 08:23:55.196318, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 08:23:55.196338, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 08:23:55.203620, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 08:28:23.517678, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 08:28:23.518493, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 08:28:23.518540, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 08:28:23.527254, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 08:29:56.640700, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 08:29:56.641171, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 08:29:56.641188, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 08:29:56.647575, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 22:03:29.644784, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 22:03:29.645274, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 22:03:29.645293, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 22:03:29.652226, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 22:09:27.786447, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 22:09:27.786921, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 22:09:27.786942, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 22:09:27.793494, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 22:11:59.731108, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 22:11:59.731587, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 22:11:59.731606, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 22:11:59.738009, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
[2022/08/17 22:14:25.969658, 0] ../../source3/smbd/server.c:1784(main)
smbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 22:14:25.970152, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter load printers found in service section!
[2022/08/17 22:14:25.970170, 0] ../../lib/param/loadparm.c:1918(lpcfg_do_service_parameter)
Global parameter log file found in service section!
[2022/08/17 22:14:25.976274, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections

==================================
然后是/var/log/samba/log.nmbd

[2022/08/16 23:59:08.305469, 0] ../../source3/nmbd/nmbd.c:960(main)
nmbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/16 23:59:08.306305, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
[2022/08/16 23:59:31.470289, 0] ../../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
*****

Samba name server WORK is now a local master browser for workgroup WORKGROUP on subnet 192.168.10.227

*****
[2022/08/17 00:01:21.572639, 0] ../../source3/nmbd/nmbd.c:359(reload_interfaces)
reload_interfaces: No subnets to listen to. Waiting..
[2022/08/17 00:04:43.172087, 0] ../../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
*****

Samba name server WORK is now a local master browser for workgroup WORKGROUP on subnet 192.168.10.227

*****
[2022/08/17 00:42:22.684311, 0] ../../source3/nmbd/nmbd.c:59(terminate)
Got SIGTERM: going down...
[2022/08/17 07:24:57.676052, 0] ../../source3/nmbd/nmbd.c:960(main)
nmbd version 4.13.13-Debian started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
[2022/08/17 07:24:57.678203, 0] ../../lib/util/become_daemon.c:135(daemon_ready)
daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
[2022/08/17 07:25:20.819739, 0] ../../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
*****

Samba name server WORK is now a local master browser for workgroup WORKGROUP on subnet 192.168.10.227

*****
宠辱不惊,闲看庭前花开花落;去留无意,漫随天外云卷云舒。
头像
chinaz
帖子: 232
注册时间: 2007-02-07 9:23
送出感谢: 3 次
接收感谢: 0

Re: samba正常启动,但是不能用IP访问

#4

帖子 chinaz » 2022-08-17 22:36

现在想要实现的就只是很简单的一个功能:局域网实现匿名共享,所有人打开共享文件夹后,都可以读写删操作。在debian10以及之前的系统中都很容易,照着网上的帖子一会就可以搞定,升级到debian11后就不行了,搞了好几天就是找不到问题在哪。。。
宠辱不惊,闲看庭前花开花落;去留无意,漫随天外云卷云舒。
头像
astolia
论坛版主
帖子: 5973
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 1039 次

Re: samba正常启动,但是不能用IP访问

#5

帖子 astolia » 2022-08-18 11:02

nmbd说自己监听的地址是192.168.10.227,不是你去访问的192.168.10.170
chinaz 写了:
2022-08-17 22:31
Samba name server WORK is now a local master browser for workgroup WORKGROUP on subnet 192.168.10.227
头像
chinaz
帖子: 232
注册时间: 2007-02-07 9:23
送出感谢: 3 次
接收感谢: 0

Re: samba正常启动,但是不能用IP访问

#6

帖子 chinaz » 2022-08-18 16:24

192.168.10.170是手动设置的有线ip,不好使就设置为路由器自动分配地址,结果就是192.168.10.227。现在可以在本机上使用smb://192.168.10.227打开,可以使用guest帐号登录了。但是局域网内其他设备仍然访问不了这个地址。。。
宠辱不惊,闲看庭前花开花落;去留无意,漫随天外云卷云舒。
回复