Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm currently running an OpenVPN server for multiple clients. All traffic is directed through the VPN (it's set up as gateway; push "redirect-gateway def1").

So far, all is working fine. However, I'd like to connect a couple of servers to this virtual private network, without these servers using the OVPN daemon as gateway.

These servers have to be accessible from both their WAN as well as their LAN IP address. Certain services will be accessible only from the LAN side.

Is there any way, for a client, to ignore the push redirect-gateway option?

Kind regards, Tuinslak

share|improve this question
    
Great question... I was asking myself exactly the same thing. –  Antoine Benkemoun Apr 6 '10 at 8:05

5 Answers 5

Just add "route-nopull" to the client openvpn config, then all pushed commands from the server are ignored. To get access to the local net, you must now add e.g. "route 192.168.5.0 255.255.255.0" to the client openvpn config, if the local net you want to connect to is 192.168.5.0/24.

share|improve this answer

if 'redirect-gateway' is required for some but not all clients then add a 'client-config-dir' option e.g.

  client-config-dir /etc/openvpn/clients

and inside that directory put files for each client CN, e.g. file Client1 would contain

  push-reset

that way the servers don't get the 'redirect-gateway' pushed by default.

HTH

share|improve this answer
    
worked for me! thanks! –  Sirber Jan 4 '12 at 18:30
    
I guess this would reset every pushed option (including DNS servers)? –  Tuinslak Feb 26 '12 at 0:59

just replace the default gateway in --up script an you are all set. You don't even have to do anything in --down (I think) or just set it to up.sh as well.

in client.conf

up up.sh

in up.sh (chmod +x)

#!/bin/bash
/sbin/ip route replace default 1.2.3.4

where 1.2.3.4 is your client's default gateway

share|improve this answer

can you remove the push "redirect-gateway def1" line from the client config? I can't remember if it's required.

share|improve this answer
    
The "redirect-gateway def1" line is on the server config, it's not in the client config files. –  Tuinslak Mar 13 '10 at 14:11
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  dawud May 17 at 15:06

Remvoe "redirect-gateway" option in the client configure file, the client's default gateway won't change anymore. tested under Archlinux/OpenVPN 2.3.2.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.