Adding routes to VPN (pptpd)

There is a file for running commands when PPP goes up or down.

On CentOS it is located at /etc/ppp/ip-up  (create it if not)

Examples of


case "$5" in
                /sbin/route add -net gw
                /sbin/route add -net gw

# Add a route for each client that connects to server: 

/sbin/ip ro add $5/32 via dev $1 table office 

Make the script executable: chmod +x ip-up

Arguments available in ip-up scripts

Argument Description
$1 the interface name used by pppd (e.g. ppp3)
$2 the tty device name
$3 the tty device speed
$4 the local IP address for the interface
$5 the remote IP address
$6 the current IP address before connecting to the VPN
This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *