Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to route all internet traffic through a VPN client, so if the VPN somehow lose connection, nobody can find my real IP. So if VPS goes down, so my internet access. I'm using OpenVPN with this VPN provider : on a XP virtual machine (Vbox)

Side question ; This client requires password to connect, is there anyway that it can autoconnect on startup ?

share|improve this question

Maybe it's sufficient to disable DHCP for your ethernet connection and not specify a gateway (or configure your DHCP server to not push the standard gateway if that is possible), then you should not have internet access by default. Then you need to configure your OpenVPN connection with the redirect-gateway option to route all traffic through the VPN. That might do the trick (not tested though).

share|improve this answer

You can push openvpn redirect-gateway option to the client. There are some drawbacks (including performance degradation) and an explanation of how to do it: openVPN-redirect

Don't disable your DHCP or default gateway or you won't be able to reach the openVPN server so the VPN will not happen. Let openVPN do that after connecting.

Another option that seems better to me if you want to hide your personnal IP would be to install a proxy on your VPS and connect to the internet through it.

share|improve this answer

You can use openSSL to remove the password.

openssl rsa -in key.pem -out newkey.pem

If you don't have openSSL installed on your machine, ask support to remove the password for you.

You could also make a couple of batch file scripts, one to connect and one to disconnect. This will basically null and void your default gateway on disconnect.

i.e something like the following..

protectme.bat ----> has the following line

netsh interface ip set address name="Local Area Connection" gateway= gwmetric=0


name= The name of your Network connection.
gateway= A NULL gateway IP, i.e if your current default gateway is, change it to the above so that way when the VPN disconnects it cannot access the internet as it's pointed to the incorrect Default Gateway.

enableme.bat ---> has the following line

netsh interface ip set address name="Local Area Connection" gateway= gwmetric=0


name= the name of your Network connection
gateway= The real gateway IP address!

I've tested these commands in windows XP, but they might be slightly different for Vista or 7.

So, if you did the above, the process would work like this.

  1. Connect to VPN.
  2. Run Protectme.bat
  3. VPN Disconnects.
  4. Run enableme.bat

It's not the best solution, however it will do what you wish.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.