Typo
[linux_from_scratch_hints.git] / OLD / ppp-hint.txt
blob4fc090e86e7f5c539fc1d8f70a3a5974d556fcf8
1 TITLE:          How to QUICKLY install PPP 2.4.1 over a modem
2                 (serial line) on LFS
4 UPDATED:        28-8-02
6 LFS VERSION:    3.3
8 AUTHOR:         Sebastien Millet <sebastien.millet2@libertysurf.fr>
10 SYNOPSIS:
12 When you manage to install a simple PPP access over a
13 modem (a SERIAL modem, connected to a regular RTC
14 phone line), in order to get connected to your ISP,
15 you need to know where is the latest PPP package
16 available and how to install and configure it.
18 This hint will indicate you how to do this WITHOUT
19 downloading huge packages like wvdial, linuxconf
20 or other high level configuration tools. You'll
21 only need to download the PPP source
22 (ppp-2.4.1.tar.gz at the time of this writing).
24 Also, this hint includes an option to make connection
25 be automatic (on demand).
27 HINT:
30 1. Where to get PPP ?
32 PPP project Homepage
33         http://www.samba.org/ppp
34 Alternative freshmeat URL
35         http://freshmeat.net/projects/pppd
38 2. Get PPP installed
40 Once you've downloaded ppp source, extract it from
41 the gzipped tarball by running
42         tar -zxvf ppp-2.4.1.tar.gz
44 Then CD to ppp-2.4.1 directory and run the usual triptic
45         ./configure
46         make
47         make install
49 As usually "make install" must be run as root.
52 3. Configure PPP
54 It is assumed here that you compiled your kernel with
55 support for PPP. To make PPP available in your kernel,
56 CD into /usr/src/linux, execute
57         make config
58 and answer Y (or M when possible, if you manage
59 to make PPP be available as a module) to the questions
61         Networking support
62 ...
63         TCP/IP networking
64 ...
65         PPP (point-to-point protocol) support
66 ...
67         PPP support for async serial ports
68         PPP support for sync tty ports
69         PPP Deflate compression
70         PPP SD_Compress compression
72 Also you have to enable the "dummy network driver", so to
73 have PPP manage an "empty" network device when the PPP
74 link is down.
76 Starting from this point, it is assumed that you're root.
78 Execute the following to create the file ppp-on-dialer:
80 cat > /etc/ppp/ppp-on-dialer << "EOF"
81 #!/bin/sh
83 /usr/sbin/chat -v \
84         TIMEOUT 3 \
85         ABORT   '\nBUSY\r' \
86         ABORT   '\nNO ANSWER\r' \
87         ABORT   '\nRINGING\r\n\r\nRINGING\r' \
88         ''      \rATM0 \
89         'OK-+++\c-OK'   ATH0 \
90         TIMEOUT 30 \
91         OK      ATDT$TELEPHONE \
92         CONNECT '' \
93         ogin:--ogin:    $ACCOUNT \
94         assword:        $PASSWORD
95 EOF
96 chmod a+x /etc/ppp/ppp-on-dialer
98 Note that \rATM0 is used to turn modem speaker off.
99 If you want your modem speaker on or if ATM0 command
100 fails on your modem, simply write \rAT (original
101 string, given by the PPP-HOWTO) instead of \rATM0.
103 Now create ppp-on script:
105 cat > /etc/ppp/ppp-on << "EOF"
106 #!/bin/sh
108 # Beginning of /etc/ppp/ppp-on
110 TELEPHONE=my-phone-number
111 ACCOUNT=-my-account-name
112 PASSWORD=my-password
113 LOCAL_IP=0.0.0.0
114 REMOTE_IP=0.0.0.0
116 export TELEPHONE ACCOUNT PASSWORD
118 DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
120 exec /usr/sbin/pppd /dev/ttyS0 115200 $LOCAL_IP:$REMOTE_IP \
121         connect $DIALER_SCRIPT disconnect "chat -v -- \d+++\d\c OK ATH0 OK"
123 # End of /etc/ppp/ppp-on
125 chmod a+x /etc/ppp/ppp-on
127 You have to replace my-phone-number, my-account-name and
128 my-password with your values. Also, in the "exec ..."
129 line, replace /dev/ttyS0 with the correct serial port
130 on which your modem is installed. Consider that
131         /dev/ttyS0 corresponds to COM1:
132         /dev/ttyS1 corresponds to COM2:
133         ...
135 Now ADD an option to the options file, by executing:
137 cat >> /etc/ppp/options << "EOF"
138 debug
139 defaultroute
142 If you want you can also specify the option
143         idle    <n>
144 in /etc/ppp/options, where <n> is the hang-up timeout in seconds
145 (for example   idle 60   to get a one minute idle timeout).
147 Now create the file ppp-off:
149 cat > /etc/ppp/ppp-off << "EOF"
150 #!/bin/sh
152 # Beginning of /etc/ppp/ppp-off
154 if [ "$1" = "" ]; then
155         DEVICE=ppp0
156 else
157         DEVICE=$1
160 if [ -r /var/run/$DEVICE.pid ]; then
161         kill -INT `cat /var/run/$DEVICE.pid`
163         if [ ! "$?" = "0" ]; then
164                 rm -f /var/run/$DEVICE.pid
165                 echo "ERROR: Removed staled pid file"
166                 exit 1
167         fi
169         echo "PPP link to $DEVICE terminated."
170         exit 0
173 echo "ERROR: PPP link is not active on $DEVICE"
174 exit 1
176 # End of /etc/ppp/ppp-off
178 chmod a+x /etc/ppp/ppp-off
180 Now you can connect to your ISP by running
181         /etc/ppp/ppp-on
182 and disconnect by running
183         /etc/ppp/ppp-off
185 To analyze what's going on in case of failure,
186 switch to a terminal that you'll dedicate
187 to display system messages (or open a xterm if
188 you're working under X), execute
189         tail -f /var/log/sys.log
190 and you'll see chat and pppd logs on the fly.
191 When you're OK you can remove the debug option
192 from pppd options file (/etc/ppp/options). You can
193 also consider removing -v option of chat invocation
194 (in the /etc/ppp/ppp-on-dialer file), though this
195 logging is useful and often left.
198 4. Configure name resolution
200 Configure name resolution by executing the following:
202 cat > /etc/host.conf << "EOF"
203 # /etc/host.conf
205 order hosts,bind
206 multi on
209 cat > /etc/resolv.conf << "EOF"
210 # /etc/resolv.conf
212 domain my-isp-domain-name
213 nameserver first-dns-ip-address
214 nameserver second-dns-ip-address
217 In the file /etc/resolv.conf, replace my-isp-domain-name,
218 first-dns-ip-address and second-dns-ip-address
219 with the correct values.
222 5. Configure on-demand connection (optional)
224 Execute the following:
226 cat > /etc/sysconfig/network-devices/ifconfig.ppp0 << "EOF"
227 ONBOOT=yes
230 cat > /etc/sysconfig/network-devices/ifup-ppp0 << "EOF"
231 #!/bin/sh
233 /etc/ppp/ppp-on
235 exit 0
238 cat > /etc/sysconfig/network-scripts/ifdown-ppp0 << "EOF"
239 #!/bin/sh
241 /etc/ppp/ppp-off
242 ifconfig ppp0 down
244 exit 0
247 cat >> /etc/ppp/options << "EOF"
248 ktune
249 demand
250 idle 60
253 Note that you may have already supplied the idle option.
254 Tune the idle option to a value that fits your wishes.
257 6. How to get detailed informations about PPP
259 Online HOWTO
260         http://www.tldp.org/HOWTO/PPP-HOWTO/index.html
261 The same HOWTO as above, but in a single HTML file
262         http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/PPP-HOWTO.html
264 The Linux PPP FAQ
265         ftp://sunsite.unc.edu/pub/Linux/docs/faqs/PPP-FAQ/PPP-FAQ