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

I have a simple openvpn configuration.

remote 1.2.3.4
dev tun
ifconfig 10.74.1.13 10.75.2.1
secret static.key
route 10.75.0.0 255.255.0.0
keepalive 10 60

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

[me@localhost ~]$ ip route
10.75.2.1 dev tun0  proto kernel  scope link  src 10.74.1.13
10.21.54.0/24 dev eth0  proto kernel  scope link  src 10.21.54.133
10.74.0.0/16 dev br0  proto kernel  scope link  src 10.74.0.13
169.254.0.0/16 dev eth0  scope link  metric 1002
169.254.0.0/16 dev br0  scope link  metric 1004
**10.75.0.0/16 via 10.75.2.1 dev tun0**
default via 10.21.54.2 dev eth0

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

[me@localhost ~]$ sudo ip route change 10.75.0.0/16 via 10.75.2.1 src 10.74.0.13

to make this change. Now the source address is what I want it to be (10.74.0.13). 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

2 Answers 2

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 10.75.0.0 255.255.0.0, I used route-up "/sbin/ip route add 10.75.0.0/16 via 10.75.2.1 src 10.74.0.13" –  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:

http://www.pmoghadam.com/homepage/HTML/slackware-12.2-poptop-freeradius-mysql-pppoe-server.html

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

 
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.