scripts in if-up.d not executed when ppp connection is created

7,162

For example put this script in /etc/ppp/ip-up.d/ to make default route to ppp0 interface every time when go up, make script called script with execute permissions 755

sudo nano /etc/ppp/ip-up.d/script

# Check for specific interface if desired
[ "$PPP_IFACE" != "ppp0" ] || exit 0
# Do something
sudo route add default dev ppp0
chmod 755 /etc/ppp/if-up.d/script

Try

Share:
7,162

Related videos on Youtube

Kumar
Author by

Kumar

Updated on September 18, 2022

Comments

  • Kumar
    Kumar almost 2 years

    I have a simple script "test" in /etc/network/if-up.d directory. The script contains below commands. It creates a empty text file, whenever an interfaces changes state from down to up.

    #!/bin/bash
    sudo touch /home/duser/test1.txt
    

    But the script is not executing when ppp connection is established. The ppp connection belongs to an usb-modem. The pppd daemon will be initiated by wvdial. I tried disconnecting and connecting my wlan, then the script is executing. But it doesn't work for ppp. Note: The script have 755 permission

    • muru
      muru about 9 years
      Use /etc/ppp/ip-up.d instead, if the script is specifically for ppp.
    • RikiRiocma
      RikiRiocma over 6 years
      sometimes it needs to have a prefix like '0000script' otherwise it does not works.
  • Redanium
    Redanium over 8 years
    I did the edit :)
  • FarK
    FarK almost 5 years
    I am pretty sure there is no need for sudo inside script