home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
BURKS
/
LINUX
/
HOWTO
/
mini
/
dondmand.txt
< prev
next >
Wrap
Text File
|
1997-07-07
|
15KB
|
575 lines
Dial-On-Demand mini-HOWTO
Rodney.van.den.Oever@tip.nl
Version 1.0, 28 July 1996 / updated and submitted 29 february 1997
Introduction:
This document describes how to do dial-on-demand dialling and how to use a
Linux host connected to a private local network as a dial-on-demand
PPP-router.
The kerneld-mini-HOWTO already describes how kerneld can execute a
'request-route' script, I'd like to describe a working setup in more detail.
If you have a small network at home, this is a very elegant way to provide
transparent Internet-access for a couple of other machines.
______________________________
__|__ ___|___
| | local network | | ______ PPP-link to provider
| PC | 192.168.1.0 | Linux |--|modem |------------------>
| | | Router| |______| x.x.x.x
|_____| |_______| (dynamic IP-address)
named
pppd
This setup requires:
* Kernel 2.0.0 or later.
* ppp-2.2.0f.tar.gz or later
* modules-2.0.0.tar.gz or later
* ipfwadm-2.3.tar.gz (http://www.xos.nl/linux/ipfwadm)
The following steps need to be taken:
1. Kernel Configuration
2. Modules Installation
3. PPP Installation
4. Serial Port and Modem Configuration
5. PPP Configuration
6. Dial-On-Demand
7. Network Configuration
8. Masquerading configuration
9. Workstation configuration
----------------------------------------------------------------------------
---
1. Kernel Configuration:
First we need to compile a kernel with kerneld, ppp and IP-masquerading
support.
I'll only show the options required for this setup, other options like
firewall
logging or transparent proxying can be turned on, but are not required:
cd /usr/src/linux
make config (or make menuconfig)
* Code maturity level options
*
Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL)
[Y/n/?]
* Loadable module support
*
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
Set version information on all symbols for modules (CONFIG_MODVERSIONS)
[N/y/?]
Kernel daemon support (e.g. autoload of modules) (CONFIG_KERNELD) [Y/n/?]
*
Networking support (CONFIG_NET) [Y/n/?]
*
* Networking options
*
Network firewalls (CONFIG_FIREWALL) [Y/n/?]
TCP/IP networking (CONFIG_INET) [Y/n/?]
IP: forwarding/gatewaying (CONFIG_IP_FORWARD) [Y/n/?]
IP: firewalling (CONFIG_IP_FIREWALL) [Y/n/?]
IP: masquerading (EXPERIMENTAL) (CONFIG_IP_MASQUERADE) [Y/n/?]
*
* Protocol-specific masquerading support will be built as modules.
*
IP: always defragment (CONFIG_IP_ALWAYS_DEFRAG) [Y/n/?]
IP: optimize as router not host (CONFIG_IP_ROUTER) [Y/n/?]
*
* Network device support
*
Network device support (CONFIG_NETDEVICES) [Y/n/?]
*
PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]
*
* CCP compressors for PPP are only built as modules.
*
Ethernet (10 or 100Mbit) (CONFIG_NET_ETHERNET) [Y/n/?]
NE2000/NE1000 support (CONFIG_NE2000) [Y/m/n/?]
The latter option depends of course on the netword card used!
Compile the kernel with:
make zlilo
make modules
make modules_install
If you don't use LILO, copy /usr/src/linux/arch/i386/boot/zImage to the
proper
location for your setup.
The modules are installed in /lib/modules/x.x.x, Where x.x.x reflects the
version-number of your kernel.
----------------------------------------------------------------------------
---
2. Modules Installation:
The following module-utilities are required:
/sbin/insmode Loads module requested
/sbin/rmmod Removes module no longer needed
/sbin/depmod Creates depedencies
/sbin/kerneld Kerneld extension to load modules automatically
If you don't have these yet, install 'm by:
cd /usr/src
tar zxf modules-2.0.0.tar.gz
make install
To load kerneld at startup we need to edit /etc/rc.d/rc.S or create a
seperate
script rc.modules which is called from rc.S. Add or change the following
lines:
/etc/rc.d/rc.modules:
if [ ! -f /lib/modules/`uname -r`/modules.dep ] ; then
echo "Updating module dependencies for Linux `uname -r`:"
/sbin/depmod -a
fi
[ -x /sbin/kerneld ] && /sbin/kerneld
The first part checks for the module-dependencies and creates them if they
don't
exist yet.
----------------------------------------------------------------------------
---
3. PPP Installation:
The following stuff is required to setup a PPP-link:
/usr/sbin/pppd PPP-daemon
/usr/sbin/pppstats PPP-statistics
/usr/sbin/chat Execution of scripts
Install these by:
cd /usr/src
tar zxf ppp-2.2.0f.tar.gz
cd ppp-2.2.0f
./configure
make kernel
Since later kernels already include the PPP-code, 'make kernel' won't
replace
anything. Check the README and Makefile for shadow-support (if you also
want to
dial-in to this host) and other options. Then do:
make
make install
----------------------------------------------------------------------------
---
4. Serial port and modem configuration:
This setup requires a modem. Serial port setup is done in /etc/rc.d/rc.seria
l:
${SETSERIAL} /dev/cua0 uart 16450 port 0x3F8 irq 4
${SETSERIAL} /dev/cua1 uart 16550A port 0x2F8 irq 3 spd_vhi
In this setup COM1 is used by the mouse and COM2 by an internal 28k8
modem.
The spd_vhi-parameter replace the 38400 bps-entry in the speeds-table with
115200.
Likewise, spd_hi replaces this by 57600.
Use spd_vhi with a 28k8 modem and spd_hi with a 14k4 modem, but start with
38400,
just to be on the safe side.
You can check your modem setup by running 'minicom' or some other terminal
program.
Your modem should echo the characters typed. Use Ctrl-A, P to change the
communication parameters. Check if it still works at 57600 or 115200 bps.
Entering 'ATZ' should return 'OK'. Use Ctrl-A X to leave minicom.
Minicom can also be used to dial your provider manually. Make a note of
what you
need to enter to setup the link and what the response are from the remote
server.
If your provider doesn't use PAP or CHAP you probably need to enter a
username and
password and possibly enter a command to setup the link in PPP-mode.
----------------------------------------------------------------------------
---
5. PPP Configuration:
pppd searches /etc/ppp for scripts and the file 'options'.
/etc/ppp/options:
/dev/modem 38400 crtscts modem noipdefault defaultroute idle-disconnect
120
Meaning:
/dev/modem In my setup a link to /dev/cua1.
38400 Gets replaced by 115200 (spd_vhi-parameter in
/etc/rc.d/rc.serial)
crtscts Hardware handshake, RTS/CTS, don't use Xon-Xoff-handshaking!
noipdefault The IP-address is assigned automatically.
defaultroute This sets the default route to the PPP-interface when the
link is up.
idle-disconnect PPP-2.2.0f automatically disconnects an idle link after
120
seconds.
Now we need to create a script, just name it 'default', meaning the ISP
you
normally
use. If you want to make other connections too, creates differents scripts
for these
sites and name them with the remote IP-address.
/etc/ppp/default:
"" ats11=55dtXXXXXXXX CONNECT "" rname: UUUUU sword: PPPPP > ppp
Meaning:
ats11=55 shortens the duration of the dial tones to speed up
dialing.
XXXXXXXX Enter the phone-number for your provider here.
CONNECT chat waits for your modem to return 'CONNECT'.
rname: chat waits for 'rname', and enters 'UUUUU'
sword: chat waits for 'sword', and then enters 'PPPPP'.
Replace 'UUUUU' and 'PPPPP' by your username and password. I use 'rname'
and
'sword' because sometimes the first letter gets missed or could be upper-
or
lowercase and language-dependent. Some ISP's require you to enter 'ppp'
after
your enter the username and password, so I wait for the last character of
the
routerprompt ('>').
If you get errors like 'serial line looped back' or 'serial line not 8-bit
clean'
the link is not yet in PPP-mode.
This command is long enough to place it in a small script:
/etc/ppp/ppp:
#!/bin/sh
/usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/default'
You should now be able to connect to your ISP, you might add the 'debug'
parameter
to the /etc/ppp/options-file, make sure you increase the loglevel of
syslogd to
see wh