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 have a simple openvpn configuration.

dev tun
secret static.key
keepalive 10 60

When the link come up, the routing table is updated.

[me@localhost ~]$ ip route dev tun0  proto kernel  scope link  src dev eth0  proto kernel  scope link  src dev br0  proto kernel  scope link  src dev eth0  scope link  metric 1002 dev br0  scope link  metric 1004
** via dev tun0**
default via dev eth0

When the packets arrive at the other end ( the source ip address is But I want the source address to be I can run this command

[me@localhost ~]$ sudo ip route change via src

to make this change. Now the source address is what I want it to be ( The last part of the puzzle is what my question is all about.

How can I get OpenVPN to set the route up this way when the link is first established?

share|improve this question
Your vpn server should have a "push route ..." statement in the configfile so that the client's route is set correctly. – ott-- Jul 23 '13 at 21:09
up vote 1 down vote accepted

I can't get access to my server. But I remember that you can make a custom ifconfig or route config file for every PC that make a connection to the VPN server.

share|improve this answer
Right. openvpn has the --up option. I'll check it out. – Michael Closson Jul 23 '13 at 18:27
Maybe you could show/explain how to do this? – slm Aug 9 '13 at 14:33
The parameter route-up seems to work. Rather than spec the route w/ route, I used route-up "/sbin/ip route add via src" – Michael Closson Aug 21 '13 at 16:32

I'm not sure about openvpn but pptpd allows you to store your user accounts an a mysql database and specify a framed ip address for each user when using the freeradius-mysql plugin for pptpd.

Here is a configuration tutorial:

share|improve this answer
Wow. I had no idea that pptpd allow such flexibility. Thank for the link! – Michael Closson Aug 21 '13 at 16:39

Your Answer


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.