THE CABLES-DHCP-PPTP-HOWTO

Written by Amir Tal, Whatsup - Hebrew Linux Portal tal@whatsup.org.il
with the kind help of Meir Kriheli, MKsoft Systems mksoft@netvision.net.il
the Connection Script for Redhat Based systems was originated by Eran Shapira
ver 1.1 Sept. 2002

changelog :
some modifications were made to the connection script for connecting also with debian linux..

TODO :
* write a GUI, QT based connection tool, containing all israeli ISP's configuration needed to connect , both as RPM and DEB (help, anyone?)

*** if you have anything to add to this document, please drop me a line to : tal@whatsup.org.il

DISCLAIMER

The information in this document is based on two successful installations, on two diferent machines. I was able to connect my home box (RH 7.2) to netvision, via the "Aroozey Zahav" LAN.
also managed to connect from 2 diferent debian woody machines.

INTRODUCTION

On August 14th, Netvision (as well as other ISP's in israel) decided to make changes in the way they let users connect to them. the authontication method so far was via the cable company's web-page (asp based) and starting from the above date, they moved to PPTP.(dont ask me why..i guess for being able to control bandwidth and other usage information..) the settings are not much diferent from ADSL, but there are some diferences. (the BEZEQ ADSL HOWTO)

note that you will need to have the pptp-linux binary in your system in order to connect. you can either use the one netvision give, or get the
original one from pptp's homepage, its the same one.

Before we start (Pre-conditions) :

if you were already connected via cables before this setup, then you should have most of the configuration already in order, and you will only have to add the pptp part.
if this is the first time you are setting up your box to connect via the cables network, make sure that you have all
the following pre-conditions in order :

1)a DHCP configured nic connected to your cable modem
2)a cable modem ;)
3)root access to the machine you are installing on
4)the connection scripts and binary file from netvision. (eveh though the default pptp binary is *SUPPOSE* to work as well...


* In case you dont have the files mentioned in section 4, you can get them from here
the pptp-linux source code can be obtained here

LINUX INSTALLATION :

ok, here goes :

make sure you have your network up and running by running /sbin/ifconfig. should look something like that :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
 
$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:04:F8:D2:F8
          inet addr:10.40.x.x Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:174433 errors:0 dropped:0 overruns:0 frame:0
          TX packets:400412 errors:0 dropped:0 overruns:0 carrier:0
          collisions:77789 txqueuelen:100
          RX bytes:43386140 (41.3 Mb)  TX bytes:503506372 (480.1 Mb)
          Interrupt:11 Base address:0xc000
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8001 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8001 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:565386 (552.1 Kb)  TX bytes:565386 (552.1 Kb)
 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Note that this configuration relates to a machine that has only 1 network interface (eth0) which is the interface that this machine
uses to connect to the internet.
in case your machine has more then 1 interface, there will be anohter entry in the output of "ifconfig" (eth1 etc...)
also note the the addresses that apear in this HOWTO are examples taken from my machine, connected via golden channels. with other
ISP's, the addresses may look diferent (other ip classes) . i dont have a way to check that though...

once you have an internal ip address obtained from your cable service provier, you can continue to configuring PPTP.
untar the archived files (in case you STILL dont have them, grab from here)

(GNU tar and gunzip are required to be installed here...)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
tar xzvf netvision-connect.tar.gz
drwxr-xr-x tal/root          0 2002-08-15 11:58:19 netvision-connect/
-rwxr-xr-x tal/root        489 2002-08-15 11:58:19 netvision-connect/cablestart
-rwxr-xr-x tal/root         32 2002-08-15 11:58:19 netvision-connect/cablestop
-rwxr-xr-x tal/root     145757 2002-08-15 11:58:20 netvision-connect/pptp-linux

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

now cd into the created directory "netvision-connect", you should find 2 shell scripts and a binary there :
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
[tal@tal netvision-connect]$ ls -l
total 156
-rwxr-xr-x    1 tal      root          489 Aug 15 11:58 cablestart
-rwxr-xr-x    1 tal      root           32 Aug 15 11:58 cablestop
-rwxr-xr-x    1 tal      root       145757 Aug 15 11:58 pptp-linux

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

copy the pptp-linux binary to /usr/sbin/ (cp pptp-linux /usr/sbin/). it should have its permitions set to 755..
in case it doesnt : (chmode 755 /usr/sbin/pptp-linux)
its important that pptp-linux will be in /usr/sbin/ since the connection script will look for it there.
you may, however, place it elsewhere, and modify the script to fit your needs. The next step is to edit your /etc/ppp/pap-secrets, and adding your isp's username and password to it.
it should look like this :
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
# cat /etc/ppp/pap-secrets
# Secrets for authentication using PAP
# client        server  secret                  IP addresses
####### redhat-config-network will overwrite this part!!! (begin) ##########
####### redhat-config-network will overwrite this part!!! (end) ############
username cable.netvision.net.il password


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
the "username" and "password" should be replaced with your own username and password, given to you by your internet service provider. The next step is to add an entry to your /etc/ppp/options. add the word "usepeerdns" there. this means that the DNS's pushed from your isp will be used instead of the one's you get from the cable company. should look like this :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
# cat /etc/ppp/options
lock usepeerdns


You should also disable the "auth" option in that file. its not needed, and will cause for authontication problems for your pptp. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
the "lock" option will already be there, and "usepeerdns" in the same line after it.
*note : not adding "userpeerdns" will cause your system to use the dns definitions given to you initialy from the cable's provider DHCP server.
it may cause some problems with name rsolution after establishing a tunnel to your isp, so the "native" way is to use what your isp provides.

ok, now its time to start a call. this is done by executing the "cablestart" script. here's how it looks like :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 


#!/bin/bash
 
USERNAME="$1"
 
/sbin/ifdown eth0
/sbin/ifup eth0
 
CABLEGW=`cat /etc/dhcpc/dhcpcd-eth0.info | grep GATEWAY | cut -d"=" -f2`
 
/sbin/route add -host cable.netvision.net.il gw $CABLEGW
 
/usr/sbin/pptp-linux cable.netvision.net.il debug user $USERNAME remotename cable.netvision.net.il mtu 1460 mru 1460 defaultroute
 
sleep 5
 
NEWGW=$(/sbin/ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)
 
/sbin/route add default gw $NEWGW
/sbin/route del default gw $CABLEGW


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
attention debian users :

debian will look for its gw interval in /var/lib/dhcp/dhclient.leases, and not in /etc/dhcpc/dhcpcd-eth0.info
(as it is done in "RH like" systems...therefor, you will have to change 1 line in the above script. we are talking
about the line the grep's the CABLEGW from /etc/dhcpc/dhcpcd-eth0.info :

old line : CABLEGW=`cat /etc/dhcpc/dhcpcd-eth0.info | grep GATEWAY | cut -d"=" -f2`

new line : grep routers /var/lib/dhcp/dhclient.leases | tail -n 1| cut -d ";" -f1 | cut -d ' ' -f5

so, if you are using debian,your script should look like this : (just copy\paste it, modify what you need, chmod it to 755
and you are ready to go :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
 


#!/bin/bash
 
USERNAME="$1"
 
/sbin/ifdown eth0
/sbin/ifup eth0
 
CABLEGW=`grep routers /var/lib/dhcp/dhclient.leases | tail -n 1| cut -d ";" -f1 | cut -d ' ' -f5`
 
/sbin/route add -host cable.netvision.net.il gw $CABLEGW
 
/usr/sbin/pptp-linux cable.netvision.net.il debug user $USERNAME remotename cable.netvision.net.il mtu 1460 mru 1460 defaultroute
 
sleep 5
 
NEWGW=$(/sbin/ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)
 
/sbin/route add default gw $NEWGW
/sbin/route del default gw $CABLEGW
 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*NOTE !!! this script will restart your eth0 interface, in order to make sure you have an active DHCP address for it. it will also make changes to your kernel routing table.
you will need to add your username as well while executing the connection, all should be done as root :

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
# ./cablestart username
Determining IP information for eth0... done.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


replace "username" with your real one. note that this script assumes that you are using eth0 to connect to the cable modem. if this is not the case, you can edit the script and replace eth0 with what ever other interfae you might be using. (eth1, eth2 etc...)
your should now be connected... your ifconfig should look something like this :


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
# /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:90:27:9D:7A:3C
          inet addr:10.40.x.x  Bcast:255.255.255.255  Mask:255.255.224.0
          UP BROADCAST NOTRAILERS RUNNING  MTU:1500  Metric:1
          RX packets:90443 errors:0 dropped:0 overruns:0 frame:0
          TX packets:153510 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:40382278 (38.5 Mb)  TX bytes:16308716 (15.5 Mb)
          Interrupt:10 Base address:0x8000
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:17245 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17245 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6835450 (6.5 Mb)  TX bytes:6835450 (6.5 Mb)
 
ppp0      Link encap:Point-to-Point Protocol
          inet addr:212.235.x.x  P-t-P:212.143.x.x  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1460  Metric:1
          RX packets:73 errors:0 dropped:0 overruns:0 frame:0
          TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:12819 (12.5 Kb)  TX bytes:9013 (8.8 Kb)
 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


i changed the last digits in my real address for security reasons ;) so x.x stands for the digits in your real ip address.
your kernel routing table should look something like that :
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
 
# netstat -r -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
212.143.205.226 0.0.0.0         255.255.255.255 UH       40 0          0 ppp0
212.143.205.253 10.40.64.1      255.255.255.255 UGH      40 0          0 eth0
10.40.64.0      0.0.0.0         255.255.224.0   U        40 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
0.0.0.0         212.143.205.226 0.0.0.0         UG       40 0          0 ppp0

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------


*make sure* that the only default gateway you have defined at this point, is the one given to you from your isp ($NEWGW) and that the
old one ($CABLEGW) was removed. if the original gateway ($CABLEGW) is still in your routing table, remove it manualy. leaving it
in your routing table will cause problems... remove commnad : /sbin/route del default gw the.cablegw.address


if you have any more Questions, feel free to Email me to : tal@whatsup.org.il
Happy Surfing ;)


Valid XHTML 1.0!