Configure WireGuard Client

Install WireGuard, the simple, fast and modern VPN software.

[1] Transfer files or notify contents of [Private key for client] and [Public key for server] generated on WireGuard server to target Client computer.

[2] Install WireGuard.

[[email protected] ~]$ sudo dnf install wireguard-tools -y

[2] The kernel modules are automatically activated when you reboot after installing WireGuard. However, we will manually enable the kernel module to be able to do the remaining settings without rebooting.

[[email protected] ~]# sudo lsmod | grep wireguard
[[email protected] ~]$ sudo modprobe wireguard
[[email protected] ~]$ sudo lsmod | grep wireguard
wireguard              94208  0
libchacha20poly1305    16384  1 wireguard
libblake2s             16384  1 wireguard
ip6_udp_tunnel         16384  1 wireguard
udp_tunnel             20480  1 wireguard
curve25519_x86_64      49152  1 wireguard
libcurve25519_generic    49152  2 curve25519_x86_64,wireguard

[3] Let's create the configuration file shared by the WireGuard server administrator.

[[email protected] ~]$ sudo vi /etc/wireguard/wg0.conf

[Interface]
Address = 192.168.100.1/32
PrivateKey = YADpm+xptxt0j2scg0MsoRCqJ6cdfGihe8TkILZHZ0Q=

[Peer]
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Endpoint = 192.168.122.2:6789
PublicKey = 9LiBYQIEj91kHkmM93ilCk++ZSzWLncQGNz2iwHBFyw=

[4] Let's start the WireGuard service and check that it is running.

[[email protected] ~]$ sudo systemctl start [email protected]
[[email protected] ~]$ sudo wg
interface: wg0
  public key: DlQJgX979QiKTVScfJ2tIoA/VkwOSNOTomOErLVAWAk=
  private key: (hidden)
  listening port: 36574
  fwmark: 0xca6c

peer: 9LiBYQIEj91kHkmM93ilCk++ZSzWLncQGNz2iwHBFyw=
  endpoint: 192.168.122.2:6789
  allowed ips: 0.0.0.0/0
  latest handshake: 20 seconds ago
  transfer: 124 B received, 8.52 KiB sent
  persistent keepalive: every 25 seconds