配置网络文件共享

Mapping network drive

Windows client

windows 支持 ftp、samba、nfs(win10新加入)等多种文件共享协议。在没有防火墙的情况下都是好用的。
nfs 协议需要提前在控制面板>程序>新增/删除Windows功能>nfs功能 中开启。
hostname可在C:\Windows\System32\drivers\etc\hosts文件中配置

挂载nfs

右键我的电脑->Map Network Drive(注意nfs协议不能是添加网络位置)->如lab-nas:/mnt/HD/HD_a2/Public

由于nfs默认没有用户认证,注意配置nfs的匿名uid和gid
BusyBox nfs: 编辑 /etc/exports 文件的 anonuid=500 和 anongid=1000(admin用户访问)
然后更新配置文件 exportfs -rv

Windows NFS Client: Ctrl+R管理员regedit进入注册表:Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default
设置用户AnonymousUid 和 组 AnonymousGid 的 Decimal 值和服务器对应用户相同(500和1000)

注:nfs需要两机器时间尽量同步

挂载samba绕过

在一些网络环境中比如校园网屏蔽了smb的445端口时,需要采用端口绕过的方式来配置。

Linux服务器Samba配置

在smb.conf文件中改变端口(避开2000以内的约定俗成端口)

1
smb ports = 2222 # 默认配置 smb ports = 445 139

Win客户端配置

管理员身份打开 Powershell

1
2
3
4
5
6
7
8
# 开启端口转发(Portproxy)lab-server替换为服务器地址
netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=445 connectaddress=inspiron-7537 connectport=2222
# 查看所有的代理
netsh interface portproxy show all
# 检查445端口监听状况
netstat -ano | findstr :445
# 删除代理(后期不用删除操作)
# netsh interface portproxy delete v4tov4 listenport=445 listenaddress=127.0.0.1

挂载方法如下图所示:
smb-mount-other-port.png
其中选项“Reconnect at sign-in”需要勾选以便重启后仍可以记住网络磁盘,选项“Connect using different credentials”若之前已经挂载成功过,则不勾选。

Openvpn

Archwiki: https://wiki.archlinux.org/index.php/OpenVPN

Postman 使用笔记 C++ Notes --- Function Pointers

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×