内网穿透无公网IP访问家里局域网设备(神卓互联)
使用步骤
1.局域网安装Linux 或windows 服务器
2.服务器安装神卓互联客户端
3.神卓互联注册账号购买内网穿透,创建映射端口
4.官网教程与连接
https://www.shenzhuohl.com/linux_read.html
https://www.shenzhuohl.com/chuantou.html
1、安装服务器和客户端
这里演示了Ubuntu 18.04安装神卓互联内网穿透客户端的步骤方法,其它ubuntu版本和Arm版方法类似 :
1、登录Ubuntu操作系统
打开Linux终端,输入sudo su进入root账户权限,然后输入apt-get update ( centos 没有这个命令)
sudo su
apt-get update
2、安装运行环境
安装C++运行环境
apt-get install g++ (centos 用 yum -y install gcc-c++)
耐心等待安装完成
到此运行环境安装完成
3、下载和安装神卓互联客户端
创建一个目录:
mkdir /usr/local/shenzhuo
cd /usr/local/shenzhuo
复制Linux系统x86_64下载地址 如您是ARM等其它Linux架构,点击查询相应的客户端版本>>
wget http://neiwangchuantou.oss-cn-shanghai.aliyuncs.com/linux/x86_64/8.0.2/client
给运行权限赋值
chmod +x client
启动神卓互联客户端: 参数里带上自己的账号和密码 例如: 18800000000 密码:123456
./client 18800000000 123456
到此神卓互联客户端已经安装和运行成功,如果是初次使用,前往官网,登录控制台添加映射规则
4、注册系统服务和开机自启动
第一步:编写脚本
vi /etc/systemd/system/shenzhuo.service
由于ubuntu不能执行vim命令,需要安装,执行命令后输入Y
sudo apt install vim
复制粘贴以下内容:(注意)账号更换为自己账号密码。
[Unit]
Description=shenzhuohulian Service
After=network.target
[Service]
Type=simple
WorkingDirectory=/usr/local/shenzhuo
ExecStart=/usr/local/shenzhuo/client 18800000000 123456
ExecStop=/bin/kill -2
Restart=always
StartLimitBurst=0
[Install]
WantedBy=multi-user.target
使配置文件生效
chmod +x /etc/systemd/system/shenzhuo.service
systemctl daemon-reload
systemctl restart shenzhuo
systemctl enable shenzhuo
服务配置已成功。
系统服务相关命令
查看服务运行状态
systemctl status shenzhuo
停止服务
systemctl stop shenzhuo
重启服务
systemctl restart shenzhuo
问题处理
1.我在安装客户端,创建映射都做好以后发现还是不通,查看服务状态也是正常,于是重启的了一下服务发现又好了,所以别的都没问题就重启
2.注意:要保证客户端与局域网IP都是互通的
3. 免密登录
Ubuntu
centos
vim /etc/systemd/system/getty.target.wants/getty@tty1.service
改成如上图所示,代码附下:
ExecStart=-/sbin/agetty --autologin root --noclear %I