How to Install WireGuard on Kali Linux

WireGuard is a modern VPN solution that offers fast and secure connections. In this tutorial, we will guide you through the process of installing WireGuard on Kali Linux.

Prerequisites

Steps

  1. Update the package list of your Kali Linux system by running the following command:

    sudo apt-get update
    
  2. Install the necessary packages required for compiling and building WireGuard by running the following command:

    sudo apt-get install wireguard-dkms wireguard-tools linux-headers-$(uname -r)
    

    This command installs the wireguard-dkms and wireguard-tools packages along with the kernel headers.

  3. Confirm that the installation was successful by running the lsmod command. You should see wireguard listed in the output.

    lsmod | grep wireguard
    
  4. Generate a new WireGuard key pair by running the following command:

    sudo wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
    

    This command generates a new private and public key pair for WireGuard and saves them to /etc/wireguard/privatekey and /etc/wireguard/publickey on your system.

  5. Create a new configuration file for your WireGuard instance. The configuration file is a text file that contains the details required to connect to a WireGuard server. You can create this file manually in your preferred text editor (e.g. Nano), or by running:

    sudo nano /etc/wireguard/wg0.conf
    
  6. Open the new configuration file (/etc/wireguard/wg0.conf), and add the following content:

    [Interface]
    PrivateKey = [private key output from step 4]
    Address = 10.0.0.2/24
    
    [Peer]
    PublicKey = [public key output from step 4]
    AllowedIPs = 0.0.0.0/0
    Endpoint = [WireGuard server IP]:51820
    PersistentKeepalive = 21
    

    This configures a new WireGuard interface ([Interface]) and sets the private key, IP address, and a port number for the server. The [Peer] section specifies the server endpoint, public key, allowed IPs, and a persistent keep-alive.

  7. Start the WireGuard interface by running the following command:

    sudo wg-quick up wg0
    

    This command starts the wg0 interface created in the previous step.

  8. Confirm that the WireGuard interface is working by running the following command:

    sudo wg show
    

    This command displays the current status of the WireGuard interface.

Congratulations! You have successfully installed and configured WireGuard on Kali Linux. You can now use the interface to connect to a WireGuard VPN server.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!