Skip to content

Instantly share code, notes, and snippets.

@aadlani
Last active June 28, 2017 19:15
Show Gist options
  • Select an option

  • Save aadlani/fc6637654020f0387e5d52157de5c51f to your computer and use it in GitHub Desktop.

Select an option

Save aadlani/fc6637654020f0387e5d52157de5c51f to your computer and use it in GitHub Desktop.
ifconfig $(ip route list | awk '/^default/ {print $5}') | grep -sw "inet" | tr ":" " " | awk {'print $3"."$7'} | { IFS=. read -r i1 i2 i3 i4 m1 m2 m3 m4; printf "push \"route %d.%d.%d.%d %d.%d.%d.%d\"\n" "$((i1 & m1))" "$((i2 & m2))" "$((i3 & m3))" "$((i4 & m4))" $m1 $m2 $m3 $m4; } | sed '/your local subnet/ r /dev/stdin' /etc/openvpn/server.conf | uniq | sudo tee /etc/openvpn/server.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment