Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. /etc/NetworkManager/NetworkManager.conf
  2.  
  3. [main]
  4. plugins=ifupdown,keyfile
  5.  
  6. [ifupdown]
  7. managed=False
  8.  
  9. #######################################################
  10. /etc/NetworkManager/dispatcher.d/01ifupdown
  11.  
  12. #!/bin/sh -e
  13. # Script to dispatch NetworkManager events
  14. #
  15. # Runs ifupdown scripts when NetworkManager fiddles with interfaces.
  16. # See NetworkManager(8) for further documentation of the dispatcher events.
  17.  
  18. # We do not handle connectivity-change events in ifupdown so simply exit at
  19. # this point
  20. if [ "$2" = "connectivity-change" ]; then
  21. exit 0;
  22. fi
  23.  
  24. if [ -z "$1" ]; then
  25. echo "$0: called with no interface" 1>&2
  26. exit 1;
  27. fi
  28.  
  29. if [ -n "$IP4_NUM_ADDRESSES" ] && [ "$IP4_NUM_ADDRESSES" -gt 0 ]; then
  30. ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
  31. fi
  32. if [ -n "$IP6_NUM_ADDRESSES" ] && [ "$IP6_NUM_ADDRESSES" -gt 0 ]; then
  33. ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
  34. fi
  35.  
  36. # If we have a VPN connection ignore the underlying IP address(es)
  37. if [ "$2" = "vpn-up" ] || [ "$2" = "vpn-down" ]; then
  38. ADDRESS_FAMILIES=""
  39. fi
  40.  
  41. if [ -n "$VPN_IP4_NUM_ADDRESSES" ] && [ "$VPN_IP4_NUM_ADDRESSES" -gt 0 ]; then
  42. ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet"
  43. fi
  44. if [ -n "$VPN_IP6_NUM_ADDRESSES" ] && [ "$VPN_IP6_NUM_ADDRESSES" -gt 0 ]; then
  45. ADDRESS_FAMILIES="$ADDRESS_FAMILIES inet6"
  46. fi
  47.  
  48. # We're probably bringing the interface down.
  49. [ -n "$ADDRESS_FAMILIES" ] || ADDRESS_FAMILIES="inet"
  50.  
  51. # Fake ifupdown environment
  52. export IFACE="$1"
  53. export LOGICAL="$1"
  54. export METHOD="NetworkManager"
  55. export VERBOSITY="0"
  56.  
  57. for i in $ADDRESS_FAMILIES; do
  58.  
  59. export ADDRFAM="$i"
  60.  
  61. # Run the right scripts
  62. case "$2" in
  63. up|vpn-up)
  64. export MODE="start"
  65. export PHASE="post-up"
  66. run-parts /etc/network/if-up.d
  67. ;;
  68. down|vpn-down)
  69. export MODE="stop"
  70. export PHASE="post-down"
  71. run-parts /etc/network/if-post-down.d
  72. ;;
  73. # pre-up/pre-down not implemented. See
  74. # https://bugzilla.gnome.org/show_bug.cgi?id=387832
  75. # pre-up)
  76. # export MODE="start"
  77. # export PHASE="pre-up"
  78. # run-parts /etc/network/if-pre-up.d
  79. # ;;
  80. # pre-down)
  81. # export MODE="stop"
  82. # export PHASE="pre-down"
  83. # run-parts /etc/network/if-down.d
  84. # ;;
  85. hostname|dhcp4-change|dhcp6-change)
  86. # Do nothing
  87. ;;
  88. *)
  89. echo "$0: called with unknown action \`$2'" 1>&2
  90. exit 1
  91. ;;
  92. esac
  93. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement