wireduard之前搭建过。在此不做赘述。图简单的话,可以拉docker的wg-easy进行运行。

搭建好之后,服务器给windows生成配置。

[Interface]
PrivateKey = 私钥
Address = 10.8.0.3/24

[Peer]
PublicKey = 公钥
PresharedKey = Xtz5vzzicOncQe3Dt8LMFIbdxa/XUepY9hAllrJ3k30=
AllowedIPs = 10.8.0.0/24
Endpoint = 152.136.153.72:51820

然后开始macos的操作,首先,你需要有一个Homebrew来用于安装软件。

macos安装wireguard步骤

1. 安装 WireGuard

使用 Homebrew 安装 WireGuard 工具包:

brew install wireguard-tools

3. 配置 WireGuard

使用下面的命令创建配置文件:

sudo vim /opt/homebrew/etc/wireguard/wg0.conf

编辑配置文件,添加以下内容:

[Interface]
PrivateKey = 私钥
Address = 10.8.0.7/24
MTU = 1540
[Peer]
PublicKey = 公钥
PresharedKey = 
AllowedIPs = 10.8.0.0/24
Endpoint = 152.136.153.72:51820
PersistentKeepalive = 25

一切配置好之后,安装图形化界面WireGuardStatusbar
https://github.com/aequitas/macos-menubar-wireguard这个链接下载文件安装。安装完毕之后,启动wg0这个就可以了。

不想安装的话可以使用这个命令去

开启

sudo wg-quick up wg0

关闭

sudo wg-quick down wg0
最后修改:2025 年 10 月 14 日
如果觉得我的文章对你有用,请随意赞赏