无法在连接OpenVPN的路由器内挂载Samba共享
无法在连接OpenVPN的路由器内挂载Samba共享
我最近碰到个头疼的问题:我的路由器连在一台OpenVPN服务器上,路由器里搭了个Samba共享,但我用同样连了这个OpenVPN服务器的手机,怎么都挂载不上这个共享。下面是我整理的相关配置和排查信息,希望能找到问题所在:
我的OpenVPN服务器精简配置文件
local my_ip_address port port_number proto tcp dev tun ca /path/to/ca.crt cert /path/to/cert.crt key /path/to/private.key # This file should be kept secret dh /path/to//dh.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist /var/log/openvpn/ipp.txt push "redirect-gateway ipv6 def1 bypass-dhcp" push "dhcp-option DNS mydns_1" push "dhcp-option DNS mydns_2" client-to-client keepalive 10 120 tls-auth /path/to//ta.key 0 # This file is secret cipher top_secret user nobody group nogroup persist-key persist-tun status /path/to/openvpn-status.log log /path/to/openvpn.log log-append /path/to/openvpn.log verb 4 auth-user-pass-optional plugin /path/to/openvpn-plugin-auth-pam.so login client-config-dir ccd route 192.168.70.0 255.255.255.0 push "route 192.168.70.0 255.255.255.0" server-ipv6 my_ipv6 push tun-ipv6 push "route-ipv6 my_ipv6" push "route-ipv6 2000::/3" push "dhcp-option DNS myipv6dns" push "dhcp-option DNS myipv6dns"
我的Samba精简配置文件
[global] workgroup = WORKGROUP netbios name = home.mustafejen.se interfaces = driver_name domain master = yes domain logons = yes wins support = yes dns proxy = yes hostname lookups = yes name resolve order = wins lmhosts host bcast smb ports = 445 139 138 137 log file = /var/log/samba/log.%m max log size = 1000 logging = file panic action = /usr/share/samba/panic-action %d server role = standalone server obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user usershare allow guests = yes printing = cups printcap = cups [printers] comment = All Printers browseable = yes path = /var/spool/samba printable = yes guest ok = yes read only = yes create mask = 0700 [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = no guest ok = yes [samba-share] comment = Samba on Debian #valid users = user1, user2, user3 path = /home/me/Musik read only = yes guest ok = yes hosts.allow = 192.168.70.0/24 10.8.0.0/24 127.0.0.1 browsable = yes [mappen] comment = Samba on Debian valid users = per path = /home/me writable = yes guest ok = no #hosts.allow = browsable = yes
OpenVPN服务器上的路由表(执行netstat -nr输出)
Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 172.31.1.1 0.0.0.0 UG 0 0 0 eth0 10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0 10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0 172.31.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0 185.12.64.1 172.31.1.1 255.255.255.255 UGH 0 0 0 eth0 185.12.64.2 172.31.1.1 255.255.255.255 UGH 0 0 0 eth0 192.168.70.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
注:192.168.70.0是我路由器所在的内网段,Samba共享就部署在这个网段里。
当前排查情况
- 路由器和我的手机都获取到了10.8.0.0网段的IP地址
- OpenVPN服务器能正常转发我路由器内PC和外网手机的流量
- 尝试挂载Samba共享时,smb.log里完全没有任何输出,连错误信息都看不到
- 用Android的Cx File Explorer尝试挂载时,只收到超时错误的提示
另外我还发现一个奇怪的点:我能ping通10.8.0.1,但ping不通路由表里的网关10.8.0.2。
备注:内容来源于stack exchange,提问作者Per Gunnarsson
相关产品推荐
相关产品推荐

