Source routing for a VPN node in Linux
Occansion in Linux when running a VPN you want to generate traffic from the VPN server node. By default Linux uses the IP of the interface used to route a package. The might often complicated the routing tables required at client networks.
A solution to fix this issue is to use Linux source/policy routing. For example, for node with IP 192.168.10.1 and VPN server IP 172.29.148.1, route to subnet 192.168.9.0/24 out 172.29.148.1 via 172.29.148.2 with src (source) IP 192.168.10.1:
sudo ip route add to 192.168.9.0/24 src 192.168.10.1 via 172.29.148.2