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

  1.  
  2.                     SETTING UP DIALD FOR LINUX - AN EXAMPLE
  3.                                        
  4.    
  5.    
  6.   GNU Copyright by Harish Pillay h.pillay@ieee.org 1996
  7.   
  8.   The following is an example of a setup I have running on many machines that
  9.   allow automatic installation of diald upon boot-up. When a connection request
  10.   comes along, it automatically dials up my preferred ISP, Pacific Internet
  11.   here in Singapore.
  12.   
  13.   Many thanks to Eric Schenk for the super tool diald.
  14.   
  15. /etc/rc.d/rc.local
  16.  
  17.  
  18. #! /bin/sh
  19. # Put any local setup commands in here
  20. # Running gpm
  21. echo "Running gpm..."
  22. gpm -t ms &
  23.  
  24. # starting innd
  25. /etc/rc.d/rc.news
  26.  
  27. # starting CERN httpd
  28. echo "Starting CERN httpd with proxy and caching."
  29. /usr/local/bin/httpd
  30.  
  31. # loading modules that are needed
  32. /etc/rc.d/rc.modules
  33.  
  34. # starting diald
  35. echo "Starting diald daemon to Pacific Internet ..."
  36. cd /usr/lib/ppp
  37. /usr/lib/ppp/diald.pacific.internet
  38.  
  39. /usr/lib/ppp/diald.pacific.internet
  40.  
  41.  
  42. /usr/sbin/diald /dev/ttyS1 /dev/ttyS1 lock debug 20 -m ppp local 127.0.0.2 \
  43.   remote 127.0.0.3 defaultroute modem crtscts \
  44.   connect "chat -v -f /usr/lib/ppp/pppchat.pi" \
  45.   dynamic -- debug noipdefault
  46.  
  47. /usr/lib/ppp/pppchat.pi
  48.  
  49.  
  50. ABORT "NO CARRIER"
  51. ABORT BUSY
  52. "" ATZ OK
  53. ATm1s50=255s111=0DT1-800-555-1212
  54. CONNECT ""
  55. login MYLOCINNAME
  56. ssword MYPASSWORD
  57.  
  58. Blind PPP script
  59.  
  60.      * Fire up minicom.
  61.      * Connect up to your provider.
  62.      * invoke PPP on the other end.
  63.      * Suspend minicom (alt-A-J).
  64.      * invoke the following script
  65.  
  66. #!/bin/sh
  67. #       Set up a PPP link blindly - script called blind.ppp
  68.  
  69. DEVICE=ttyS1
  70. (
  71.         stty 38400 -tostop
  72.         pppd -detach debug noipdefault defaultroute mru 1500 /dev/$DEVICE &
  73.         exit 0
  74. )  /dev/$DEVICE
  75.  
  76. My /etc/diald.conf file (unchanged from stock distribution):
  77.  
  78.  
  79. # This is a pretty complicated set of filter rules.
  80. # (These are the rules I use myself.)
  81. #
  82. # I've divided the rules up into four sections.
  83. # TCP packets, UDP packets, ICMP packets and a general catch all rule
  84. # at the end.
  85. #------------------------------------------------------------------------------
  86. # Rules for TCP packets.
  87. #------------------------------------------------------------------------------
  88. # General comments on the rule set:
  89. #
  90. # In general we would like to treat only data on a TCP link as signficant
  91. # for timeouts. Therefore, we try to ignore packets with no data.
  92. # Since the shortest possible set of headers in a TCP/IP packet is 40 bytes.
  93. # Any packet with length 40 must have no data riding in it.
  94. # We may miss some empty packets this way (optional routing information
  95. # and other extras may be present in the IP header), but we should get
  96. # most of them. Note that we don't want to filter out packets with
  97. # tcp.live clear, since we use them later to speedup disconnects
  98. # on some TCP links.
  99. #
  100. # We also want to make sure WWW packets live even if the TCP socket
  101. # is shut down. We do this because WWW doesn't keep connections open
  102. # once the data has been transfered, and it would be annoying to have the link
  103. # keep bouncing up and down every time you get a document.
  104. #
  105. # Outside of WWW the most common use of TCP is for long lived connections,
  106. # that once they are gone mean we no longer need the network connection.
  107. # We don't neccessarily want to wait 10 minutes for the connection
  108. # to go down when we don't have any telnet's or rlogin's running,
  109. # so we want to speed up the timeout on TCP connections that have
  110. # shutdown. We do this by catching packets that do not have the live flag set.
  111.  
  112. # --- start of rule set proper ---
  113.  
  114. # When initiating a connection we only give the link 15 seconds initially.
  115. # The idea here is to deal with possibility that the network on the opposite
  116. # end of the connection is unreachable. In this case you don't really
  117. # want to give the link 10 minutes up time. With the rule below
  118. # we only give the link 15 seconds initially. If the network is reachable
  119. # then we will normally get a response that actually contains some
  120. # data within 15 seconds. If this causes problems because you have a slow
  121. # response time at some site you want to regularly access, you can either
  122. # increase the timeout or remove this rule.
  123. accept tcp 15 tcp.syn
  124.  
  125. # Keep named xfers from holding the link up
  126. ignore tcp tcp.dest=tcp.domain
  127. ignore tcp tcp.source=tcp.domain
  128.  
  129. # (Ack! SCO telnet starts by sending empty SYNs and only opens the
  130. # connection if it gets a response. Sheesh..)
  131. accept tcp 5 ip.tot_len=40,tcp.syn
  132.  
  133. # keep empty packets from holding the link up (other than empty SYN packets)
  134. ignore tcp ip.tot_len=40,tcp.live
  135.  
  136. # make sure http transfers hold the link for 2 minutes, even after they end.
  137. # NOTE: Your /etc/services may not define the tcp service www, in which
  138. # case you should comment out the following two lines or get a more
  139. # up to date /etc/services file. See the FAQ for information on obtaining
  140. # a new /etc/services file.
  141. accept tcp 120 tcp.dest=tcp.www
  142. accept tcp 120 tcp.source=tcp.www
  143.  
  144. # Once the link is no longer live, we try to shut down the connection
  145. # quickly. Note that if the link is already down, a state change
  146. # will not bring it back up.
  147. keepup tcp 5 !tcp.live
  148. ignore tcp !tcp.live
  149.  
  150. # an ftp-data or ftp connection can be expected to show reasonably frequent
  151. # traffic.
  152. accept tcp 120 tcp.dest=tcp.ftp
  153. accept tcp 120 tcp.source=tcp.ftp
  154.  
  155. #NOTE: ftp-data is not defined in the /etc/services file provided with
  156. # the latest versions of NETKIT, so I've got this commented out here.
  157. # If you want to define it add the following line to your /etc/services:
  158. # ftp-data        20/tcp
  159. # and uncomment the following two rules.
  160. #accept tcp 120 tcp.dest=tcp.ftp-data
  161. #accept tcp 120 tcp.source=tcp.ftp-data
  162.  
  163. # If we don't catch it above, give the link 10 minutes up time.
  164. accept tcp 600 any
  165.  
  166. # Rules for UDP packets
  167. #
  168. # We time out domain requests right away, we just want them to bring
  169. # the link up, not keep it around for very long.
  170. # This is because the network will usually come up on a call
  171. # from the resolver library (unless you have all your commonly
  172. # used addresses in /etc/hosts, in which case you will discover
  173. # other problems.)
  174. # Note that you should not make the timeout shorter than the time you
  175. # might expect your DNS server to take to respond. Otherwise
  176. # when the initial link gets established there might be a delay
  177. # greater than this between the initial series of packets before
  178. # any packets that keep the link up longer pass over the link.
  179.  
  180. # Don't bring the link up for rwho.
  181. ignore udp udp.dest=udp.who
  182. ignore udp udp.source=udp.who
  183. # Don't bring the link up for RIP.
  184. ignore udp udp.dest=udp.route
  185. ignore udp udp.source=udp.route
  186. # Don't bring the link up for NTP or timed.
  187. ignore udp udp.dest=udp.ntp
  188. ignore udp udp.source=udp.ntp
  189. ignore udp udp.dest=udp.timed
  190. ignore udp udp.source=udp.timed
  191. # Don't bring up on domain name requests between two running nameds.
  192. ignore udp udp.dest=udp.domain,udp.source=udp.domain
  193. # Bring up the network whenever we make a domain request from someplace
  194. # other than named.
  195. accept udp 30 udp.dest=udp.domain
  196. accept udp 30 udp.source=udp.domain
  197. # Do the same for netbios-ns broadcasts
  198. # NOTE: your /etc/services file may not define the netbios-ns service
  199. # in which case you should comment out the next three lines.
  200. ignore udp udp.source=udp.netbios-ns,udp.dest=udp.netbios-ns
  201. accept udp 30 udp.dest=udp.netbios-ns
  202. accept udp 30 udp.source=udp.netbios-ns
  203. # keep routed and gated transfers from holding the link up
  204. ignore udp tcp.dest=udp.route
  205. ignore udp tcp.source=udp.route
  206. # Anything else gest 2 minutes.
  207. accept udp 120 any
  208.  
  209. # Catch any packets that we didn't catch above and give the connection
  210. # 30 seconds of live time.
  211. accept any 30 any
  212.  
  213. My diald.defs file (unchanged from stock distribution):
  214.  
  215.  
  216. # Define default protocol rules
  217. prule tcp tcp 9:12:13:14:15:16:17:18:19:+0:+1:+2:+3:9:9:9
  218. prule udp udp 9:12:13:14:15:16:17:18:19:+0:+1:+2:+3:9:9:9
  219. prule icmp icmp 9:12:13:14:15:16:17:18:19:9:9:9:9:9:9:9
  220. prule any any 9:12:13:14:15:16:17:18:19:9:9:9:9:9:9:9
  221. # Define the internet packet header fields.
  222. var ip.ihl 0(24)&0xf
  223. var ip.version 0(28)&0xf
  224. var ip.tos 1(24)&0xff
  225. var ip.tot_len 2(16)&0xffff
  226. var ip.id 4(16)&0xffff
  227. var ip.frag_off 6(16)&0x3fff
  228. var ip.ttl 8(24)&0xff
  229. var ip.pr