home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LINUX / HOWTO / mini / dondmand.txt < prev    next >
Text File  |  1997-07-07  |  15KB  |  575 lines

  1. Dial-On-Demand mini-HOWTO
  2. Rodney.van.den.Oever@tip.nl
  3. Version 1.0, 28 July 1996 / updated and submitted 29 february 1997
  4.  
  5.  
  6. Introduction:
  7.  
  8. This document describes how to do dial-on-demand dialling and how to use a
  9. Linux host connected to a private local network as a dial-on-demand
  10. PPP-router.
  11.  
  12. The kerneld-mini-HOWTO already describes how kerneld can execute a
  13. 'request-route' script, I'd like to describe a working setup in more detail.
  14.  
  15. If you have a small network at home, this is a very elegant way to provide
  16. transparent Internet-access for a couple of other machines.
  17.  
  18.  
  19. ______________________________
  20. __|__                  ___|___
  21. |     | local network  |       |   ______  PPP-link to provider
  22. | PC  |  192.168.1.0   | Linux |--|modem |------------------>
  23. |     |                | Router|  |______|      x.x.x.x
  24. |_____|                |_______|          (dynamic IP-address)
  25.                          named
  26.                          pppd
  27.  
  28. This setup requires:
  29.  
  30. * Kernel 2.0.0 or later.
  31. * ppp-2.2.0f.tar.gz or later
  32. * modules-2.0.0.tar.gz or later
  33. * ipfwadm-2.3.tar.gz (http://www.xos.nl/linux/ipfwadm)
  34.  
  35.  
  36. The following steps need to be taken:
  37.  
  38. 1. Kernel Configuration
  39. 2. Modules Installation
  40. 3. PPP Installation
  41. 4. Serial Port and Modem Configuration
  42. 5. PPP Configuration
  43. 6. Dial-On-Demand
  44. 7. Network Configuration
  45. 8. Masquerading configuration
  46. 9. Workstation configuration
  47.  
  48. ----------------------------------------------------------------------------
  49.  
  50. ---
  51.  
  52.  
  53. 1. Kernel Configuration:
  54.  
  55. First we need to compile a kernel with kerneld, ppp and IP-masquerading
  56. support.
  57. I'll only show the options required for this setup, other options like
  58. firewall
  59. logging or transparent proxying can be turned on, but are not required:
  60.  
  61. cd /usr/src/linux
  62. make config (or make menuconfig)
  63.  
  64. * Code maturity level options
  65. *
  66. Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL)
  67.  
  68. [Y/n/?]
  69.  
  70. * Loadable module support
  71. *
  72. Enable loadable module support (CONFIG_MODULES) [Y/n/?]
  73. Set version information on all symbols for modules (CONFIG_MODVERSIONS)
  74. [N/y/?]
  75. Kernel daemon support (e.g. autoload of modules) (CONFIG_KERNELD) [Y/n/?]
  76. *
  77. Networking support (CONFIG_NET) [Y/n/?]
  78. *
  79. * Networking options
  80. *
  81. Network firewalls (CONFIG_FIREWALL) [Y/n/?]
  82. TCP/IP networking (CONFIG_INET) [Y/n/?]
  83. IP: forwarding/gatewaying (CONFIG_IP_FORWARD) [Y/n/?]
  84. IP: firewalling (CONFIG_IP_FIREWALL) [Y/n/?]
  85. IP: masquerading (EXPERIMENTAL) (CONFIG_IP_MASQUERADE) [Y/n/?]
  86. *
  87. * Protocol-specific masquerading support will be built as modules.
  88. *
  89. IP: always defragment (CONFIG_IP_ALWAYS_DEFRAG) [Y/n/?]
  90. IP: optimize as router not host (CONFIG_IP_ROUTER) [Y/n/?]
  91. *
  92. * Network device support
  93. *
  94. Network device support (CONFIG_NETDEVICES) [Y/n/?]
  95. *
  96. PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]
  97. *
  98. * CCP compressors for PPP are only built as modules.
  99. *
  100. Ethernet (10 or 100Mbit) (CONFIG_NET_ETHERNET) [Y/n/?]
  101. NE2000/NE1000 support (CONFIG_NE2000) [Y/m/n/?]
  102.  
  103.  
  104. The latter option depends of course on the netword card used!
  105.  
  106.  
  107. Compile the kernel with:
  108.  
  109. make zlilo
  110. make modules
  111. make modules_install
  112.  
  113. If you don't use LILO, copy /usr/src/linux/arch/i386/boot/zImage to the
  114. proper
  115. location for your setup.
  116. The modules are installed in /lib/modules/x.x.x, Where x.x.x reflects the
  117. version-number of your kernel.
  118.  
  119. ----------------------------------------------------------------------------
  120.  
  121. ---
  122.  
  123.  
  124. 2. Modules Installation:
  125.  
  126. The following module-utilities are required:
  127.  
  128. /sbin/insmode           Loads module requested
  129. /sbin/rmmod             Removes module no longer needed
  130. /sbin/depmod            Creates depedencies
  131. /sbin/kerneld           Kerneld extension to load modules automatically
  132.  
  133. If you don't have these yet, install 'm by:
  134.  
  135. cd /usr/src
  136. tar zxf modules-2.0.0.tar.gz
  137. make install
  138.  
  139. To load kerneld at startup we need to edit /etc/rc.d/rc.S or create a
  140. seperate
  141. script rc.modules which is called from rc.S. Add or change the following
  142. lines:
  143.  
  144. /etc/rc.d/rc.modules:
  145.  
  146. if [ ! -f /lib/modules/`uname -r`/modules.dep ] ; then
  147.         echo "Updating module dependencies for Linux `uname -r`:"
  148.         /sbin/depmod -a
  149. fi
  150.  
  151. [ -x /sbin/kerneld ] && /sbin/kerneld
  152.  
  153.  
  154. The first part checks for the module-dependencies and creates them if they
  155. don't
  156. exist yet.
  157.  
  158. ----------------------------------------------------------------------------
  159.  
  160. ---
  161.  
  162.  
  163. 3. PPP Installation:
  164.  
  165. The following stuff is required to setup a PPP-link:
  166.  
  167. /usr/sbin/pppd            PPP-daemon
  168. /usr/sbin/pppstats        PPP-statistics
  169. /usr/sbin/chat            Execution of scripts
  170.  
  171. Install these by:
  172.  
  173. cd /usr/src
  174. tar zxf ppp-2.2.0f.tar.gz
  175. cd ppp-2.2.0f
  176. ./configure
  177. make kernel
  178.  
  179. Since later kernels already include the PPP-code, 'make kernel' won't
  180. replace
  181. anything. Check the README and Makefile for shadow-support (if you also
  182. want to
  183. dial-in to this host) and other options. Then do:
  184.  
  185. make
  186. make install
  187.  
  188. ----------------------------------------------------------------------------
  189.  
  190. ---
  191.  
  192.  
  193. 4. Serial port and modem configuration:
  194.  
  195. This setup requires a modem. Serial port setup is done in /etc/rc.d/rc.seria
  196.  
  197. l:
  198.  
  199. ${SETSERIAL} /dev/cua0 uart 16450 port 0x3F8 irq 4
  200. ${SETSERIAL} /dev/cua1 uart 16550A port 0x2F8 irq 3 spd_vhi
  201.  
  202. In this setup COM1 is used by the mouse and COM2 by an internal 28k8
  203. modem.
  204. The spd_vhi-parameter replace the 38400 bps-entry in the speeds-table with
  205. 115200.
  206. Likewise, spd_hi replaces this by 57600.
  207.  
  208. Use spd_vhi with a 28k8 modem and spd_hi with a 14k4 modem, but start with
  209. 38400,
  210. just to be on the safe side.
  211.  
  212. You can check your modem setup by running 'minicom' or some other terminal
  213. program.
  214. Your modem should echo the characters typed. Use Ctrl-A, P to change the
  215. communication parameters. Check if it still works at 57600 or 115200 bps.
  216. Entering 'ATZ' should return 'OK'. Use Ctrl-A X to leave minicom.
  217.  
  218. Minicom can also be used to dial your provider manually. Make a note of
  219. what you
  220. need to enter to setup the link and what the response are from the remote
  221. server.
  222. If your provider doesn't use PAP or CHAP you probably need to enter a
  223. username and
  224. password and possibly enter a command to setup the link in PPP-mode.
  225.  
  226. ----------------------------------------------------------------------------
  227.  
  228. ---
  229.  
  230.  
  231. 5. PPP Configuration:
  232.  
  233. pppd searches /etc/ppp for scripts and the file 'options'.
  234.  
  235. /etc/ppp/options:
  236.  
  237. /dev/modem 38400 crtscts modem noipdefault defaultroute idle-disconnect
  238. 120
  239.  
  240. Meaning:
  241.  
  242. /dev/modem      In my setup a link to /dev/cua1.
  243. 38400           Gets replaced by 115200 (spd_vhi-parameter in
  244. /etc/rc.d/rc.serial)
  245. crtscts         Hardware handshake, RTS/CTS, don't use Xon-Xoff-handshaking!
  246.  
  247.  
  248. noipdefault     The IP-address is assigned automatically.
  249. defaultroute    This sets the default route to the PPP-interface when the
  250. link is up.
  251. idle-disconnect PPP-2.2.0f automatically disconnects an idle link after
  252. 120
  253. seconds.
  254.  
  255. Now we need to create a script, just name it 'default', meaning the ISP
  256. you
  257. normally
  258. use. If you want to make other connections too, creates differents scripts
  259. for these
  260. sites and name them with the remote IP-address.
  261.  
  262. /etc/ppp/default:
  263.  
  264. "" ats11=55dtXXXXXXXX CONNECT "" rname: UUUUU sword: PPPPP > ppp
  265.  
  266.  
  267. Meaning:
  268.  
  269. ats11=55        shortens the duration of the dial tones to speed up
  270. dialing.
  271. XXXXXXXX        Enter the phone-number for your provider here.
  272. CONNECT         chat waits for your modem to return 'CONNECT'.
  273. rname:          chat waits for 'rname', and enters 'UUUUU'
  274. sword:          chat waits for 'sword', and then enters 'PPPPP'.
  275.  
  276. Replace 'UUUUU' and 'PPPPP' by your username and password. I use 'rname'
  277. and
  278. 'sword' because sometimes the first letter gets missed or could be upper-
  279. or
  280. lowercase and language-dependent. Some ISP's require you to enter 'ppp'
  281. after
  282. your enter the username and password, so I wait for the last character of
  283. the
  284. routerprompt ('>').
  285.  
  286. If you get errors like 'serial line looped back' or 'serial line not 8-bit
  287. clean'
  288. the link is not yet in PPP-mode.
  289.  
  290. This command is long enough to place it in a small script:
  291.  
  292. /etc/ppp/ppp:
  293.  
  294. #!/bin/sh
  295. /usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/default'
  296.  
  297. You should now be able to connect to your ISP, you might add the 'debug'
  298. parameter
  299. to the /etc/ppp/options-file, make sure you increase the loglevel of
  300. syslogd to
  301. see wh