Peter Stuge wrote: > Your /usr/share/udhcpc/default.script to accomplish this would be: > > #!/bin/sh > test "$1" = bound || exit 0 > sed -i "/^local /s/.*/local $ip/" /etc/openvpn/something/local.conf > /etc/init.d/openvpn.something restart > > > This covers initial config and reconfig. Zero distro changes. How > much simpler do you need?
Actually no, you get to also apply address changes. So more like this: #!/bin/bash case "${1}" in deconfig) ip a f dev "${interface}" ;; bound) ip a a "${ip}/${mask}" dev "${interface}" ip r a default via "${router}" dev "${interface}" sed -i "/^local /s/.*/local ${ip}/" /etc/openvpn/something/local.conf /etc/init.d/openvpn.something restart ;; *) exit 1 ;; esac exit 0 (Might work also with plain sh, but this is similar to what I had in production so known working, as opposed to the previous which I just wrote from memory. :) Suggest you name (or at least symlink) the vpn config to the interface name, then the above can be generic for all interfaces by substituing ${interface} for "something". //Peter