Day 27 - 利用 WireGuard 建立点对点隧道

今天来与大家分享,透过 WireGuard 建立点对点隧道。

我们常用的 PTP Tunnel,像是 GRE、SIT 之类的,但其实 WireGuard 也可以用於建立点对点隧道,设定 PTP Address。

事前准备

  • 会用到 ip addr / ip link 等指令
  • WireGuard

设定

我通常会先写好 WireGuard 的设定档,如下(请自行替换为所需)

[Interface]
PrivateKey = <Private Key>
ListenPort = <Port>

[Peer]
PublicKey = <Public Key>
EndPoint = <EndPoint>
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 1

接着,再写一个 Script,像是这样。

#!/bin/bash
ip link add dev ptp-hk type wireguard
wg setconf ptp-hk /etc/wireguard/ptp-hk.conf
ip link set vrf vrf_YINETWORK ptp-hk
ip addr add 172.18.0.0/31 dev ptp-hk
ip link set ptp-hk up

接着,输入 sudo wg。就会可以看到 WireGuard 状态罗

https://ithelp.ithome.com.tw/upload/images/20211012/20119484A1AjN05qvq.png


<<:  第27车厢-关於讯息视窗:bootstrap5Model应用篇

>>:  Day 28:Ansible Vault

[C#] 使用记忆体快取 MemoryCache 增加回应速度

在应用程序中有许多向资料库读取资料的动作,为了增加程序效能, 有 2 个方向可以调整。 第 1 种是...

day14 channel实战使用 with webSocket,後面离题讲android接localhost

前言,今天写一写就离题了QQ,前面用ktor架websocket,在手机app接起来,复习一下cha...

Line Messaging API 切换图文选单 Rich Menu

验证码小帮手现在预设的图文选单是获取验证码,可是使用者在身分认证前并不能使用这个功能,也就是说身份认...

Day 6 - Vue事件处理

在 Day 5 中我们提到了Vue中的条件渲染,我们用hardcode的方式指派isShow变数的b...