Ubuntu安装部署内网穿透(花生壳)
内网穿透原理解析
1. 什么是内网穿透?
在了解内网穿透原理之前,我们先说什么是内网穿透。内网,就是在公司或者家庭内部,建立的局域网络或者是办公网络,可以实现多台电脑之间的资源共享,包括设备、资料、数据等。而外网则是通过一个网关与其它的网络系统连接,相对于内网而言,这种网络系统称之为外部网络,常见的就是我们日常使用的互联网。
一般而言,在没有固定公网IP的情况下,外网设备无法直接访问内网设备。而内网穿透技术,顾名思义就是能让外网的设备找到处于内网的设备,从而实现数据通信。
2. 内网穿透的原理
内网穿透,又称为NAT穿透。NAT背后的设备,它们的主要特点是 ,可以访问外网,但不能被外网设备有效访问。基于这一特点,NAT穿透技术是让NAT背后的设备,先访问指定的外网服务器,由指定的外网服务器搭建桥梁,打通内、外网设备的访问通道,实现外网设备访问到内网设备。
该技术除了可以访问隐藏在NAT后的设备,同样可以穿透防火墙。这是因为防火墙一般只拦截了入站没有拦截出站,所以也可以让防火墙内的设备对外提供服务。
由于内网设备并不是与外网设备直接相连,所以在安全性上是毋庸置疑的,内网穿透可以说是安全与效率兼得。
安装/Linux
下载
wget "https://down.oray.com/hsk/linux/phddns_5.2.0_amd64.deb" -O phddns_5.2.0_amd64.deb
--2022-10-12 10:41:23-- https://down.oray.com/hsk/linux/phddns_5.2.0_amd64.deb
Resolving down.oray.com (down.oray.com)... 125.39.216.243, 60.28.196.244, 60.28.196.240, ...
Connecting to down.oray.com (down.oray.com)|125.39.216.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 309304 (302K) [application/octet-stream]
Saving to: ‘phddns_5.2.0_amd64.deb’
phddns_5.2.0_amd64.deb 100%[====================================================================================>] 302.05K 1.72MB/s in 0.2s
2022-10-12 10:41:24 (1.72 MB/s) - ‘phddns_5.2.0_amd64.deb’ saved [309304/309304]
安装
sudo dpkg -i phddns_5.2.0_amd64.deb
ubuntu@ubuntu:/mnt/c/private/Note/tutorial/phddns$ sudo dpkg -i phddns_5.2.0_amd64.deb
Selecting previously unselected package phddns.
(Reading database ... 62302 files and directories currently installed.)
Preparing to unpack phddns_5.2.0_amd64.deb ...
Unpacking phddns (5.2.0) ...
Setting up phddns (5.2.0) ...
in systemv
Installation, please later...
Successful installation of Phddns Service.
+--------------------------------------------------+
| Oray PeanutHull Linux 5.2.0 |
+--------------------------------------------------+
| SN: orayc4c6218a6d01 Default password: admin |
+--------------------------------------------------+
| Remote Management Address http://b.oray.com |
+--------------------------------------------------+
卸载
sudo dpkg -r phddns
ubuntu@ubuntu:/mnt/c/private/Note/tutorial/phddns$ sudo dpkg -r phddns
(Reading database ... 62315 files and directories currently installed.)
Removing phddns (5.2.0) ...
phdaemon: no process found
phtunnel: no process found
phddns_mini_httpd: no process found
Remove Phtunnel Service Success.
Thanks For Using Phtunnel Service.
设备端配置
- 启动
ubuntu@ubuntu:~/ubuntu# sudo phddns start
ubuntu@ubuntu:~/ubuntu# sudo phddns status
+--------------------------------------------------+
| Oray PeanutHull Linux 5.2.0 |
+--------------------------------------------------+
| Runstatus: ONLINE |
+--------------------------------------------------+
| SN: orayf4894dcc543a |
+--------------------------------------------------+
| Remote Management Address http://b.oray.com |
+--------------------------------------------------+
- 网络信息
ifconfig 查询