Browse Source

finished wireguard docs

master
Mario Alegre 5 years ago
parent
commit
d0a5c4c4f6
  1. 14
      linux/wireguard/add-peer.md
  2. 2
      linux/wireguard/install.md

14
linux/wireguard/add-peer.md

@ -2,9 +2,19 @@
Say we want to connect two computers via wireguard. We will call them **one** and **two**. Say we want to connect two computers via wireguard. We will call them **one** and **two**.
## one ## manual
on one, run the following command to add a new host:
On one, run the following command to add a new host:
``` ```
sudo wg set wg0 peer ${two_pubkey:?} endpoint ${two_public_ip:?}:${two_port:?} allowed-ips ${two_wg_ip:?}/32 sudo wg set wg0 peer ${two_pubkey:?} endpoint ${two_public_ip:?}:${two_port:?} allowed-ips ${two_wg_ip:?}/32
``` ```
if we also want to be able to refer to the host by an easy to remember name rather than just an IP, we can also add it to `/etc/hosts` if we also want to be able to refer to the host by an easy to remember name rather than just an IP, we can also add it to `/etc/hosts`
```
echo -e "${two_wg_ip:?}\t${two_hostname}.wg.alemor.org" >> /etc/hosts
```
On two, run the same commands but with one and two switched.
## automatic
If you can ssh into an account that has sudo access on the host, simply run the `wg-addpeer` command included in this repo.

2
linux/wireguard/install.md

@ -14,7 +14,7 @@ wg genkey | sudo tee -a wg0.conf | wg pubkey | sudo tee wg0.pubkey
``` ```
open `wg0.conf` in a text editor and add the following lines: open `wg0.conf` in a text editor and add the following lines:
``` ```
ListenPort = $port ListenPort = ${wireguard_port:?}
SaveConfig = true SaveConfig = true
Address = ${wireguard_ip:?}/24 Address = ${wireguard_ip:?}/24
``` ```

Loading…
Cancel
Save