Put in remaining pages and wiki contents.
[ikiwiki.git] / docs / handbook / handbook-dialup.mdwn
1 \r
2 \r
3 ## 17.4 Dial-in Service \r
4 \r
5 ***Contributed by Guy Helmer. ******Additions by Sean Kelly. ***\r
6 \r
7 Configuring your DragonFly system for dial-in service is very similar to connecting terminals except that you are dealing with modems instead of terminals.\r
8 \r
9 ### 17.4.1 External vs. Internal Modems \r
10 \r
11 External modems seem to be more convenient for dial-up, because external modems often can be semi-permanently configured via parameters stored in non-volatile RAM and they usually provide lighted indicators that display the state of important RS-232 signals. Blinking lights impress visitors, but lights are also very useful to see whether a modem is operating properly.\r
12 \r
13 Internal modems usually lack non-volatile RAM, so their configuration may be limited only to setting DIP switches. If your internal modem has any signal indicator lights, it is probably difficult to view the lights when the system's cover is in place.\r
14 \r
15 #### 17.4.1.1 Modems and Cables \r
16 \r
17 If you are using an external modem, then you will of course need the proper cable. A standard RS-232C serial cable should suffice as long as all of the normal signals are wired:\r
18 \r
19
20 * Transmitted Data (SD)\r
21
22 * Received Data (RD)\r
23
24 * Request to Send (RTS)\r
25
26 * Clear to Send (CTS)\r
27
28 * Data Set Ready (DSR)\r
29
30 * Data Terminal Ready (DTR)\r
31
32 * Carrier Detect (CD)\r
33
34 * Signal Ground (SG)\r
35 \r
36 DragonFly needs the RTS and CTS signals for flow-control at speeds above 2400 bps, the CD signal to detect when a call has been answered or the line has been hung up, and the DTR signal to reset the modem after a session is complete. Some cables are wired without all of the needed signals, so if you have problems, such as a login session not going away when the line hangs up, you may have a problem with your cable.\r
37 \r
38 Like other UNIX® like operating systems, DragonFly uses the hardware signals to find out when a call has been answered or a line has been hung up and to hangup and reset the modem after a call. DragonFly avoids sending commands to the modem or watching for status reports from the modem. If you are familiar with connecting modems to PC-based bulletin board systems, this may seem awkward.\r
39 \r
40 ### 17.4.2 Serial Interface Considerations \r
41 \r
42 DragonFly supports NS8250-, NS16450-, NS16550-, and NS16550A-based EIA RS-232C (CCITT V.24) communications interfaces. The 8250 and 16450 devices have single-character buffers. The 16550 device provides a 16-character buffer, which allows for better system performance. (Bugs in plain 16550's prevent the use of the 16-character buffer, so use 16550A's if possible). Because single-character-buffer devices require more work by the operating system than the 16-character-buffer devices, 16550A-based serial interface cards are much preferred. If the system has many active serial ports or will have a heavy load, 16550A-based cards are better for low-error-rate communications.\r
43 \r
44 ### 17.4.3 Quick Overview \r
45 \r
46 As with terminals, `init` spawns a `getty` process for each configured serial port for dial-in connections. For example, if a modem is attached to `/dev/ttyd0`, the command `ps ax` might show this:\r
47 \r
48     \r
49      4850 ??  I      0:00.09 /usr/libexec/getty V19200 ttyd0\r
50 \r
51 \r
52 When a user dials the modem's line and the modems connect, the CD (Carrier Detect) line is reported by the modem. The kernel notices that carrier has been detected and completes `getty`'s open of the port. `getty` sends a login: prompt at the specified initial line speed. `getty` watches to see if legitimate characters are received, and, in a typical configuration, if it finds junk (probably due to the modem's connection speed being different than `getty`'s speed), `getty` tries adjusting the line speeds until it receives reasonable characters.\r
53 \r
54 After the user enters his/her login name, `getty` executes `/usr/bin/login`, which completes the login by asking for the user's password and then starting the user's shell.\r
55 \r
56 ### 17.4.4 Configuration Files \r
57 \r
58 There are three system configuration files in the `/etc` directory that you will probably need to edit to allow dial-up access to your DragonFly system. The first, `/etc/gettytab`, contains configuration information for the `/usr/libexec/getty` daemon. Second, `/etc/ttys` holds information that tells `/sbin/init` what `tty` devices should have `getty` processes running on them. Lastly, you can place port initialization commands in the `/etc/rc.serial` script.\r
59 \r
60 There are two schools of thought regarding dial-up modems on UNIX. One group likes to configure their modems and systems so that no matter at what speed a remote user dials in, the local computer-to-modem RS-232 interface runs at a locked speed. The benefit of this configuration is that the remote user always sees a system login prompt immediately. The downside is that the system does not know what a user's true data rate is, so full-screen programs like Emacs will not adjust their screen-painting methods to make their response better for slower connections.\r
61 \r
62 The other school configures their modems' RS-232 interface to vary its speed based on the remote user's connection speed. For example, V.32bis (14.4 Kbps) connections to the modem might make the modem run its RS-232 interface at 19.2 Kbps, while 2400 bps connections make the modem's RS-232 interface run at 2400 bps. Because `getty` does not understand any particular modem's connection speed reporting, `getty` gives a login: message at an initial speed and watches the characters that come back in response. If the user sees junk, it is assumed that they know they should press the Enter key until they see a recognizable prompt. If the data rates do not match, `getty` sees anything the user types as ***junk***, tries going to the next speed and gives the login: prompt again. This procedure can continue ad nauseam, but normally only takes a keystroke or two before the user sees a good prompt. Obviously, this login sequence does not look as clean as the former ***locked-speed*** method, but a user on a low-speed connection should receive better interactive response from full-screen programs.\r
63 \r
64 This section will try to give balanced configuration information, but is biased towards having the modem's data rate follow the connection rate.\r
65 \r
66 #### 17.4.4.1 `/etc/gettytab` \r
67 \r
68 `/etc/gettytab` is a [termcap(5)](http://leaf.dragonflybsd.org/cgi/web-man?command#termcap&section5)-style file of configuration information for [getty(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=getty&section=8). Please see the [gettytab(5)](http://leaf.dragonflybsd.org/cgi/web-man?command=gettytab&section=5) manual page for complete information on the format of the file and the list of capabilities.\r
69 \r
70 ##### 17.4.4.1.1 Locked-speed Config \r
71 \r
72 If you are locking your modem's data communications rate at a particular speed, you probably will not need to make any changes to `/etc/gettytab`.\r
73 \r
74 ##### 17.4.4.1.2 Matching-speed Config \r
75 \r
76 You will need to set up an entry in `/etc/gettytab` to give `getty` information about the speeds you wish to use for your modem. If you have a 2400 bps modem, you can probably use the existing `D2400` entry.\r
77 \r
78     \r
79     #\r
80     # Fast dialup terminals, 2400/1200/300 rotary (can start either way)\r
81     #\r
82     D2400|d2400|Fast-Dial-2400:\\r
83             :nx#D1200:tc2400-baud:\r
84     3|D1200|Fast-Dial-1200:\\r
85             :nx#D300:tc1200-baud:\r
86     5|D300|Fast-Dial-300:\\r
87             :nx#D2400:tc300-baud:\r
88 \r
89 \r
90 If you have a higher speed modem, you will probably need to add an entry in `/etc/gettytab`; here is an entry you could use for a 14.4 Kbps modem with a top interface speed of 19.2 Kbps:\r
91 \r
92     \r
93     #\r
94     # Additions for a V.32bis Modem\r
95     #\r
96     um|V300|High Speed Modem at 300,8-bit:\\r
97             :nx#V19200:tcstd.300:\r
98     un|V1200|High Speed Modem at 1200,8-bit:\\r
99             :nx#V300:tcstd.1200:\r
100     uo|V2400|High Speed Modem at 2400,8-bit:\\r
101             :nx#V1200:tcstd.2400:\r
102     up|V9600|High Speed Modem at 9600,8-bit:\\r
103             :nx#V2400:tcstd.9600:\r
104     uq|V19200|High Speed Modem at 19200,8-bit:\\r
105             :nx#V9600:tcstd.19200:\r
106 \r
107 \r
108 This will result in 8-bit, no parity connections.\r
109 \r
110 The example above starts the communications rate at 19.2 Kbps (for a V.32bis connection), then cycles through 9600 bps (for V.32), 2400 bps, 1200 bps, 300 bps, and back to 19.2 Kbps. Communications rate cycling is implemented with the `nx#` (***next table***) capability. Each of the lines uses a `tc` (***table continuation***) entry to pick up the rest of the ***standard*** settings for a particular data rate.\r
111 \r
112 If you have a 28.8 Kbps modem and/or you want to take advantage of compression on a 14.4 Kbps modem, you need to use a higher communications rate than 19.2 Kbps. Here is an example of a `gettytab` entry starting a 57.6 Kbps:\r
113 \r
114     \r
115     #\r
116     # Additions for a V.32bis or V.34 Modem\r
117     # Starting at 57.6 Kbps\r
118     #\r
119     vm|VH300|Very High Speed Modem at 300,8-bit:\\r
120             :nx#VH57600:tcstd.300:\r
121     vn|VH1200|Very High Speed Modem at 1200,8-bit:\\r
122             :nx#VH300:tcstd.1200:\r
123     vo|VH2400|Very High Speed Modem at 2400,8-bit:\\r
124             :nx#VH1200:tcstd.2400:\r
125     vp|VH9600|Very High Speed Modem at 9600,8-bit:\\r
126             :nx#VH2400:tcstd.9600:\r
127     vq|VH57600|Very High Speed Modem at 57600,8-bit:\\r
128             :nx#VH9600:tcstd.57600:\r
129 \r
130 \r
131 If you have a slow CPU or a heavily loaded system and do not have 16550A-based serial ports, you may receive ***`sio`*** ***silo*** errors at 57.6 Kbps.\r
132 \r
133 #### 17.4.4.2 `/etc/ttys` \r
134 \r
135 Configuration of the `/etc/ttys` file was covered in [ Example 17-1](term.html#EX-ETC-TTYS). Configuration for modems is similar but we must pass a different argument to `getty` and specify a different terminal type. The general format for both locked-speed and matching-speed configurations is:\r
136 \r
137     \r
138     ttyd0   "/usr/libexec/getty `***xxx***`"   dialup on\r
139 \r
140 \r
141 The first item in the above line is the device special file for this entry -- `ttyd0` means `/dev/ttyd0` is the file that this `getty` will be watching. The second item, `"/usr/libexec/getty `***xxx***`"` (`***xxx***` will be replaced by the initial `gettytab` capability) is the process `init` will run on the device. The third item, `dialup`, is the default terminal type. The fourth parameter, `on`, indicates to `init` that the line is operational. There can be a fifth parameter, `secure`, but it should only be used for terminals which are physically secure (such as the system console).\r
142 \r
143 The default terminal type (`dialup` in the example above) may depend on local preferences. `dialup` is the traditional default terminal type on dial-up lines so that users may customize their login scripts to notice when the terminal is `dialup` and automatically adjust their terminal type. However, the author finds it easier at his site to specify `vt102` as the default terminal type, since the users just use VT102 emulation on their remote systems.\r
144 \r
145 After you have made changes to `/etc/ttys`, you may send the `init` process a HUP signal to re-read the file. You can use the command\r
146 \r
147     \r
148     # kill -HUP 1\r
149 \r
150 \r
151  to send the signal. If this is your first time setting up the system, you may want to wait until your modem(s) are properly configured and connected before signaling `init`.\r
152 \r
153 ##### 17.4.4.2.1 Locked-speed Config \r
154 \r
155 For a locked-speed configuration, your `ttys` entry needs to have a fixed-speed entry provided to `getty`. For a modem whose port speed is locked at 19.2 Kbps, the `ttys` entry might look like this:\r
156 \r
157     \r
158     ttyd0   "/usr/libexec/getty std.19200"   dialup on\r
159 \r
160 \r
161 If your modem is locked at a different data rate, substitute the appropriate value for `std.`***speed****** instead of `std.19200`. Make sure that you use a valid type listed in `/etc/gettytab`.\r
162 \r
163 ##### 17.4.4.2.2 Matching-speed Config \r
164 \r
165 In a matching-speed configuration, your `ttys` entry needs to reference the appropriate beginning ***auto-baud*** (sic) entry in `/etc/gettytab`. For example, if you added the above suggested entry for a matching-speed modem that starts at 19.2 Kbps (the `gettytab` entry containing the `V19200` starting point), your `ttys` entry might look like this:\r
166 \r
167     \r
168     ttyd0   "/usr/libexec/getty V19200"   dialup on\r
169 \r
170 \r
171 #### 17.4.4.3 `/etc/rc.serial` \r
172 \r
173 High-speed modems, like V.32, V.32bis, and V.34 modems, need to use hardware (`RTS/CTS`) flow control. You can add `stty` commands to `/etc/rc.serial` to set the hardware flow control flag in the DragonFly kernel for the modem ports.\r
174 \r
175 For example to set the `termios` flag `crtscts` on serial port #1's (`COM2`) dial-in and dial-out initialization devices, the following lines could be added to `/etc/rc.serial`:\r
176 \r
177     \r
178     # Serial port initial configuration\r
179     stty -f /dev/ttyid1 crtscts\r
180     stty -f /dev/cuaia1 crtscts\r
181 \r
182 \r
183 ### 17.4.5 Modem Settings \r
184 \r
185 If you have a modem whose parameters may be permanently set in non-volatile RAM, you will need to use a terminal program (such as Telix under MS-DOS® or `tip` under DragonFly) to set the parameters. Connect to the modem using the same communications speed as the initial speed `getty` will use and configure the modem's non-volatile RAM to match these requirements:\r
186 \r
187
188 * CD asserted when connected\r
189
190 * DTR asserted for operation; dropping DTR hangs up line and resets modem\r
191
192 * CTS transmitted data flow control\r
193
194 * Disable XON/XOFF flow control\r
195
196 * RTS received data flow control\r
197
198 * Quiet mode (no result codes)\r
199
200 * No command echo\r
201 \r
202 Please read the documentation for your modem to find out what commands and/or DIP switch settings you need to give it.\r
203 \r
204 For example, to set the above parameters on a U.S. Robotics® Sportster® 14,400 external modem, one could give these commands to the modem:\r
205 \r
206     \r
207     ATZ\r
208     AT&C1&D2&H1&I0&R2&W\r
209 \r
210 \r
211 You might also want to take this opportunity to adjust other settings in the modem, such as whether it will use V.42bis and/or MNP5 compression.\r
212 \r
213 The U.S. Robotics Sportster 14,400 external modem also has some DIP switches that need to be set; for other modems, perhaps you can use these settings as an example:\r
214 \r
215
216 * Switch 1: UP -- DTR Normal\r
217
218 * Switch 2: N/A (Verbal Result Codes/Numeric Result Codes)\r
219
220 * Switch 3: UP -- Suppress Result Codes\r
221
222 * Switch 4: DOWN -- No echo, offline commands\r
223
224 * Switch 5: UP -- Auto Answer\r
225
226 * Switch 6: UP -- Carrier Detect Normal\r
227
228 * Switch 7: UP -- Load NVRAM Defaults\r
229
230 * Switch 8: N/A (Smart Mode/Dumb Mode)\r
231 \r
232 Result codes should be disabled/suppressed for dial-up modems to avoid problems that can occur if `getty` mistakenly gives a login: prompt to a modem that is in command mode and the modem echoes the command or returns a result code. This sequence can result in a extended, silly conversation between `getty` and the modem.\r
233 \r
234 #### 17.4.5.1 Locked-speed Config \r
235 \r
236 For a locked-speed configuration, you will need to configure the modem to maintain a constant modem-to-computer data rate independent of the communications rate. On a U.S. Robotics Sportster 14,400 external modem, these commands will lock the modem-to-computer data rate at the speed used to issue the commands:\r
237 \r
238     \r
239     ATZ\r
240     AT&B1&W\r
241 \r
242 \r
243 #### 17.4.5.2 Matching-speed Config \r
244 \r
245 For a variable-speed configuration, you will need to configure your modem to adjust its serial port data rate to match the incoming call rate. On a U.S. Robotics Sportster 14,400 external modem, these commands will lock the modem's error-corrected data rate to the speed used to issue the commands, but allow the serial port rate to vary for non-error-corrected connections:\r
246 \r
247     \r
248     ATZ\r
249     AT&B2&W\r
250 \r
251 \r
252 #### 17.4.5.3 Checking the Modem's Configuration \r
253 \r
254 Most high-speed modems provide commands to view the modem's current operating parameters in a somewhat human-readable fashion. On the U.S. Robotics Sportster 14,400 external modems, the command `ATI5` displays the settings that are stored in the non-volatile RAM. To see the true operating parameters of the modem (as influenced by the modem's DIP switch settings), use the commands `ATZ` and then `ATI4`.\r
255 \r
256 If you have a different brand of modem, check your modem's manual to see how to double-check your modem's configuration parameters.\r
257 \r
258 ### 17.4.6 Troubleshooting \r
259 \r
260 Here are a few steps you can follow to check out the dial-up modem on your system.\r
261 \r
262 #### 17.4.6.1 Checking Out the DragonFly System \r
263 \r
264 Hook up your modem to your DragonFly system, boot the system, and, if your modem has status indication lights, watch to see whether the modem's DTR indicator lights when the login: prompt appears on the system's console -- if it lights up, that should mean that DragonFly has started a `getty` process on the appropriate communications port and is waiting for the modem to accept a call.\r
265 \r
266 If the DTR indicator does not light, login to the DragonFly system through the console and issue a `ps ax` to see if DragonFly is trying to run a `getty` process on the correct port. You should see lines like these among the processes displayed:\r
267 \r
268     \r
269       114 ??  I      0:00.10 /usr/libexec/getty V19200 ttyd0\r
270       115 ??  I      0:00.10 /usr/libexec/getty V19200 ttyd1\r
271 \r
272 \r
273 If you see something different, like this:\r
274 \r
275     \r
276       114 d0  I      0:00.10 /usr/libexec/getty V19200 ttyd0\r
277 \r
278 \r
279 and the modem has not accepted a call yet, this means that `getty` has completed its open on the communications port. This could indicate a problem with the cabling or a mis-configured modem, because `getty` should not be able to open the communications port until CD (carrier detect) has been asserted by the modem.\r
280 \r
281 If you do not see any `getty` processes waiting to open the desired `ttyd`***N****** port, double-check your entries in `/etc/ttys` to see if there are any mistakes there. Also, check the log file `/var/log/messages` to see if there are any log messages from `init` or `getty` regarding any problems. If there are any messages, triple-check the configuration files `/etc/ttys` and `/etc/gettytab`, as well as the appropriate device special files `/dev/ttydN`, for any mistakes, missing entries, or missing device special files.\r
282 \r
283 #### 17.4.6.2 Try Dialing In \r
284 \r
285 Try dialing into the system; be sure to use 8 bits, no parity, and 1 stop bit on the remote system. If you do not get a prompt right away, or get garbage, try pressing Enter about once per second. If you still do not see a login: prompt after a while, try sending a `BREAK`. If you are using a high-speed modem to do the dialing, try dialing again after locking the dialing modem's interface speed (via `AT&B1` on a U.S. Robotics Sportster modem, for example).\r
286 \r
287 If you still cannot get a login: prompt, check `/etc/gettytab` again and double-check that\r
288 \r
289
290 * The initial capability name specified in `/etc/ttys` for the line matches a name of a capability in `/etc/gettytab`\r
291
292 * Each `nx=` entry matches another `gettytab` capability name\r
293
294 * Each `tc=` entry matches another `gettytab` capability name\r
295 \r
296 If you dial but the modem on the DragonFly system will not answer, make sure that the modem is configured to answer the phone when DTR is asserted. If the modem seems to be configured correctly, verify that the DTR line is asserted by checking the modem's indicator lights (if it has any).\r
297 \r
298 If you have gone over everything several times and it still does not work, take a break and come back to it later. If it still does not work, perhaps you can send an electronic mail message to the [DragonFly User related mailing list](http://leaf.dragonflybsd.org/mailarchive/) describing your modem and your problem, and the good folks on the list will try to help.\r
299 \r
300 \r
301 \r
302 CategoryHandbook\r
303 CategoryHandbook-serial\r