5 # Set to "C" locale so we can parse messages from commands
9 if test "`id -u`" != 0 ; then
10 echo "$0: You must be root to run this script" >& 2
14 CONFIG
=/etc
/ppp
/pptp.conf
17 if test ! -f "$CONFIG" -o ! -r "$CONFIG" ; then
18 echo "$0: Cannot read configuration file '$CONFIG'" >& 2
24 for i
in /etc
/ppp
/ppp-cable.pid
/var
/run
/ppp-cable.pid
; do
27 #Check if still running
28 kill -0 $PID > /dev
/null
2>&1
30 echo "$ME: There already seems to be a connection up (PID $PID)" >& 2
38 for i
in /usr
/sbin
/pptp-linux .
/pptp-linux
"`which pptp`" ; do
39 if test -x "$i" ; then
44 if [ ! -x "$i" ] ; then
45 echo "Couldn't find any pptp executable , please reinstall."
49 # Check for command-line overriding of USER and ETH
60 ##Check if ethx NIC is up and running.
61 netstat
-rn |
grep " ${ETH}\$" > /dev
/null
62 /sbin
/ifconfig
$ETH |
grep "UP.*RUNNING" > /dev
/null
63 if [ "$?" != "0" ] ; then
64 echo "Your $ETH interface isn't UP and/or RUNNING"
68 DGW
=$
(route
-n |
grep "^0.*eth"|
awk '{ print $2 }')
69 if [ "$DGW" = "" ] ; then
70 DGW1
=$
(route
-n|
grep "UGH.*eth"|
awk '{ print $2 }' )
71 if [ "$DGW1" = "" ] ; then
73 echo "Something is Fishy with your routing table, no Default Gateway"
79 route add default gw
$DGW 2> /dev
/null
83 # Check that config file is sane
84 if test "$USER" = "" ; then
85 echo "$0: Check '$CONFIG' -- no setting for USER" >& 2
88 if test "$ETH" = "" ; then
89 echo "$0: Check '$CONFIG' -- no setting for ETH" >& 2
92 if test "$SERVERADDR" = "" ; then
93 echo "$0: Check '$CONFIG' -- no setting for SERVERADDR" >& 2
99 # MTU of Ethernet card attached to modem MUST be 1500.
100 ifconfig
$ETH up mtu
1500
101 modprobe ppp_generic
> /dev
/null
2>&1
102 modprobe ppp_async
> /dev
/null
2>&1
104 # If DNSTYPE is SERVER, we must use "usepeerdns" option to pppd.
105 if test "$DNSTYPE" = "SERVER" ; then
109 if test "$PEERDNS" = "yes" ; then
115 if test "$PERSIST" != "no" ; then
121 if test "$DEFAULTROUTE" != "no" ; then
122 DEFAULTROUTE
="defaultroute"
124 DEFAULTROUTE
="nodefaultroute"
127 # Standard PPP options we always use
128 PPP_STD_OPTIONS
="noipdefault noauth default-asyncmap noipx $DEFAULTROUTE hide-password nodetach maxfail 1 lcp-max-configure 6 linkname cable ipparam cable-pptp $PEERDNS $PERSIST mtu 1460 mru 1460 noproxyarp noaccomp nobsdcomp nodeflate nopcomp user $USER lcp-echo-interval $LCP_INTERVAL lcp-echo-failure $LCP_FAILURE $PPPD_EXTRA"
131 if test "$OVERRIDE_PPPD_COMMAND" != "" ; then
132 setsid
$OVERRIDE_PPPD_COMMAND &
134 setsid pppd
$PPP_STD_OPTIONS \
135 pty
"$PPTP_CMD $SERVERADDR $PPTP_EXTRA --nolaunchpppd" &