Giter Site home page Giter Site logo

wgctrl_go_demo's Introduction

reference

https://github.com/WireGuard/wgctrl-go

https://godoc.org/golang.zx2c4.com/wireguard/wgctrl

https://wiki.archlinux.jp/index.php/WireGuard

環境構成

Peer A 192.168.11.20 Peer B 192.168.11.21

Peer A 側で本プログラムを使用する。

手順

(1) Peer B

秘密鍵、公開鍵ペアを作成しておく。

$ wg genkey > privatekey
$ wg pubkey < privatekey > publickey

(2) Peer A

wg0インターフェースの作成と、IPアドレス付与、UPを事前にしておく。

$ ip link add dev wg0 type wireguard
$ ip addr add 10.0.0.1/24 dev wg0
$ ip link set wg0 up
$ sudo ./wgctrl_go_demo wg0 192.168.11.21 39814 ATaPUw/JCZd9Kn29JJ2ztsraZvqGZ86AMBAw5Tgt5nk= 10.0.0.2/32

Peer BのIPアドレス、ポート、公開鍵、許可IPを設定する。

出力例

Name: wg0
Type: Linux kernel
Private key: KKoG31L4M1I9707s3Y9wAy9/DqsoCnijD4ZpnVcHQVA=
Public Key: KOSmJlCkdtYuvrnnpO5woy0seCAr/LAVOKzv1SzkTy4=
Listen Port: 48574
Peers: [{ATaPUw/JCZd9Kn29JJ2ztsraZvqGZ86AMBAw5Tgt5nk= AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 192.168.11.21:39814 0s 0001-01-01 00:00:00 +0000 UTC 0 0 [{10.0.0.2 ffffffff}] 1}]

(3) Peer B

$ ip link add dev wg0 type wireguard
$ ip addr add 10.0.0.2/24 dev wg0
$ wg set wg0 listen-port 39814 private-key ./privatekey
$ wg set wg0 peer KOSmJlCkdtYuvrnnpO5woy0seCAr/LAVOKzv1SzkTy4= persistent-keepalive 25 allowed-ips 10.0.0.1/32 endpoint 192.168.11.20:48574
$ ip link set wg0 up

wgctrl_go_demo's People

Contributors

hsmtkk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.