open VPN with server internet
-
I have my Open VPN server, but I need them to connect to the VPN from home to access the internet using the server's or the location where I have the firewall.
Because when I check the public browsing IP, it shows the home IP, not the location. -
It sounds like your VPN is successfully connecting, but it’s only routing traffic for internal access—not tunneling all internet traffic through the VPN server. To make sure all traffic, including public browsing, uses the VPN’s location/IP, you need to enable full tunnel routing.
Here’s what you should check and configure:
Server Configuration (server.conf or openvpn.conf)
Add this line:push "redirect-gateway def1 bypass-dhcp"
This tells the client to route all internet traffic through the VPN.
Enable IP Forwarding on the VPN Server
On Linux:echo 1 > /proc/sys/net/ipv4/ip_forward
Or permanently in /etc/sysctl.conf:
net.ipv4.ip_forward = 1
Configure NAT on the Server (iptables example)
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
Replace 10.8.0.0/24 with your VPN subnet and eth0 with your actual network interface.
Client Configuration
Make sure the client doesn’t override the redirect:Remove any pull-filter ignore "redirect-gateway" line
Allow the server-pushed route
If you're planning to serve multiple clients or rotate egress IPs, consider integrating proxy rotation on the VPN server side. This can be done with tools like a rotating outbound proxy pool or IPtables-based policy routing, especially useful for web scraping, testing, or anonymization scenarios.