Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:vpn:wireguard:server [2023/01/14 14:40] – [Testing] unify vgaetera | docs:guide-user:services:vpn:wireguard:server [2023/09/27 14:16] – optimize links vgaetera | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== WireGuard server ====== | ====== WireGuard server ====== | ||
| - | {{section> | + | {{section> |
| ===== Introduction ===== | ===== Introduction ===== | ||
| Line 16: | Line 16: | ||
| ==== 1. Preparation ==== | ==== 1. Preparation ==== | ||
| Install the required packages. | Install the required packages. | ||
| - | Specify | + | Specify configuration parameters |
| <code bash> | <code bash> | ||
| Line 24: | Line 24: | ||
| # Configuration parameters | # Configuration parameters | ||
| - | WG_IF=" | + | VPN_IF=" |
| - | WG_PORT=" | + | VPN_PORT=" |
| - | WG_ADDR=" | + | VPN_ADDR=" |
| - | WG_ADDR6="fdf1: | + | VPN_ADDR6="fd00: |
| </ | </ | ||
| ==== 2. Key management ==== | ==== 2. Key management ==== | ||
| - | Generate and exchange keys between | + | Generate and exchange |
| <code bash> | <code bash> | ||
| Line 41: | Line 41: | ||
| # Server private key | # Server private key | ||
| - | WG_KEY=" | + | VPN_KEY=" |
| # Pre-shared key | # Pre-shared key | ||
| - | WG_PSK=" | + | VPN_PSK=" |
| # Client public key | # Client public key | ||
| - | WG_PUB=" | + | VPN_PUB=" |
| </ | </ | ||
| Line 59: | Line 59: | ||
| uci rename firewall.@zone[0]=" | uci rename firewall.@zone[0]=" | ||
| uci rename firewall.@zone[1]=" | uci rename firewall.@zone[1]=" | ||
| - | uci del_list firewall.lan.network=" | + | uci del_list firewall.lan.network=" |
| - | uci add_list firewall.lan.network=" | + | uci add_list firewall.lan.network=" |
| uci -q delete firewall.wg | uci -q delete firewall.wg | ||
| uci set firewall.wg=" | uci set firewall.wg=" | ||
| uci set firewall.wg.name=" | uci set firewall.wg.name=" | ||
| uci set firewall.wg.src=" | uci set firewall.wg.src=" | ||
| - | uci set firewall.wg.dest_port=" | + | uci set firewall.wg.dest_port=" |
| uci set firewall.wg.proto=" | uci set firewall.wg.proto=" | ||
| uci set firewall.wg.target=" | uci set firewall.wg.target=" | ||
| Line 77: | Line 77: | ||
| <code bash> | <code bash> | ||
| # Configure network | # Configure network | ||
| - | uci -q delete network.${WG_IF} | + | uci -q delete network.${VPN_IF} |
| - | uci set network.${WG_IF}=" | + | uci set network.${VPN_IF}=" |
| - | uci set network.${WG_IF}.proto=" | + | uci set network.${VPN_IF}.proto=" |
| - | uci set network.${WG_IF}.private_key=" | + | uci set network.${VPN_IF}.private_key=" |
| - | uci set network.${WG_IF}.listen_port=" | + | uci set network.${VPN_IF}.listen_port=" |
| - | uci add_list network.${WG_IF}.addresses=" | + | uci add_list network.${VPN_IF}.addresses=" |
| - | uci add_list network.${WG_IF}.addresses=" | + | uci add_list network.${VPN_IF}.addresses=" |
| # Add VPN peers | # Add VPN peers | ||
| uci -q delete network.wgclient | uci -q delete network.wgclient | ||
| - | uci set network.wgclient=" | + | uci set network.wgclient=" |
| - | uci set network.wgclient.public_key=" | + | uci set network.wgclient.public_key=" |
| - | uci set network.wgclient.preshared_key=" | + | uci set network.wgclient.preshared_key=" |
| - | uci add_list network.wgclient.allowed_ips=" | + | uci add_list network.wgclient.allowed_ips=" |
| - | uci add_list network.wgclient.allowed_ips=" | + | uci add_list network.wgclient.allowed_ips=" |
| uci commit network | uci commit network | ||
| / | / | ||
| Line 98: | Line 98: | ||
| ===== Testing ===== | ===== Testing ===== | ||
| Establish the VPN connection. | Establish the VPN connection. | ||
| - | Use [[man> | + | Verify your routing with [[man> |
| <code bash> | <code bash> | ||
| Line 105: | Line 105: | ||
| </ | </ | ||
| - | Check your public | + | Check your IP and DNS provider. |
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https://www.dnsleaktest.com/ |
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||