M
M
mequasar2017-05-31 07:02:03
linux
mequasar, 2017-05-31 07:02:03

Why doesn't route from /etc/ppp/auth-up work?

I'm trying to run the /etc/ppp/auth-up script: For
those who don't know, this predefined file, which is triggered when a ppp user logs in, comes with arguments $1 as the name of an interface like ppp0, ppp1, etc
$2 as the name of a peer (defined, for example, in / ppp/chap-secrets)
#Script start
!#/bin/sh
if [ "$2" == "someusername" ]; then
echo $1 >> /var/test
route add -net 192.168.xx/24 dev $1
fi
When the ppp user logs in, the script fires, the condition is met because test is being written to, and $1 has a valid value (ppp0). But the route is not registered. However, if instead of $1, for example, write ppp0, then it works. Any ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mequasar, 2017-05-31
@mequasar

Thank you all, the solution has been found. The thing is that the auth-up script works so fast that ppp devices do not have time to rise. In the form below, the script runs successfully:
#Script start
!#/bin/sh
if [ "$2" == "someusername" ]; then
echo $1 >> /var/test
sleep 10
route add -net 192.168.xx/24 dev $1
fi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question