Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

Strange /etc/ppp/auth-up script work

Discussion in 'Command Line' started by mequasar, May 30, 2017.

  1. mequasar

    mequasar New Member

    Joined:
    May 30, 2017
    Messages:
    3
    Likes Received:
    2
    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.
     
  2. atanere

    atanere Moderator
    Gold Supporter

    Joined:
    Apr 6, 2017
    Messages:
    167
    Likes Received:
    125
    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
     
  3. mequasar

    mequasar New Member

    Joined:
    May 30, 2017
    Messages:
    3
    Likes Received:
    2
    Hi! Nope, this work in debian
    [email protected]:/etc/ppp# route add -net 192.168.120.0/24 dev ppp0
    [email protected]:/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
    [email protected]:/etc/ppp#
     
  4. mequasar

    mequasar New Member

    Joined:
    May 30, 2017
    Messages:
    3
    Likes Received:
    2
    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.
     
    atanere and Rob like this.
  5. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    147
    Likes Received:
    398
    Great - thanks for posting the resolution!
     
  6. atanere

    atanere Moderator
    Gold Supporter

    Joined:
    Apr 6, 2017
    Messages:
    167
    Likes Received:
    125
    Nice job!
     

Share This Page