This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:vpn:wireguard [2022/12/20 11:27] – [Wireguard as VPN Server on RockyLinux] mb | linux:vpn:wireguard [2022/12/20 15:51] (current) – [Wireguard as VPN Server on RockyLinux] mb | ||
---|---|---|---|
Line 18: | Line 18: | ||
In this case a configuration file is used - because we are lazy. \\ | In this case a configuration file is used - because we are lazy. \\ | ||
<code bash> | <code bash> | ||
- | wg0 is the name of the interface, which will be created. The file contents this:\\ | + | wg0 is the name of the interface, which will be created. Inside the configuration, |
<code bash> | <code bash> | ||
- | Address = 192.168.2.1/24 | + | Address = 192.168.3.1/24 |
SaveConfig = true | SaveConfig = true | ||
PostUp = firewall-cmd --zone=public --add-port 51820/udp && firewall-cmd --zone=public --add-masquerade | PostUp = firewall-cmd --zone=public --add-port 51820/udp && firewall-cmd --zone=public --add-masquerade | ||
Line 26: | Line 26: | ||
ListenPort = 51820 | ListenPort = 51820 | ||
PrivateKey = YOUR_SERVER_PRIVATEKEY</ | PrivateKey = YOUR_SERVER_PRIVATEKEY</ | ||
+ | The above section only covers the WireGuard interface. First an IP-address range for the interface is set, in this case the locally unused 192.168.3.x net. \\ | ||
+ | With SaveConfig=true the configuration can be overwritten by WireGuard, e.g. when adding new peers.\\ | ||
+ | The next two lines describe the firewall rules when starting or shutting down the service. And seriously i need to clean my keyboard, the keys f and cc are working occasionally which drives me insane. \\ | ||
+ | Next we describe the listening port of the VPN server, if it is changed, the firewall port has to be changed as well. \\ | ||
+ | Last in this section the private key of the server is added, simply copy it from the private.key file in / | ||
+ | To start the interface use: | ||
+ | <code bash> | ||
+ | The output after it should be: | ||
+ | {{ : | ||
+ | When the WireGuard service is up and running, it can be checked with | ||
+ | <code bash> | ||
+ | This will show the following: | ||
+ | {{ : | ||
+ | With //sudo wg// we check all interfaces of wireguard, it is possible to create multiple interfaces for one instance. \\ | ||
+ | Now our VPN server is up and running. To stop it use: | ||
+ | <code bash> | ||
+ | ====== WireGuard Web UI ====== | ||
+ | Adding peers isn't easy and can be frustrating. There are some web UIs which can deliver a solution. \\ | ||
+ | One of them is [[https:// | ||
====== Wireguard as VPN Client on Linux ====== | ====== Wireguard as VPN Client on Linux ====== | ||
MacOs and Linux are similar configured as clients. \\ | MacOs and Linux are similar configured as clients. \\ |