Command-Line Configuration for Robust VPN Setup
Start PowerShell on Windows Server Core
Windows Server Core is optimized for a low-touch environment without a graphical interface. To begin, connect to your server via RDP, which will start a command prompt in Administrator mode. Enter the following to launch PowerShell:
Download and Install WireGuard Windows Client
The WireGuard Windows Client is essential for setting up your VPN server. To get the latest version, visit the WireGuard Windows Client MSI list page. Use the command below, adjusting it for your server’s architecture and the client’s version number:
Invoke-WebRequest "https://download.wireguard.com/windows-client/wireguard-amd64-x.x.x.msi" -OutFile "wireguard-client.msi"
For example, to download the WireGuard Windows client version 0.5.3 for AMD64, you would use:
Invoke-WebRequest "https://download.wireguard.com/windows-client/wireguard-amd64-0.5.3.msi" -OutFile "wireguard-client.msi"
After the download completes, install the client silently using:
MsiExec.exe /i wireguard-client.msi DO_NOT_LAUNCH=1 /qn
Download and Install WireSock VPN Gateway
To install the WireSock VPN Gateway, modify the following command with the correct version number for your needs:
Invoke-WebRequest "http://www.wiresock.net/downloads/wiresock-vpn-gateway-x64-x.x.x.x.msi" -OutFile "wiresock-gateway-x64.msi"
For instance, to download version 188.8.131.52:
Invoke-WebRequest "http://www.wiresock.net/downloads/wiresock-vpn-gateway-x64-184.108.40.206.msi" -OutFile "wiresock-gateway-x64.msi"
Then, execute the installer with:
MsiExec.exe /i wiresock-gateway-x64.msi /qn
Refresh Environment Variables and Start the WireGuard Server
To ensure your system recognizes the new installations, refresh the environment variables:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Now, set up your WireGuard server endpoint with the following command, and remember to note the UDP port number:
wg-quick-config -add -start
Port Forwarding and Server Port Configuration
For external access to your VPN, set up port forwarding by following the guide for your home router or VPS provider.
Port Forward the WireGuard Server Port
It’s crucial to open and forward the WireGuard server port:
- For a home PC setup, forward the UDP port (or your custom port) to your local PC.
- On a VPS, forward the port and open the firewall through the admin panel.
- With DDNS, reconfigure it to point to the new port.
By following these steps, you’ll establish a robust and secure VPN server using WireSock VPN Gateway on Windows Server Core.