网络期间我们经常需要远程互访问管理家庭或公司里的电脑,NAS,连网装备,随着宽带的提速网络的普及,未来这个需求只会更加的多。固然现在都有IPV6可以直连了,但有些装备或网络还不支持或没开启,IPV6究竟是暴露在公网的始终没那么安全,总之多个方案多个选择是最好的,以是折腾搭建了异地组网网络,也叫虚拟局域网,号称搭建后能主动P2P组网直连即不需要走公网服务器的流量,自用的话用组网的方式比内网穿透NPS,FRP和IPV6要安全可靠快速。
要搭建一套远程组网网络必须有一台公网VPS的linux服务器支持docker运行,保举使用腾讯的现在活动很便宜几十块就一年,还能同价续费一年等于白撸二年,购买连接:精选特惠 上云无忧_腾讯云优惠活动,往下拉就能看到轻量的服务器购买,作者使用的就是腾讯的轻量海外服务器199/年,买海外服务器的懂得都懂了,可以挂很多服务,作者的网站88531,这里不方便多说了,至于服务器安装网上有很多教程这里就不说了,下面就只讲解这个组网Headscale部署过程,保举使用宝塔部署方便管理。
1、新建挂载目次和创建数据库文件
- mkdir -p /docker/headscale/config
- touch /docker/headscale/config/db.sqliteCopy
复制代码 2、两个文件配置文件 (注意存放的路径)
可以根据自己需求修改,注意端口不能和你已有的应用有冲突
/docker/headscale/config/config.yaml 主要配置组网的相干信息
<public_ip>需要修改为你服务器的现实IP
- ---
- # headscale will look for a configuration file named `config.yaml` (or `config.json`) in the following order:
- #
- # - `/etc/headscale`
- # - `~/.headscale`
- # - current working directory
-
- # The url clients will connect to.
- # Typically this will be a domain like:
- #
- # https://myheadscale.example.com:443
- #
- server_url: http://<public_ip>:8081
-
- # Address to listen to / bind to on the server
- #
- # For production:
- # listen_addr: 0.0.0.0:8080
- listen_addr: 0.0.0.0:8081
-
- # Address to listen to /metrics, you may want
- # to keep this endpoint private to your internal
- # network
- #
- metrics_listen_addr: 0.0.0.0:6030
-
- # Address to listen for gRPC.
- # gRPC is used for controlling a headscale server
- # remotely with the CLI
- # Note: Remote access _only_ works if you have
- # valid certificates.
- #
- # For production:
- # grpc_listen_addr: 0.0.0.0:50443
- grpc_listen_addr: 127.0.0.1:50443
-
- # Allow the gRPC admin interface to run in INSECURE
- # mode. This is not recommended as the traffic will
- # be unencrypted. Only enable if you know what you
- # are doing.
- grpc_allow_insecure: false
-
- # Private key used to encrypt the traffic between headscale
- # and Tailscale clients.
- # The private key file will be autogenerated if it's missing.
- #
- private_key_path: /etc/headscale/private.key
-
- # The Noise section includes specific configuration for the
- # TS2021 Noise protocol
- noise:
- # The Noise private key is used to encrypt the
- # traffic between headscale and Tailscale clients when
- # using the new Noise-based protocol. It must be different
- # from the legacy private key.
- private_key_path: /etc/headscale/noise_private.key
-
- # List of IP prefixes to allocate tailaddresses from.
- # Each prefix consists of either an IPv4 or IPv6 address,
- # and the associated prefix length, delimited by a slash.
- # While this looks like it can take arbitrary values, it
- # needs to be within IP ranges supported by the Tailscale
- # client.
- # IPv6: https://github.com/tailscale/tailscale/blob/22ebb25e833264f58d7c3f534a8b166894a89536/net/tsaddr/tsaddr.go#LL81C52-L81C71
- # IPv4: https://github.com/tailscale/tailscale/blob/22ebb25e833264f58d7c3f534a8b166894a89536/net/tsaddr/tsaddr.go#L33
- ip_prefixes:
- - fd7a:115c:a1e0::/48
- - 100.64.0.0/10
-
- # DERP is a relay system that Tailscale uses when a direct
- # connection cannot be established.
- # https://tailscale.com/blog/how-tailscale-works/#encrypted-tcp-relays-derp
- #
- # headscale needs a list of DERP servers that can be
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |