I have a simple openvpn configuration.
remote 18.104.22.168 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?