Autoroute pptp client

For auto routing on my pptp server I use similar script like this but with ${IPREMOTE} parameter

cat << "EOF" > /etc/ppp/ip-up
#!/bin/sh
case ${PEERNAME} in
(USERNAME1) ... ;;
(*) ... ;;
esac
EOF
chmod +x /etc/ppp/ip-up

So I really want to use the same concept on my client router

But I don't know the names of parameters for client like ${} , or pptp client can't do such thing ?

1 Like
mkdir -p /etc/ppp/ip-up.d
cat << "EOF" > /etc/ppp/ip-up.d/custom.sh
#!/bin/sh
logger -t pppsh ${0} ${@} $(env)
EOF
chmod +x /etc/ppp/ip-up.d/custom.sh
ifup vpn
sleep 5
logread -e pppsh

But I think it's best to avoid using PPP scripts on the client side.
PPTP client is managed by netifd which cannot track changes outside of the UCI config.
So, setting up routes is recommended using native UCI syntax:
https://openwrt.org/docs/guide-user/network/routes_configuration

3 Likes

So I can make just static route ?
Like this

I have already in my /etc/config/network

config interface 'vpn'                                                                 
        option proto 'pptp'                                                            
        option ipv6 'auto'                                                             
        option server '92.18.10.10'                                                  
        option defaultroute '0'                                                        
        option password 'crml'                                                     
        option username 'vpnic'

So I just add

config route
        option interface 'vpn'
        option target '192.168.100.0'
        option netmask '255.255.255.0'
        option gateway '192.168.27.27'

But there is no gateway before connnection , would it work

1 Like

You can specify the target as 192.168.100.0/24 and remove netmask and gateway.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.