I have reached a milestone!!! I figured out how to setup a VPN to my home computer, which allows me do access my local network.
Problem is, I cant seem to get ta.key to generate but im not worried about it right now:
Future Update: Tailscale is here, use this instead, not worth the hassle of using anything else or setting up VPN.
The instructions below are for setting up OpenVPN on Windows using Command Prompt (CMD) and Windows tools.
EasyRSA is used to create the security certificates for your VPN. Here are the instructions for Windows:
cd "C:\Program Files\OpenVPN\easy-rsa"
EasyRSA-Start.bat ./easyrsa init-pki
./easyrsa build-ca
./easyrsa gen-req server nopass ./easyrsa sign-req server server
./easyrsa gen-dh
./easyrsa gen-req client1 nopass ./easyrsa sign-req client client1
openvpn --genkey --secret ta.key
Now that you have the necessary certificates and keys, you can configure the OpenVPN server:
cd "C:\Program Files\OpenVPN\config"
port 1194 proto udp dev tun ca ca.crt cert server.crt key server.key dh dh.pem server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt keepalive 10 120 cipher AES-256-CBC persist-key persist-tun status openvpn-status.log verb 3
client dev tun proto udp remote [YourHomeNetworkPublicIP] 1194 resolv-retry infinite nobind persist-key persist-tun ca ca.crt cert client1.crt key client1.key remote-cert-tls server cipher AES-256-CBC verb 3
Losing internet access after connecting to a VPN is a common issue, especially when you configure OpenVPN to route all traffic through the VPN (full tunneling). Here are the most common reasons for this issue and how to fix it:
1. Ensure IP Forwarding Is Enabled on the VPN Server
The server must forward traffic between the VPN network and the internet.
On Linux:
sudo nano /etc/sysctl.conf
#net.ipv4.ip_forward = 1
net.ipv4.ip_forward = 1
sudo sysctl -p
On Windows:
2. Set Up NAT (Network Address Translation) on the VPN Server
If NAT isn't properly set up, traffic won't be routed to the internet from the VPN clients. This is common in full tunneling setups.
On Linux:
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
sudo iptables-save > /etc/iptables/rules.v4
On Windows:
3. Verify the DNS Configuration on the Client
Sometimes, even if traffic is being routed through the VPN, the DNS settings may not be configured properly, preventing domain names from being resolved (for example, if you can access websites by IP but not by domain name).
* Ensure DNS Servers Are Pushed from the Server:
In your server configuration file (`server.ovpn` or `server.conf`), make sure DNS servers are being pushed to the clients. Add the following lines if they are missing: <code> push "dhcp-option DNS 8.8.8.8" # Google's DNS push "dhcp-option DNS 8.8.4.4" # Secondary DNS </code>
* Modify the Client Configuration (`client.ovpn`):
In your client configuration file (`client.ovpn`), ensure DNS settings are configured correctly: <code> dhcp-option DNS 8.8.8.8 # Google DNS dhcp-option DNS 8.8.4.4 </code>
* Reconnect the client and verify if the DNS issues are resolved.
4. Test and Verify Routing
After implementing these fixes, reconnect to the VPN and test if the internet connection is working:
Open Command Prompt (on Windows) or a terminal (on macOS/Linux) and type:
<code> ping google.com </code> * If you can ping the domain, DNS is working correctly. * If the ping succeeds with an IP address but fails with a domain name, DNS may still be misconfigured. * **Check the routing table (optional)**: On Windows, open Command Prompt and type: <code> route print </code> On Linux/macOS, use: <code> netstat -rn </code> Ensure that the default gateway (`0.0.0.0`) is pointing to the VPN interface (`10.8.0.1` or similar).
5. Check Firewall Rules
If the above solutions don’t work, verify that firewalls on both the server and the client are not blocking the VPN traffic.
On the VPN server:
On the client machine:
To fix the issue where you lose internet connectivity after connecting to the VPN:
Let me know if you'd like more detailed help with any of the steps!