2

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?

Michael Closson
  • 221
  • 1
  • 4
  • 10
  • 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 Answers2

1

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.

slm
  • 7,615
  • 16
  • 56
  • 76
John Smith
  • 36
  • 1
1

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

andrew
  • 131
  • 5