Linux Cable script - pptp
-- Tested under Redhat
9 but will work probably with other distros as
well.
-- Use this procedure at your own risk !!!
-- For any 'username' put in your user name and for 'password' put in your
password.
** The following procedures including the connection,
MUST be done as root from terminal **
1.
Check that you have pptp client (
usually at /usr/sbin/pptp ).
locate pptp
If the path is different, please update it in cablestart file, instead of /usr/sbin/pptp
.
If you don't have a PPTP client
install, you can download it from a link below:
For Debian Sarge:
pptp-linux_1.5.0-5_i386.deb
and type: dpkg --install pptp-linux_1.5.0-5_i386.deb
For RedHat/Fedora: pptp-linux-1.5.0-3.i386.rpm
and type: rpm --install pptp-linux-1.5.0-3.i386.rpm
2. Update
your pap-secrets file with your favorite editor:
vi /etc/ppp/pap-secrets
"username " "172.26.255.242" "password"
3. Update
your resolv.conf file with your favorite editor:
vi /etc/ppp/resolv.conf
nameserver
217.22.112.7
nameserver
217.22.113.251
4. Download : cablestart
and cablestop scripts, and save them in /usr/sbin/ directory.
cablestart:
#!/bin/bash
USERNAME=username
IF=eth0
/sbin/ifdown $IF
/sbin/ifup $IF
CABLEGW=`/sbin/route
-n | grep ^0.0.0.0 | awk
'{print $2}'`
/sbin/route add -host
172.26.255.242 gw $CABLEGW
/sbin/route del
default
/usr/sbin/pptp
172.26.255.242 debug user $USERNAME mtu 1460 mru 1460 defaultroute usepeerdns noauth
sleep 10
echo "nameserver
217.22.112.7" > /etc/resolv.conf
echo "nameserver
217.22.113.251" >> /etc/resolv.conf
cablestop:
#!/bin/bash
killall pptp;
/etc/init.d/network
restart;
5. Make sure both files are executable:
chmod a+x /usr/sbin/cablestart
chmod a+x
/usr/sbin/cablestop
6. To Connect, type:
cablestart
7. To
Disconnect, type:
cablestop
Linux Cable script - l2tp
-- Tested under CentOs
4.2, Fedora Core 4, debian Sarge,
SuSe 9.3, ManDrake 10.1, -
but will work probably with other distros as
well.
-- Use this procedure at your own risk !!!
-- For any 'username' put in your user name and for 'password' put in your
password.
** The following procedures including the connection,
MUST be done as root from terminal **
1. Install the
rp-l2tp-0.4 package.
** If you use RedHat
based disrto you can use this rpm: rp-l2tp-0.4-1jdl.i386.rpm,
type rpm -Uhv rp-l2tp-0.4-1jdl.i386.rpm to install. **
** If you use a Debian
based distro you can use this deb:
rp-l2tp_0.4-2_i386.deb,
type dpkg -i rp-l2tp_0.4-2_i386.deb to install. **
If you don't have the package, you can download
it from here: rp-l2tp-0.4.tar.gz
Open the package by writting
tar -vzxf rp-l2tp-0.4.tar.gz. (Need to have gcc install!!)
In the rp-l2tp-0.4 directory type
./configure, after it is ended type make
and make install.
2. Update your pap-secrets
file with your favorite editor:
vi /etc/ppp/pap-secrets
"username " "172.26.255.242" "password"
3. Update your resolv.conf file with your favorite editor:
vi /etc/ppp/resolv.conf
nameserver
217.22.112.7
nameserver
217.22.113.251
4. Setting l2tp.conf in
/etc/l2tp
Download l2tp.conf and
place it in /etc/l2tp, edit it and enter your username.
5. You can Download this
script: l2tpconnect
and save them in /usr/sbin/ directory, to activate it
type down l2tpconnect start,
and to dissconnect l2tpconnect
stop.
Or you Download this
simple script which is written below: cablestart2 and cablestop2
scripts, and save them in /usr/sbin/ directory.
cablestart:
#!/bin/bash
LNS=172.26.255.242l'
IF=eth0
/sbin/ifdown $IF
/sbin/ifup $IF
CABLEGW=`/sbin/route
-n | grep ^0.0.0.0 | awk
'{print $2}'`
/sbin/route add -host
$LNS gw $CABLEGW
/sbin/route del
default
/usr/local/sbin/l2tpd
sleep 1
/usr/local/sbin/l2tp-control "start-session
$LNS" > /var/run/l2tp-$LNS
sleep 1
echo "nameserver
192.114.47.4" > /etc/resolv.conf
echo "nameserver
192.114.47.52" >> /etc/resolv.conf
cablestop:
#!/bin/bash
killall l2tpd;
if [ -e /etc/init.d/networking
]
then
/etc/init.d/networking
restart
else
/etc/init.d/network
restart
fi
5. Make sure both files are executable:
chmod a+x /usr/sbin/cablestart
chmod a+x
/usr/sbin/cablestop
6. To Connect, type:
cablestart
7. To
Disconnect, type:
cablestop