Mac*OS环境(cli)*
安装HomebrewCN
- 安装HomebrewCN,用于安装管理软件。
命令:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
按需选择相应的源,主要是为了下载软件快,走国内的镜像。
安装wireguard-tools VPN
安装命令:
出现如下提示,说明安装完成:brew install wireguard-tools
Bash completion has been installed to:usr/local/etc/bash_completion.d
将公司的**.config文件放在指定的文件夹。
```shell /usr/local/etc/wireguard/zenview.conf
[Interface] PrivateKey = ADyj36r93Tn9VpIFAdacN4IrdVvY4KbLPPbaMpY5/HM= Address = 10.0.0.133/24 DNS = 192.168.100.5 MTU = 1420
[Peer] PublicKey = To7J2ZsyFB7EWkt27fqSxQoFmqjt2mMW5q8yOm+ORkU= Endpoint = 122.226.180.249:59000
AllowedIPs = 0.0.0.0/0
AllowedIPs = 192.168.100.0/23 PersistentKeepalive = 25
- 启用隧道
wg-quick up * 命令示例:wg-quick up zenview
- 使用root用户查看状态
wg show
3. 启用隧道
wg-quick up *.conf 命令示例:wg-quick up zenview
其中的*.conf 为分发的配置文件
启用成功后,使用命令查看状态(root权限)
wg show
显示内容:
interface: utun4
public key: JlXka8357mzIK2bKso5zrhYkU40YUdcOKc89K35GwAs=
private key: (hidden)
listening port: 59647
peer: To7J2ZsyFB7EWkt27fqSxQoFmqjt2mMW5q8yOm+ORkU=
endpoint: 58.49.120.2:59000
allowed ips: 10.0.0.0/24, 192.168.14.0/23, 192.168.100.0/23, 192.168.152.0/23
transfer: 0 B received, 888 B sent
persistent keepalive: every 25 seconds
此时已连接成功,即可访问公司内网网段。
3. 关闭隧道,断开链接
wg-quick down *.conf 命令示例:wg-quick down zenview ```