ip-up.local 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. #
  3. # FFHO ip-up replacement script (Salt managed)
  4. #
  5. # Using a ip-up.local script intentionally PREVENTS ALL OTHER ip-up.d/ scripts
  6. # from being called. We don't want that stuff.
  7. #
  8. #
  9. # This script is run by the pppd after the link is established.
  10. #
  11. # This script is called with the following arguments:
  12. # Arg Name Example
  13. # $1 Interface name ppp0
  14. # $2 The tty ttyS1
  15. # $3 The link speed 38400
  16. # $4 Local IP number 12.34.56.78
  17. # $5 Peer IP number 12.34.56.99
  18. # $6 Optional ``ipparam'' value foo
  19. # The environment is cleared before executing this script
  20. # so the path must be reset
  21. PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
  22. export PATH
  23. cat << EOF > /usr/local/sbin/fix_ppp_vrf.gen
  24. #!/bin/sh
  25. while ! ip a s dev ppp0 | grep -q "inet "; do
  26. sleep 1
  27. done
  28. ip link set ${1} master vrf_external
  29. ip link set ${1} up
  30. ip route add default via ${5} table 1023
  31. # ET... Phone... Home.
  32. ip vrf exec vrf_external wget --max-redirect=0 --header="Host: noc.ffho.net" http://80.70.180.55/et-phone-home/$(hostname -f)
  33. EOF
  34. chmod 755 /usr/local/sbin/fix_ppp_vrf.gen
  35. at -f /usr/local/sbin/fix_ppp_vrf now