内网穿透远程控制NAS

内网穿透

方法1: frp

开源下载地址 https://github.com/fatedier/frp

frps 放在服务器 执行

./frps -c frps.toml (后台运行:nohup ./frps -c frps.toml >/dev/null 2>&1 &)

frps.toml配置为

bindPort = 7000
webServer.port = 7500
webServer.user = "admin"
webServer.password = "adminServer"

frpc 放在本地 执行

./frpc -c frpc.toml(后台运行:nohup ./frpc -c frpc.toml >/dev/null 2>&1 &)

frpc.toml配置为

serverAddr = "x.x.x.x" #korea
serverPort = 7000

webServer.addr = "127.0.0.1"
webServer.port = 7400
webServer.user = "admin"
webServer.password = "adminClient"

[[proxies]]
name = "webDav"
type = "tcp"
localIP = "127.0.0.1"
localPort = 5005
remotePort = 6000

寻找进程杀死后台运行

ps -aux|grep frp| grep -v grep

kill -9 xxxxx

nc -zvu x.x.x.x 21116 //-zv验证tcp -zvu验证udp是否通

方法2: cloudflared

配置更简单,官网文档:https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/

下载cloudflared可执行文件(下载地址 https://github.com/cloudflare/cloudflared)后执行安装命令启动服务

sudo cloudflared service install <key>

只列出MAC 下的命令如下,Linux更简单原理一样。

sudo launchctl stop com.cloudflare.cloudflared 

sudo launchctl unload /Library/LaunchDaemons/com.cloudflare.cloudflared.plist 

open /Library/LaunchDaemons/com.cloudflare.cloudflared.plist 

sudo launchctl load /Library/LaunchDaemons/com.cloudflare.cloudflared.plist 

sudo launchctl start com.cloudflare.cloudflared

cloudflared实用功能:在内网建立ssh

建立RustDesk远程控制桌面服务

任意云服务器里安装宝塔面板的docker下载镜像后运行下面命令启动服务

sudo docker run --name hbbs -v ./data:/root -td --net=host rustdesk/rustdesk-server hbbs -r x.x.x.x  (xxxx替换成云服务器的公网IP地址,如果在内网则是内网IP地址)

sudo docker run --name hbbr -v ./data:/root -td --net=host rustdesk/rustdesk-server hbbr

不要忘记开21116(tcp/udp),21117(tcp)端口

如果rustdesk服务架设在内网需要配置frp客户端才能外网访问,frpc.toml配置为

serverAddr = "x.x.x.x" #外网IPV4地址
serverPort = xxxxx #外网转发端口

[[proxies]]
name = "rusk1t"
type = "tcp"
localIP = "192.168.x.x"#内网IP地址
localPort = 21116
remotePort = xxxx6 #外网访问端口

[[proxies]]
name = "rusk1u"
type = "udp"
localIP = "192.168.x.x"#内网IP地址
localPort = 21116
remotePort = xxxx6 #外网访问端口

[[proxies]] 
name = "rusk2" 
type = "tcp" 
localIP = "192.168.x.x"#内网IP地址 
localPort = 21117 
remotePort = xxxx7 #外网访问端口

NAS的Docker中OpenWrt旁路由安装教程

# 开启混杂模式 ip link set ovs_eth0 promisc on 

# 创建一个子网为192.168.1.0/24的虚拟网络,网关是192.168.1.1,名为ovs_lan 

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=ovs_eth0 ovs_lan

# 创建名为openwrt1的容器,网络选择ovs_lan,ip指定为192.168.1.33 

docker run -d --name openwrt1 --net ovs_lan --privileged --ip 192.168.1.33 sulinggg/openwrt:x86_64 /sbin/init

原安装教程


      
文章极致简洁
数字化区块时代 » 内网穿透远程控制NAS

发表回复