Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like my OpenVPN server to push a route down to the client with a different default gateway.

Specifically, my OpenVPN server has an internal IP address of 10.0.0.1, and I would like it to push a route of 10.10.10.1/24 using gateway 10.0.0.2.

Is it possible to do this by specifying a push route in the server config file?

share|improve this question
1  
Based on man openvpn you should be able to push routes to clients using something like: push 'network/IP [netmask] [gateway] [metric]' –  josten Sep 17 '13 at 15:58
    
Are you saying you want to push "route 10.10.10.0 255.255.255.0" to the client, and then the VPN clients traffic to have a different default gateway (10.0.0.2) on the VPN server network? –  Drav Sloan Sep 17 '13 at 16:02
    
@DravSloan I want the client to access IP addresses on the 10.10.10.0/24 network via 10.0.0.2, but I don't want to change any of the other routing behavior of the VPN. –  Lorin Hochstein Sep 17 '13 at 16:46
    
@josten I tried doing: push "route 10.10.10.1/24 255.255.255.255 10.0.0.2", no go. –  Lorin Hochstein Sep 17 '13 at 17:03
2  
@LorinHochstein that should probably be push route "10.10.10.0 255.255.255.0 10.0.0.2 1" –  Drav Sloan Sep 17 '13 at 17:12
show 3 more comments

1 Answer 1

up vote 1 down vote accepted
push route "10.10.10.0 255.255.255.0 10.0.0.2 1"

From the openvpn man page:

--route network/IP [netmask] [gateway] [metric]

This tells the server config to "push" to the client, the route command which sets a nwtworking route of the 10.10.10.0/24 subnet via the gateway 10.0.0.2 with a metric of 1. Metrics are used to give "preference" if multiple routes exist (such that the lowest cost wins).

share|improve this answer
add comment

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.