Linux multihome openvpn

Setup of OpenVpn on multihome box.

Problem is Openvpn answers udp packets back using default Gw, and selects different ip than incoming ip.


  1. OpenVpn: Bind to all interfaces.

    • Linux selects int/ip based on routing. Local gen packets select int before mangle can replace fwmark.
  2. OpenVpn: Bind to lo:, use nat to nat incoming on udp:1194 to

    • X-( Kernel bug ? Still selecting wrong source

  3. OpenVpn: Multiple instances each bound to specific ext ip.

    • WORKS! but need separate subnet for each instance, thus client ip changes when re-connects.
    • (!) Setup OpenVpn to add host routes as they activate ?

  4. OpenVpn: Solution - :-) bind to a real interface

    • Solution :-) bind to single ip real inside int. (loop does not work ? bug X-( -Maybe need sysctl -w net.ipv4.conf.all.route_localnet=1 )

    • Nat external to real int.
    • Tested can connect to any of the external ip's
    • My guesse as to why it works is that the packets are seen as being routed out ? e.g. bash script to setup nat.
             iplist_FWext="e1= e2= e3="
             for i in ${iplist_FWext}; do
                nat to-destination "${iphost_FWint}" dport 1194 proto udp dst "${fw_ip}"

CategoryLinux CategoryVpnTunnel

vigor: linux/multihome/openvpn (last edited 2017-11-03 21:54:26 by PieterSmit)