Advertisement
teknoraver

ppp netns dns

Sep 30th, 2017
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ns=${PPP_IFACE#*-}
  4.  
  5. . /etc/ovhpass
  6.  
  7. domain=$ns.teknoraver.net
  8.  
  9. # create bind mount in /var/run/netns
  10. if ! [ -d /var/run/netns ]; then
  11.         ip netns add $$
  12.         ip netns del $$
  13. fi
  14.  
  15. pid=$(machinectl show -p Leader --value $ns)
  16. nsmount=/var/run/netns/$ns
  17. >$nsmount
  18. mount --bind /proc/$pid/ns/net $nsmount
  19.  
  20. ip link set dev $PPP_IFACE netns $ns
  21. ip -n $ns addr add dev $PPP_IFACE $IPLOCAL/32
  22. ip -n $ns link set dev $PPP_IFACE up
  23. ip -n $ns route del default
  24. ip -n $ns route add default dev $PPP_IFACE
  25.  
  26. ip netns exec $ns curl -s "http://$user:$pass@www.ovh.com/nic/update?system=dyndns&hostname=$domain"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement