wireguard
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wireguard [2021/02/23 07:34] – [Create Key Pairs] baumi | wireguard [2021/05/09 10:31] (current) – [Assign Link Network to Wireguard-Tunnel] baumi | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| **Host A** | **Host A** | ||
| < | < | ||
| - | # wg genkey > privateA | + | root@hosta | 
| - | # wg pubkey < privateA > publicA | + | root@hosta | 
| </ | </ | ||
| **Host B** | **Host B** | ||
| < | < | ||
| - | # wg genkey > privateB | + | root@hostb | 
| - | # wg pubkey < privateB > publicB | + | root@hostb | 
| </ | </ | ||
| + | ===== Assign Link Network to Wireguard-Tunnel ===== | ||
| + | Link-Network: | ||
| + | HostA: 172.24.0.1/ | ||
| + | HostB: 172.24.0.2/ | ||
| + | ===== Create Config ===== | ||
| + | **Host A** | ||
| + | < | ||
| + | root@hosta # cat / | ||
| + | # HostA - HostB | ||
| + | [Interface] | ||
| + | Address = 172.24.0.1/ | ||
| + | PrivateKey = < | ||
| + | ListenPort = 51820 | ||
| + | |||
| + | [Peer] | ||
| + | PublicKey = < | ||
| + | AllowedIPs = 172.24.0.2/ | ||
| + | </ | ||
| + | |||
| + | **Host B** | ||
| + | < | ||
| + | root@hostb # cat / | ||
| + | # HostB - HostA | ||
| + | [Interface] | ||
| + | Address = 172.24.0.2/ | ||
| + | PrivateKey = < | ||
| + | ListenPort = 51820 | ||
| + | |||
| + | [Peer] | ||
| + | PublicKey = < | ||
| + | AllowedIPs = 172.24.0.1/ | ||
| + | # Uncomment if HostB is behind NAT Router | ||
| + | # PersistentKeepAlive = 25 | ||
| + | </ | ||
| + | |||
| + | ===== Start Wireguard Tunnel ===== | ||
| + | Issue on both hosts | ||
| + | < | ||
| + | root@hosta # wg-quick up wg0 | ||
| + | root@hostb # wg-quick up wg0 | ||
| + | </ | ||
| + | ===== Check Status ===== | ||
| + | **Host A** | ||
| + | < | ||
| + | root@hosta # wg | ||
| + | interface: wg0 | ||
| + | public key: PUBLIC-KEY-A | ||
| + | private key: (hidden) | ||
| + | listening port: 51820 | ||
| + | |||
| + | peer: PUBLIC-KEY-B | ||
| + | endpoint: 185.69.244.140: | ||
| + | allowed ips: 172.24.0.2/ | ||
| + | latest handshake: 1 minute, 44 seconds ago | ||
| + | transfer: 2.80 MiB received, 1.09 MiB sent | ||
| + | </ | ||
| + | |||
| + | **Host B** | ||
| + | < | ||
| + | root@hostb # wg | ||
| + | interface: wg0 | ||
| + | public key: PUBLIC-KEY-B | ||
| + | private key: (hidden) | ||
| + | listening port: 51820 | ||
| + | |||
| + | peer: PUBLIC-KEY-A | ||
| + | endpoint: 144.76.72.57: | ||
| + | allowed ips: 172.24.0.1/ | ||
| + | latest handshake: 21 seconds ago | ||
| + | transfer: 1006.68 KiB received, 2.57 MiB sent | ||
| + | persistent keepalive: every 25 seconds | ||
| + | </ | ||
| + | {{tag>kb linux}} | ||
wireguard.1614062041.txt.gz · Last modified:  by baumi
                
                