Strange /etc/ppp/auth-up script work

mequasar

New Member
Joined
May 30, 2017
Messages
3
Reaction score
2
Credits
0
Hello everybody!
Sorry for not perfect English.
Need help, I try to execute this script in /etc/ppp/auth-up:
It this file, $1 is interface name like ppp0, ppp1 etc
$2 is peer name (defined in /ppp/chap-secrets)


#Script start
!#/bin/sh

if [ "$2" == "someusername" ]; then
echo $1 >> /var/test
route add -net 192.168.x.x/24 dev $1
fi

After it, in shell
cat /var/test return values like ppp0, ppp1, and condition work, but route don't add.
T.y for any ideas.
 


Hello everybody!
Sorry for not perfect English.
Need help, I try to execute this script in /etc/ppp/auth-up:
It this file, $1 is interface name like ppp0, ppp1 etc
$2 is peer name (defined in /ppp/chap-secrets)


#Script start
!#/bin/sh

if [ "$2" == "someusername" ]; then
echo $1 >> /var/test
route add -net 192.168.x.x/24 dev $1
fi

After it, in shell
cat /var/test return values like ppp0, ppp1, and condition work, but route don't add.
T.y for any ideas.

Hi @mequasar, and welcome to the forums! I'm not a networking guru, but glancing at the man pages for route I do not see any examples for the /24 netmask. Have you tried like this instead?

route add -net 192.168.x.x netmask 255.255.255.0 dev $1

Cheers
 
Hi! Nope, this work in debian
root@hostname:/etc/ppp# route add -net 192.168.120.0/24 dev ppp0
root@hostname:/etc/ppp# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.64.128.1 0.0.0.0 UG 0 0 0 eth0
10.64.128.0 * 255.255.255.0 U 0 0 0 eth0
172.16.32.10 * 255.255.255.255 UH 0 0 0 ppp0
172.16.32.11 * 255.255.255.255 UH 0 0 0 ppp1
172.16.32.12 * 255.255.255.255 UH 0 0 0 ppp2
192.168.120.0 * 255.255.255.0 U 0 0 0 ppp0
root@hostname:/etc/ppp#
 
I find a solution. Moderators can close thread:
Script /etc/ppp/auth-up work so fast, that ppp devices don't have time to start up.
This is corrected script:

#Script start
!#/bin/sh
if [ "$2" == "someusername" ]; then
echo $1 >> /var/test
sleep 10
route add -net 192.168.x.x/24 dev $1
fi

Thank u.
 
Nice job!
 


Top