Skip to content

Quickly initiate a WireGuard tunnel for network formation. / 快速启动wireguard隧道,进行组网. issue/pr welcome

License

Notifications You must be signed in to change notification settings

sam13142023/Wireguard-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WireGuard 管理脚本

ENGLISH VERSION

本脚本用于管理 WireGuard 隧道,包括安装 WireGuard、展示当前隧道信息、创建新隧道以及生成并打印公私钥。

功能介绍

  1. 检查并安装 WireGuard

    • 检查系统是否已安装 WireGuard,如未安装则自动安装。
  2. 展示所有隧道信息

    • 显示当前所有已配置的 WireGuard 隧道信息。
  3. 创建新隧道

    • 引导用户创建新的 WireGuard 隧道,包含生成密钥、配置文件、并启动隧道。
  4. 生成并打印公私钥

    • 生成新的 WireGuard 公私钥对并打印输出。
  5. 退出脚本

    • 结束脚本运行。

使用说明

  1. 权限检查

    • 确保以 root 用户运行此脚本,以便安装软件包和配置网络接口。
  2. 启动脚本

    • 初次运行脚本:使用以下命令下载并运行脚本:
      curl -L https://github.com/sam13142023/Wireguard-shell/raw/main/main.sh -o wireguard.sh
      chmod +x wireguard.sh
      bash wireguard.sh
    • 后续使用:首次使用后,在脚本所在目录直接运行 ./wireguard.sh 即可。
  3. 主菜单

    • 运行脚本后,将显示一个主菜单,提供五个选项(1 到 5)。
  4. 选项说明

    • 根据需求选择对应数字选项,执行相应功能。

选项详解

检查并安装 WireGuard

  • 选择 1 后,将检查系统是否安装了 WireGuard。如果未安装,将更新软件包列表并安装 WireGuard。

展示所有隧道信息

  • 选择 2 后,将使用 wg show 命令显示当前所有已配置的 WireGuard 隧道信息。

创建新隧道

  • 选择 3 后,将引导您输入必要的配置信息来创建新的 WireGuard 隧道配置文件,并启用该隧道。
    • 配置信息包括:
      • 配置文件名
      • 服务器 IP 地址
      • 服务器端口号
      • 隧道本地 IP 地址
      • 本地服务端口号
      • 对方 WireGuard 公钥
    • 确认配置信息后,脚本将生成并保存配置文件,并启动隧道。

生成并打印公私钥

  • 选择 4 后,将生成新的 WireGuard 公私钥对并打印输出。

退出脚本

  • 选择 5 后,将退出脚本运行。

注意事项

  • 确保以 root 权限运行脚本,以便执行安装和配置操作。
  • 在创建新隧道时,请确保输入的配置信息准确无误,特别是 IP 地址和公钥信息。

联系方式

如有问题或建议,请在 GitHub 上提交 issue。

About

Quickly initiate a WireGuard tunnel for network formation. / 快速启动wireguard隧道,进行组网. issue/pr welcome

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages