Updated for new URLs and new hosting location 5/16/05 - mrbill@sunhelp.org -------------------------------------------------------------------------- Celeste's Tutorial on SunOS 4.1.x Modems & Terminals ==================================================== Revision 1.3, 1/4/96 This document is a tutorial that will teach you everything you should need to know about connecting asynchronous modems and terminals to a Sun workstation under Sun's SunOS 4.1.3 and higher 4.1.x releases (also known as Solaris 1.1 and up). It does not cover the specifics of setting up PPP. Section Description Page ------------------------------------------------------------------------ ...Introduction........................................................2 ...Lawyer Section:.....................................................2 A....Which Modem Should You Use?.......................................3 Types of Modem Usage-------------------------------------------3 Modem Programming----------------------------------------------4 Modem Speed----------------------------------------------------4 Flow Control and Parity----------------------------------------5 B....Celeste's Strategy for Configuring Modems and Terminals...........6 Ok, So What Do I Do?-------------------------------------------6 To use a port for dial-out only:-----------------------------6 To use a port for dial-in only:------------------------------6 To use a port for bidirectional (dial-in and dial-out) use:--7 To configure a dumb terminal on a port instead of a modem:---7 C....Tip and /etc/remote...............................................8 /etc/remote example-------------------------------------------10 D....Basic Modem Programming..........................................11 E....Making the /dev Entries..........................................12 F..../etc/gettytab....................................................13 /etc/gettytab Example:----------------------------------------13 G..../etc/ttytab......................................................14 /etc/ttytab Examples:-----------------------------------------15 How to turn off getty for a port------------------------------15 H....eeprom Settings..................................................16 I....Setting ttysoftcar...............................................17 To set up ttysoftcar for a modem on ttya----------------------17 To set up ttysoftcar for a terminal on ttya-------------------17 J....Case Study: Setting up a Bidirectional Modem.....................18 K....Case Study: Setting up a Dial-out-only Modem.....................20 L....Case Study: Setting Up A Terminal................................22 M....Configuring Serial Ports for UUCP................................24 Parity in UUCP------------------------------------------------24 Flow control with UUCP----------------------------------------25 N....Vendor List......................................................26 You may distribute this information to anyone who wants it, as long as you never attempt to copyright it in any way. If you find errors in it, or have suggestions for changes in future revisions, please let me know via email. Go for it--you can do it! ..Celeste Stokely, IT Project Managment Consultant, Stokely Consulting celeste@stokely.com, http://www.stokely.com / 505-534-3140 / FAX: 505-534-3141 Stokely Consulting, 22 Six Shooter Drive, Silver City NM 88061-9791 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 2 Introduction Setting up modems and terminals under Unix is often painful, but it isn't impossible if you have a guide. If this is your first attempt at hooking up a modem or terminal to a Unix machine, I'll give you a sound strategy to use and walk you through it. It's not really hard once you learn a few basics. You must execute the commands as root and you may have to reboot the machine. So, plan the system's downtime accordingly. WARNING: I have very strong feelings about modems and serial ports, their uses, their manufacturers, and their support. My clients ask me to make their modems work and stay working, so I tend to use only modems that are robust, highly configurable, fast, and well-supported. They're not cheap, but neither is a System Administrator's time. I use cheap modems for doorstops and bookends. Many thanks to the reviewers of this document! These hard-working folks include Bruce Schoenleber of Magma, and Glenn Satchell of Uniq Professional Services Pty Ltd. Lawyer Section: Copyright (c) 1995 Stokely Consulting. Permission to use, copy, and distribute this documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies, that both that copyright notice and this permission notice appear in supporting documentation, that this document is not modified, and that the name of Stokely Consulting not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Stokely Consulting makes no representations about the suitability of this documentation for any purpose. It is provided "as is" without express or implied warranty. All other product names are copyrighted by their various owners. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 3 A. Which Modem Should You Use? ============================== There are hundreds of Hayes-compatible, asynchronous modems on the market today. Most of them can be made to work on a Sun for dial-out. Many can work for dial-in. Several will work gracefully for bidirectional (dial-in and dial-out) use. Fewer still will bring a smile to a sysadm's heart. If you're trying to connect a non Hayes-compatible modem to your Sun, this article won't work for you. This article covers the basic setup for many common serial port usages, such as: - dial-in only access for human login accounts - dial-out only access for humans and programs using "tip". - dial-in and dial-out setups for UUCP (email, Usenet NetNews, file transfer) - Bidirectional modem use: dialing in and out on the same port - Basic dumb terminal connection, ("dumb terminal" == vt100, Wyse-50, and other plain, character-based terminals.) This article specifically does not cover: - Setting up PPP or SLIP - Using your modem to send FAXes - X Terminal setup In general, you get what you pay for. A $49 modem will cost you a fortune in the time it takes to get it running. A $499 modem can often be configured and running in under 20 minutes and give you little grief in day-to-day use. Types of Modem Usage ----------------------- Match your modem to your intended use for it. Don't buy a cheap 2400bps modem to transfer all your company's mail and netnews. If your Internet service provider offers your UUCP connection only over Telebit WorldBlazers, you should strongly consider buying a Telebit WorldBlazer and dedicate it to that use. If they're not a Telebit site and plan on staying that way, there are faster, more widely-compatible modems available for a LOT less money. My current favorite is the USRobotics Courier V.34--a sweet modem that gets better with every release of the flash-upgrade for the ROM. Next month, who knows what will be the darling? I have so many "former favorite" modems in my office that it's starting to look like a modem museum. If you have to support a lot of dial-in users with a wide collection of random modems, then you need something which can happily work with all the possible user modems. That means you need one that will run at least 14400bps. The new real V.34 28800bps modems will be even better, in the long run. Plan on spending $250-$600 for this modem. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 4 Modem Programming -------------------- In deciding which modem to buy, a key consideration is how you can program the modem. Some modems use DIP switches, some are programmed by connecting to the modem and setting software registers, some use both methods. You get more programming flexibility with software registers, and this is important when you'll be connecting to a lot of different modem types. If a modem has only DIP switches available, it probably will be hard to make it do everything you need for lots of different connections. It's probably also an old, slow modem. I call these "cheap PC modems" and avoid them like spamming Internet lawyers. Modem Speed -------------- One of the most important features to look for is the modem's ability to run at split speeds. You really want to run the Sun-to-modem connection at a fixed speed (the "DTE rate" or "serial rate") all the time, and let the modem negotiate the modem-to-modem speed ("DCE rate" or "line speed") independently. Beware, because many inexpensive modems can't do this. If your modem doesn't do this, you and your users will have to hit until the speeds sync up. This drives users (and you) crazy! You should try to run the Sun-to-modem (DTE) connection at 9600bps, 19200bps, or 38400bps. A Sun can NOT run the CPU serial port at 14400bps. But, that's ok because all the 14400 modems I've ever seen can run at 19200bps DTE speed. You can also run at slower speeds, but why bother? Buy a faster modem than you think you need and you'll get more use out of it in the long run. There are a few kernel hacks available to run the Sun CPU serial ports at higher speed. Use them at your own risk. I do NOT recommend them--they're too unstable for most purposes. The Sun CPU serial ports and their drivers are bad enough without hacking on them yourself. If you crave more speed than 38400bps, you need to look into SBUS serial- port expander cards with DMA (I like Magma's line of DMA serial cards), or even network-connected terminal servers, and modems which are even MORE expensive. If you need a lot of high-speed serial connections, network terminal servers are probably the way you should go. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 5 Flow Control and Parity -------------------------- When you run at higher speeds (9600bps and above), you MUST worry about flow control. Ideally, you want hardware flow control where the Sun and modem play the right games with the RTS/CTS lines to say "shut up" and "give me more". Software flow control on the zs (tty[ab]) ports will not cure the "zs[01]: silo overflow" problem. This problem will become apparent at speeds > 9600 on the zs ports, and probably on third party ports at speeds > 19200. Ports which have DMA capability are less prone to have this problem. Of course, any port which uses DMA probably has hardware flow control as well. For SLIP, PPP and UUCP applications, the performance of the cpu serial ports may be abysmal at very high speeds because of an excessive number of frame retransmits. Determine if the performance is good enough for you, and, if not, plan to spend $500+ for a good, DMA SBUS-based serial port card for your Sun. Yes, that's expensive, but solid, reliable communications may be critical to your application. Historically, the Sun CPU ports have not been able to use incoming hardware flow control, only outgoing. Sun has released a patch to enable incoming flow control. This is Patch # 100513 for SunOS 4.1.1-4.1.3, and Patch # 101621 for SunOS 4.1.3_U1, each lovingly known as the "Jumbo TTY Patch". The bugids are 1139832, 1143251, 1143399, 1012954, 1143250, 1182165, 1150599, and many others. Refer to Sunsolve or Sun Technical Support to see if there is a patch for your version of SunOS. I've had moderate success with these patches. Sometimes, they just don't work. Sometimes they do. It's worth a try at least. If it doesn't work and you must have hardware flow control, look into the higher-end SBUS-based serial port expander cards. If the patch doesn't work for you, you can consider using software (XON/ XOFF) flow control. But, NEVER use software flow control with UUCP or UUCP will go nuts from the unexpected XON and XOFF characters. If you can't use hardware flow control with UUCP, it's better to use no flow control at all and let UUCP do its own packet throttling. I run my own communications server without port-level flow control on my 13 UUCP connections at 38400bps and all the mail and NetNews gets delivered just fine. Try to always run your ports and modems at 8 bits, no parity. Parity on serial port transmissions is an outdated concept when you're using modern, error-correcting modem protocols. By default, the Sun CPU ports run at 7 bits, even parity (7E1). I'll explain how to run them at 8 bits, no parity (8N1). If you've got a legitimate use for odd, mark, or space parity, I want to hear from you! 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 6 B. Celeste's Strategy for Configuring Modems and Terminals ========================================================== This strategy gives you flexibility and maintainability in your serial port configurations. It will work for nearly all configurations. Important Rule: Add and configure only 1 modem or terminal at a time. Get it working, then move on to the next one. Any other approach will result in madness. I been there, done that. Trust me. There are quite a few steps, but each one is small and easy to accomplish. Purists may argue that my method of modem-port configuration has extra steps. I find that if a sysadm sets up a port for only dial-in or dial-out, someday he or she will want the port to be bidirectional. Setting things up for this in the beginning means you'll have easier success in the future. And, it doesn't hurt anything. Ok, So What Do I Do? -------------------- To use a port for dial-out only: - Configure /etc/remote for tip (See "Tip and /etc/remote" on page 8.) - Make the /dev entries (See "Making the /dev Entries" on page 12.) - Set up /etc/ttytab (See "/etc/ttytab" on page 14.). - Set up the eeprom (See "eeprom Settings" on page 16.). - Program the modem and don't forget to turn off the modem's auto-answer capability. (See "Basic Modem Programming" on page 11.) To use a port for dial-in only: - Configure /etc/remote for tip (See "Tip and /etc/remote" on page 8.) - Make the /dev entries (See "Making the /dev Entries" on page 12.) - Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) - Turn off the getty process (See "How to turn off getty for a port" on page 15.) - Set up ttysoftcar (See "Setting ttysoftcar" on page 17.) - Set up the eeprom (See "eeprom Settings" on page 16.). - Program the modem (See "Basic Modem Programming" on page 11.) - Configure the getty process to spawn a login correctly (See "How to turn off getty for a port" on page 15.) - Make /bin/tip owner-executable only. Don't delete it, you'll need it someday. And, remember to leave it setuid-uucp! 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 7 To use a port for bidirectional (dial-in and dial-out) use: - Configure /etc/remote for tip (See "Tip and /etc/remote" on page 8.) - Make the /dev entries (See "Making the /dev Entries" on page 12.) - Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) - Turn off the getty process (See "How to turn off getty for a port" on page 15.) - Set up ttysoftcar (See "Setting ttysoftcar" on page 17.) - Set up the eeprom (See "eeprom Settings" on page 16.). - Program the modem (See "Basic Modem Programming" on page 11.) - Configure the getty process to spawn a login correctly (See "/etc/ ttytab" on page 14.) To configure a dumb terminal on a port instead of a modem: - Ignore tip (That should be easy!) - Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) - Turn off the getty process (See "How to turn off getty for a port" on page 15.) - Set up ttysoftcar (See "Setting ttysoftcar" on page 17.) - Set up the eeprom (See "eeprom Settings" on page 16.) - Configure the getty process to spawn a login correctly. (See "/etc/ ttytab" on page 14.) - Configure the terminal itself, setting up the baud rate, word length and parity, and flow control. (I strongly suggest using SW flow control on terminals, because many Null Modem cables cross DTR to DSR and CD, which may cause you grief.) If you want to use UUCP, you must configure it as well. This article will tell you about setting up parity and flow control in UUCP, but doesn't cover all the other UUCP file changes. For that, get the O'Reilly and Associates book _Managing UUCP and Usenet_. Simple, huh? Find the parts of this article that do the pieces you want, modify the scripts as needed, and go for it! 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 8 C. Tip and /etc/remote ====================== You may hate tip and love kermit or pcomm. I understand. But, do this via tip to keep it simple, ok? Decide which serial port you want to use. (One with no cable already plugged in is often a good bet.) The port will be labeled "A", "B", "A/B" or could even be "C" or higher. If you use one labeled "A/B" and have no Y-type splitter cable plugged into it, you'll have access only to port A. With the splitter, you'll get ports A and B on separate sockets of the splitter cable. The Sun serial port device driver splits each physical port into two logical devices, /dev/ttya or /dev/ttyb for incoming transmission, and /dev/cua0 or /dev/cua1 for outgoing transmission. The "speed" referred to in this section is the DTE or Sun-to-modem speed. It is NOT the modem-to-modem speed. A 14400bps modem may have a 19200bps DTE speed. Make sure you have your serial port permissions right. uucp should own the outgoing side, and root should own the incoming side. Execute these commands as root, substituting your port name (0/a, 1/b, 2/c, or 3/d) where needed: prompt# chown uucp /dev/cua0 prompt# chown root /dev/ttya 1. Edit tip's configuration file, /etc/remote, and find the entry beginning with "hardwire:". This is the entry you use to program the modem, and is not usually used for dialing out directly, unless you enjoy AT commands. (If this is the second modem you're adding, clone the entire hardwire entry and label the new entry "hardwire2".) Change it from an entry like: hardwire:\ :dv=/dev/????:br#????:el=^C^S^Q^U^D:ie=%$:oe=^D to one set to your port (like /dev/cua0) and baud rate (like 9600) hardwire:\ :dv=/dev/cua0:br#9600:el=^C^S^Q^U^D:ie=%$:oe=^D: >> Go to step 2 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 9 2. Setup and run tip: NOTE: Never run tip from a cmdtool. Use a shelltool, xterm, or some other window without scrollbars. The scrollbars may confuse tip's processing. There are exceptions to this, but if you never run tip in a scrollbar-type window, you won't have to remember all the ways it does and does not work Now use your edited "hardwire" entry from /etc/remote and type: prompt# tip hardwire (or "tip hardwire2") you should see "connected" type: ATE1V1 (This will work for all Hayes-compatible modems, even cheapies.) You should see "OK". Congratulations! You're talking with the modem! Now, issue the appropriate AT commands to program the modem. (See "Basic Modem Programming" on page 11.) Don't forget to write the new settings out to the modem's NonVolatile RAM. If you don't see "OK", you are not communicating with the modem. See if the modem is plugged in, verify the baud rate of the modem and the hardwire entry in /etc/remote, verify the modem cable. - Exit tip by typing: ~. (This means to type 3 separate keys, one at a time, of This will also exit rlogin, so if you're running tip through an rlogin, make that ~~. ( ) or you'll only exit rlogin.) - The cua0 entry (below) allows you to type "tip cua0" and talk directly to a modem on port A at 19200bps, using 7 bits, even parity. - The cua1 entry (below) allows you to type "tip cua1" and talk directly to a modem on port A at 9600bps, using 8 bits, no parity. - "tip some_phone_number" will look for the tip0 entry and use that definition to dial "some_phone_number". (In the /etc/remote example below, it will use tip0, which points to UNIX-19200, which sets up a dialup 19200bps, 7 bits even parity Hayes compatible modem. UNIX-19200 points to diala, which references /dev/cua0. Convoluted, eh?) - "tip mysystem" (below) looks up the "mysystem" entry, and dials the number 14155551234 via a 19200bps 7 bits, no parity connection on /dev/cua0. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 10 /etc/remote example ------------------- The following sample /etc/remote file is set up for: port a, 19200bps Hayes-compatible modem, 7 bits even parity (It's 7E1 because there is no "p8" entry) port b, 9600bps Hayes-compatible modem, 8 bits no parity (It's 8N1 because there is a "p8" entry) See the remote(4) man page for all the possible options. cua0:dv=/dev/cua0:br#19200: cua1:dv=/dev/cua1:p8:br#9600 mysystem:pn=14155551234:tc=UNIX-19200: hardwire:\ :dv=/dev/cua1:p8:br#9600:el=^C^S^Q^U^D:ie=%$:oe=^D: tip0|tip19200:tc=UNIX-19200: tip9600:tc=UNIX-9600: UNIX-9600:\ :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#9600:tc=dialb: UNIX-19200:\ :el=^D^U^C^S^Q^O@:du:at=hayes:ie=#$%:oe=^D:br#19200:tc=diala: diala:\ :dv=/dev/cua0: dialb:\ :p8:dv=/dev/cua1: -------------------------------------------------------------------- The attributes are: dv device to use for the tty du make a call flag (dial up) pn phone numbers (@ =>'s search phones file; possibly taken from PHONES environment variable) at ACU type ie input EOF marks (default is NULL) oe output EOF string (default is NULL) cu call unit (default is dv) br baud rate (defaults to 300) tc to continue a capability 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 11 D. Basic Modem Programming ========================== Dust off your modem manual and have it handy. Use tip to connect to the modem and program the modem registers. Be sure to write out the modem's registers to NonVolatile RAM when you're done. Program the modem with: - Hardware DTR, Normal DTR, or Reset When DTR Toggles. When the Sun drops DTR the modem should hang up the phone line and reset the modem to NonVolatile RAM settings. - Hardware Carrier Detect or Normal Carrier Detect. The modem should only raise Carrier Detect (known as CD or DCD) when there is an active carrier signal on the phone connection. You'll setup the port monitor so that when CD goes active, the Sun will spawn a login. When carrier drops, either when the other end of the connection terminated or if the phone connection is broken, the Sun will be notified and act appropriately. The CD signal is also used for coordinating dial-in and dial-out use on a single serial port. - Respond with numeric result codes if this is for tip's use. (Usually this is ATV0) If you're setting the modem for UUCP dialout, then program the modem to use English result codes (like CONNECT). (Usually, this is ATV1.) If you're using the modem for both tip and UUCP, set it up with numeric result codes, and have UUCP's chat script set it to English result codes for the duration of the UUCP connection. See the O'Reilly and Associates' book _Managing UUCP and Usenet_ for the nitty-gritties. - Send BASIC result codes ONLY. Tip only wants to see result codes 0 through 4. If it sees other result codes, it calls them an error. (Sometimes this is ATX0 or ATQ0) - Do not echo commands. (Usually this is ATE0) - Modem is locked at a single speed setting between Sun and modem. The speed may vary as needed between local and remote modem, but should remain constant between the Sun and modem.(If your modem can't do this, use it for a paperweight and buy one that allows split speeds If your boss won't let you do this, ok, but you should whine loudly.) - If this modem is used for dial-in, turn on Auto-Answer. (Sometimes this is ATS0=1.) If the modem is not used for dial-in, turn off Auto-Answer. (Sometimes this is ATS0=0.) - Set the modem to your parity and word length requirements. Use 8 bits, no parity if you can. - Set the modem to your flow control scheme. Use hardware flow control (CTS/RTS) if you can, software flow control (XON/XOFF) if you must, or no flow control if you just have to. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 12 E. Making the /dev Entries ============================================= SunOS 4.x knows that there is an incoming and outgoing side of a port through the major and minor number of the /dev entry. An outgoing port has a minor number that equals the minor number of the incoming port + 128, as in: crw--w--w- 1 root wheel 12, 0 Jan 21 07:59 /dev/ttya crw------- 1 uucp staff 12, 128 Jan 16 18:24 /dev/cua0 crw--w--w- 1 root wheel 12, 1 Dec 29 13:57 /dev/ttyb crw------- 1 uucp staff 12, 129 Jan 21 08:05 /dev/cua1 Root owns the incoming side of the port, and uucp owns the outgoing side. tip is setuid-uucp, so it can open the outgoing port. If you use kermit, it should be made setuid-uucp, too. If your port devices do not exist or do not match the major/minor number pairs above, then you will need to make the devices. Be careful in making assumptions about the major number. It may not always be 12 for the zs driver, and it can be anything for third party drivers. Of course, /dev/ttya and /dev/ttyb should always be present and these will have the correct major number. If these were accidentally removed, then you may want to look for the "zstab" entry in the cdevsw table in /usr/sys/sun/ conf.c to verify the major number. These commands will make the outgoing devices properly, assuming the major number of your cpu serial ports is 12. prompt# cd /dev prompt# rm cua0 cua1 prompt# mknod cua0 c 12 128 prompt# mknod cua1 c 12 129 prompt# chmod 600 cua0 cua1 prompt# chown uucp cua0 cua1 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 13 F. /etc/gettytab ================ The file /etc/gettytab is used to define entries for combinations of baud rate, word length, flow control, and other characteristics of terminal lines. (The file reads a lot like a termcap file.) This file is used by getty and the entries from /etc/gettytab are referenced in /etc/ttytab. Practically any stty option can be set in a gettytab entry, but if you get too fancy, expect to run into some problems. This file is also used to set up "login messages" and "initial messages", but you can't make them too long. See the gettytab(5) man page for a full discussion. /etc/gettytab Example: ---------------------- Each entry consist of a number of colon-separated (:) fields. The first field for each terminal lists the various names by which it is known, separated by bar ( | ) characters. Each entry defaults to 7bits, even parity, unless it states otherwise: # # 9600 baud, 7E1, s/w flow control # 2|std.9600|9600-baud:\ :sp#9600: # # 19200 baud, 7E1, h/w (crtscts) flow control # g|std.19200|19200-baud:\ :sp#19200:ms=crtscts: # # 38400 baud, 8N1 (because of p8), h/w (crtscts) flow control # n|p8.38400|38400-baud:\ :p8:sp#38400:ms=crtscts: # # 38400/19200/9600 rotary (can start either way) # Lets users hit to try to match up their baud rate with # the getty's baud rate. (This is gross, IMHO) # "tc" means "continue the description with the next named entry" # Cl|c38400|Fast-Dial-38400:\ :nx=c19200:tc=38400-baud: C19200|Fast-Dial-19200:\ :nx=C9600:tc=19200-baud: C9|C9600|Fast-Dial-9600:\ :nx=c38400:tc=9600-baud: 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 14 G. /etc/ttytab =============== The /etc/ttytab file is read by init (process ID 1). /etc/ttytab is used to set up some port characteristics, such as what program should be started on the port (like the getty program), if it should be started, and to set some initial values of the port, (terminal type, secure mode, modem or terminal connection). See the ttytab(5) and termio(4) man pages for a more complete discussion of all the fields. Fields are separated by TAB and/or SPACE characters. Some fields may contain more than one word and should be enclosed in double quotes. Blank lines and comments can appear anywhere in the file; comments are delimited by `#' and NEW-LINE. Unspecified fields default to NULL. This document limits its discussion of the fields as they pertain to our friend, getty. Important: After you make a change to /etc/ttytab or /etc/gettytab, you must execute "kill -1 1" to invoke the changes. The format of the lines are: dev-entry cmd-to-execute terminal-type on-off local-remote secure dev-entry The port's entry in /dev. Since getty operates on the incoming side of a port, this is usually ttya or ttyb for cpu serial ports. cmd-to-execute The command to be executed, and the command's arguments. Since there are spaces in this token, enclose the token in double quotes. This is the getty invocation, and the argument is the name of an entry in /etc/gettytab. terminal-type The initial terminal type, found in /etc/termcap, of the type of terminal or commuications program terminal emulator which will be using this getty. vt100 is usually a safe bet, but you can use practically anything which matches your setup from /etc/termcap. on-off Use "on" if you want the getty to start on this port. Use "off" if you do not want the getty to start on this port. local-remote Use "remote" to tell getty that a modem will be on this port, and to use hardware carrier detect and modem signaling. "Local" says that you'll be using a terminal, so the kernel will use software carrier detect. Actually, any word other than "remote" means not-a-modem. See termio(4). secure If the word "secure" is present, root will be allowed to login directly on this port. If "secure" is not present, root will not be allowed to login directly on this port. This does not affect su in any way. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 15 /etc/ttytab Examples: --------------------- Important: After you make a change to /etc/ttytab or /etc/gettytab, you must execute "kill -1 1" to invoke the changes. 1. Modem on ttya, set to fixed DTE rate of 19200, 7bits even parity (because of the default Sun std.19200 entry in /etc/gettytab), do not allow root to login directly, vt100 terminal emulation: ttya "/usr/etc/getty std.19200" vt100 on remote 2. Terminal on ttyb, set to fixed DTE rate of 19200, 7bits even parity (because of the default Sun std.19200 entry in /etc/gettytab, allow root to login directly, vt100 terminal emulation: ttyb "/usr/etc/getty std.19200" vt100 off remote secure How to turn off getty for a port -------------------------------- You usually can't turn off getty by just killing the getty process. The "init" process will restart an absent getty, if init has been told to do this in the /etc/ttytab file. The proper way to kill a getty is via the /etc/ttytab file. Locate the line for the port you're working with: ttya "/usr/etc/getty std.19200" vt100 on remote Edit the line to turn the "on" to "off", as in: ttya "/usr/etc/getty std.19200" vt100 off remote Then tell "init" (process ID 1) to reread the file and turn off the getty process with: prompt# kill -1 1 There should not be a getty running on the port now. Prove this with: prompt# ps -auwx | grep getty | grep -v grep 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 16 H. eeprom Settings ================== Religious wars equal to the "vi vs. emacs" war have been fought over eeprom settings for serial ports. If you want to flame me over my eeprom advice, I insist that we discuss this over the drinks you will have to buy for me. :-) Here, I'm just giving you the facts and telling you what works for me. These are my own eeprom settings, for my 38400bps 8N1 modem on ttya, using hardware flow control: ttya-rts-dtr-off=false ttya-ignore-cd=true ttya-mode=9600,8,n,1,- Your eeprom entries may vary, depending on which port you're using (ttya, ttyb, ttyc, ttyd), and your cpu architecture. See eeprom(8) for your machine's commands, or just type "eeprom" and look at the output. Set the entries with "eeprom field-name=value", as in: prompt# eeprom ttya-mode=19200,8,n,1,h ttya-rts-dtr-off Set to "true" or "false". "true" means do not use modem signaling (like DTR and RTS). "false" means it SHOULD use modem signaling. (Sun's use of reverse logic here drives me nuts!) ttya-ignore-cd Set to "true" or "false". "true" means to ignore software carrier detect but use hardware carrier detect, as in a modem connection. "false" means to use software carrier detect only, as in a terminal connection. (This is more reverse logic!) ttya-mode Syntax: baudrate,data-bits,parity,stop-bits,flow-control. The settings for baudrate and flow-control do not seem to matter (as long as they're valid entries) once getty starts. Flow-control is -(none), h(hardware:rts/cts), or s(software:xon/xoff). Stop-bits is 1, 1.5, or 2. Data-bits is 5,6,7, or 8. Parity is n(none), e(even),o(odd), m(mark), or s(space). 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 17 I. Setting ttysoftcar ===================== ttysoftcar is invoked at boot time from /etc/rc to enable or disable software carrier detect on ports as specified in /etc/ttytab. It can also be invoked from the command line. Usually, when adding a modem or terminal to a port, you have to invoke ttysoftcar to get the connection working properly. It's best to turn off any getty on the port, run ttysoftcar to set up the carrier-detect mode you need, and then set up the getty process in /etc/ttytab. Warning: Running ttysoftcar from the command line will hang if there is a getty already running on a port. Kill the getty first, then run ttysoftcar to change the carrier detect setting. Syntax: ttysoftcar [-y|-n] tty or ttysoftcar -a -a resets ttys to appropriate values based on the status field of the /etc/ttytab file. -y turns on software carrier detect. -n turns off software carrier detect and uses hardware carrier detect. If no options are specified, ttysoftcar returns the current status for tty. This status is reported as y or n. 1. To set up ttysoftcar for a modem on ttya - Turn off the getty process (See "How to turn off getty for a port" on page 15.) - Issue the command: prompt# ttysoftcar -n ttya 2. To set up ttysoftcar for a terminal on ttya - Turn off the getty process (See "How to turn off getty for a port" on page 15.) - Issue the command: prompt# ttysoftcar -y ttya 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 18 J. Case Study: Setting up a Bidirectional Modem =============================================== This is just a sample, but it may help. The goal of this exercise is to set up a USR Courier V.34 modem on cpu serial port ttyb at a 38400bps, 8bits, no parity, fixed DTE rate, for dial-in and dial-out, using hardware flow control. Root will not be allowed to login directly. Expect a vt100 emulator on the machine dialing in. 1. Configure /etc/remote for tip (See "Tip and /etc/remote" on page 8.) Add this line to the top of /etc/remote: usr:p8:br#38400:dv=/dev/cua1: 2. Make the /dev entries (See "Making the /dev Entries" on page 12.) prompt# cd /dev prompt# rm cua1 prompt# mknod cua1 c 12 129 prompt# chmod 600 cua1 prompt# chown uucp cua1 3. Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) Add this entry to /etc/gettytab: ("p8" makes it 8N1, "crtscts" makes it use hardware flow control.) n|p8.38400|38400-baud:\ :p8:sp#38400:ms=crtscts: 4. Turn off the getty process (See "How to turn off getty for a port" on page 15.) Edit /etc/ttytab to create this entry: ttyb "/usr/etc/getty p8.38400" vt100 off remote then execute the command: prompt# kill -1 1 5. Set up ttysoftcar (See "Setting ttysoftcar" on page 17.) Execute the command: prompt# ttysoftcar -n ttyb 6. Set up the eeprom (See "eeprom Settings" on page 16.). Execute the commands: prompt# eeprom ttyb-rts-dtr-off=false prompt# eeprom ttyb-ignore-cd=true prompt# eeprom ttyb-mode=38400,8,n,1,h 7. Plug the modem into ttyb, using a 25 pin, straight-through cable. You can make fancier cables, but that takes time. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 19 8. Program the modem (See "Basic Modem Programming" on page 11.) (Yes, this is cheating. I pulled these settings directly from a client's working USR Courier V.34 modem. But, it's ok because I set it up. :-) It will probably take a few tries to get all the right settings into your modem. No, you don't need to set ALL the S registers this way. These have been tweaked for the client's application. Your mileage will definately vary, but the entries below on this modem, from the "B0 C1" through the "S00=001" are very good ones to use, IMHO. prompt# tip usr then program away. Be sure to write things out to NVRAM (Non-volatile RAM). Exit tip by typing ~.(This means to type 3 separate keys, one at a time, of This will also exit rlogin, so if you're running tip through an rlogin, make that ~~. ( ) or you'll only exit rlogin.) USRobotics Courier V.32bis V.34 Fax Settings... B0 C1 E1 F1 M1 Q2 V0 X0 BAUD=38400 PARITY=N WORDLEN=8 DIAL=TONE ON HOOK TIMER &A0 &B1 &C1 &D2 &G0 &H1 &I0 &K1 &L0 &M4 &N0 &P0 &R1 &S0 &T5 &X0 &Y1 %N6 S00=001 S01=000 S02=255 S03=013 S04=010 S05=008 S06=002 S07=060 S08=002 S09=006 S10=007 S11=070 S12=255 S13=000 S14=000 S15=000 S16=000 S17=000 S18=000 S19=000 S20=000 S21=010 S22=017 S23=019 S24=150 S25=005 S26=001 S27=000 S28=008 S29=020 S30=000 S31=000 S32=009 S33=000 S34=000 S35=000 S36=000 S37=000 S38=000 S39=000 S40=000 S41=000 S42=126 S43=200 S44=015 S45=000 S46=000 S47=000 S48=000 S49=000 S50=000 S51=000 S52=000 S53=000 S54=064 S55=000 S56=000 S57=000 9. Configure the getty process to spawn a login correctly (See "/etc/ttytab" on page 14.) Re-edit your /etc/ttytab line: ttyb "/usr/etc/getty p8.38400" vt100 on remote then execute the command: prompt# kill -1 1 If you have been only noble and kind all your life, the modem will now be working. It usually takes the rest of us a few more tries to get it right. So, take a deep breath, figure out what isn't right, and correct it in little steps. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 20 K. Case Study: Setting up a Dial-out-only Modem =============================================== This is another sample, but it may help. The goal of this exercise is to set up a Telebit WorldBlazer modem on cpu serial port ttyb at a 38400 8bits, no parity, fixed DTE rate, for dial-out only, using hardware flow control. 1. Configure /etc/remote for tip (See "Tip and /etc/remote" on page 8.) Add this line to the top of /etc/remote: wb:p8:br#38400:dv=/dev/cua1: 2. Make the /dev entries (See "Making the /dev Entries" on page 12.) prompt# cd /dev prompt# rm cua1 prompt# mknod cua1 c 12 129 prompt# chmod 600 cua1 prompt# chown uucp cua1 3. Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) add this entry to /etc/gettytab: ("p8" makes it 8N1, "crtscts" makes it use hardware flow control.) n|p8.38400|38400-baud:\ :p8:sp#38400:ms=crtscts: 4. Turn off the getty process (See "How to turn off getty for a port" on page 15.) Edit /etc/ttytab to create this entry: ttyb "/usr/etc/getty p8.38400" vt100 off remote then execute the command: prompt# kill -1 1 5. Set up the eeprom (See "eeprom Settings" on page 16.). Execute the commands: prompt# eeprom ttyb-rts-dtr-off=false prompt# eeprom ttyb-ignore-cd=true prompt# eeprom ttyb-mode=38400,8,n,1,h 6. Plug the modem into ttyb, using a 25 pin, straight-through cable. You can make fancier cables, but that takes time. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 21 7. Program the modem (See "Basic Modem Programming" on page 11.) (Yes, this is cheating. I pulled these settings directly from a client's working Telebit WorldBlazer modem. But, it's ok because I set it up initially. :-) It will probably take a few tries to get all the right settings into your modem. No, you don't need to set ALL the S registers this way. These have been tweaked for the client's application. Your mileage will definately vary, but the entries below on this modem, from the "B1 C1 through the S00=000" are very good ones to use, IMHO. And, S000=000 means "turn off auto-answer" to most modems. prompt# tip wb Then, program your modem's registers. Be sure to write the settings out to the modem's NVRAM (Non-volatile RAM). Exit tip by typing ~. (This means to type 3 separate keys, one at a time,of This will also exit rlogin, so if you're running tip through an rlogin, make that ~~. ( ) or you'll only exit rlogin.) WorldBlazer - SA - Version LA5.01 - Active Configuration B1 E1 L1 M0 Q2 T V0 X0 Y0 &C1 &D3 &G0 &J0 &L0 &Q0 &R3 &S4 &T4 &X0 S000=0 S001=0 S002=43 S003=13 S004=10 S005=8 S006=2 S007:90 S008=2 S009=6 S010=14 S011=70 S012:255 S018=0 S025=5 S026=1 S038=0 S041:1 S045=0 S046=0 S047=4 S048=0 S050=0 S051:253 S056=17 S057=19 S058:2 S059:15 S060=0 S061:0 S062=15 S063=0 S064:1 S068=255 S069=0 S090=0 S092:1 S093=8 S094=1 S100=0 S104=0 S105=1 S111:30 S112=1 S151=4 S155=0 S180=2 S181=1 S183=25 S190=1 S191:6 S253=10 S254=1 S255=255 The modem is probably now working. But, it may take a few more tries to get it right. So, take a deep breath, figure out what isn't right, and correct it in little steps. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 22 L. Case Study: Setting Up A Terminal ==================================== This is a sample of setting up a terminal for SunOS 4.x. The goal of this exercise is to set up a Wyse50 terminal (or terminal which emulates that) on cpu serial port ttya at 19200bps 7bits, even parity,using software flow control. 1. Set up the /etc/gettytab file (See "/etc/gettytab" on page 13.) For this example, I can use the following generic Sun /etc/gettytab entry: g|std.19200|19200-baud:\ :sp#19200: 2. Turn off the getty process (See "How to turn off getty for a port" on page 15.) Edit /etc/ttytab's ttya line to read: ttya "/usr/etc/getty std.19200" wyse50 off local Then execute the command: prompt# kill -1 1 3. Set up ttysoftcar (See "Setting ttysoftcar" on page 17.) Execute the command: prompt# ttysoftcar -y ttya 4. Set up the eeprom (See "eeprom Settings" on page 16.). Execute the commands: prompt# eeprom ttya-rts-dtr-off=true prompt# eeprom ttya-ignore-cd=false prompt# eeprom ttya-mode=19200,7,e,1,s 5. Configure the getty process to spawn a login correctly. (See "/etc/ ttytab" on page 14.) Re-edit /etc/ttytab's ttya line to read: ttya "/usr/etc/getty std.19200" wyse50 on local Then execute the command: prompt# kill -1 1 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 23 6. Configure the terminal itself, setting up the baud rate, word length and parity, and flow control. Set up the terminal for 19200bps, 7bits, even parity, 1 stop bit, software (xon/xoff) flow control, wyse50 emulation. Attach the terminal to port A on the Sun with either a null-modem cable or a cable with at least pins 2,3, and 7, with pins 2 and 3 crossed, as in:. 2------3 3------2 7------7 You will probably now see a login prompt on the terminal. If not, check your work closely and try again. 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 24 M. Configuring Serial Ports for UUCP ==================================== Parity in UUCP -------------- People often get confused about running UUCP in 7 bits vs. 8 bits vs. even vs. odd parity. Here's what's really going on and how to deal with it. Both the caller and receiver must agree on parity (even, odd, none) during the login sequence. 7 or 8 bit word length often doesn't matter, if you "do the right thing" with parity. Once the uucico's are running, UUCP's own protocol handles all these issues for you, but you need to be concerned with it during login. There are 4 parity-related options you can set up during the login chat: P_ZERO - 8 bits, no parity P_EVEN - 7 bits, even parity P_ODD - 7 bits, odd parity P_ONE - 7 bits, "1" or Mark parity per-system-to-call basis in the /etc/uucp/Systems file, but it can also be set for all uses of the port in /etc/uucp/Dialers file. UUCP Parity-per-system example: Setting up a port within UUCP to run with 8 bits, no parity, on a per-system-connect basis. In the file /etc/uucp/Systems, include P_ZERO in the chat script, as in: outhost Any ACU 9600 5551212 "" P_ZERO ogin: mylogin ssword: mypass This means that when you first start trying to contact the machine "outhost" uucp expects nothing ("") and sets P_ZERO (8 bits, no parity or 8N1). UUCP Parity-for-all-systms example: Setting up a port within UUCP to run with no parity, for all uses of this port. (This example assumes you are using the "tbfast" entry in your /etc/uucp/Devices file) In /etc/uucp/Dialers: tbfast =W-, "" P_ZERO "" \dA\pA\pA\pTE1V1X1...... 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 25 Flow control with UUCP ---------------------- With UUCP, either use hardware flow control or no flow control. Please remember that there is no incoming hardware flow control on Sun CPU serial ports, only outgoing hardware flow control. (There is no such limitation on non-CPU ports which claim to have hardware flow control.) Sun has released a patch for some releases of Solaris 1.x to enable hardware flow control on some systems' CPU serial ports. It may work on your system, but it may not. The lack of incoming hardware flow control is not a problem with UUCP, usually, because the UUCP protocol is robust enough to request retransmission of packets when the data isn't correct. Using a good modem that has built-in UUCP protocol support (also known as spoofing) may also help your throughput. (This is a good use for a Telebit WorldBlazer.) If all else fails, slow down the connection between the Sun and the modem to what you can support in your environment. The string "STTY=crtscts" tells UUCP to use hardware flow control. It's usually better to set this up on a per-port basis, rather than on a per-system basis, but UUCP will let you configure it however you want. 1. UUCP HW flow for all systems: Setting up a port with UUCP to use hardware flow control for all uses of this port. (Preferred way) (This example assumes you are using the "tbfast" entry in your /etc/uucp/Devices file) In /etc/uucp/Dialers, add "STTY=crtscts" after the CONNECT: tbfast =W-, "" \dA\pTE1.... \EATDT\T\r\c CONNECT STTY=crtscts 2. UUCP HW flow for some systems: Setting up a port with UUCP to use hardware flow control, on a per-system-connect basis. (Do this if you feel you must, but there are very few good reasons for it.) In the file /etc/uucp/Systems, include "STTY=crtscts" in the chat script, as in: outhost Any ACU 9600 5551212 ogin: mylog ssword: mypass "" STTY=crtscts 1/4/96-Rev 1.3 Celeste's Tutorial on SunOS 4.1.x Modems & Terminals Page 26 N. Vendor List ============== This list of vendors is vastly incomplete. The "Unix Serial Port Resources" page at http://www.sunhelp.org/unix-serial-port-resources/ is more up to date. These are just some of the companies whose products and/or services my readers, clients, and I have been usually satisfied with. If you have had a happy experience with other vendors of serial-port-based products for Suns, send me the info and I'll include them in this list. Companies, their products, and their support staffs change regularly, so your "satisfaction mileage" may vary. (I don't receive any money or special favors from any of these folks, nor would I consider it. I'm just a picky consumer, like you.) Serial cards: MAGMA, 6725 Mesa Ridge Rd., #100, San Diego, CA 92121 Voice: 800-285-8990 or 619-457-0750/FAX: 619-457-0798 Modems: US Robotics, 6100 N. McCormick Blvd., Skokie, IL 60076 Voice: 800-877-2677 Telebit Corporation, One Executive Drive, Chelmsford, MA 01824 Voice: 800-TELEBIT PPP: PUBLIC DOMAIN VERSION: dp is available by anonymous ftp at acn.purdue.edu:/dp) COMMERCIAL VERSION: Morning Star Technologies, Inc., 3518 Riverside Drive, Suite 101 Columbus OH USA 43221 Voice: 800-558-7827 / FAX: 614-459-5054 ftp.MorningStar.Com (anonymous FTP) Kermit: http://www.columbia.edu/kermit/ Terminal Servers: Xylogics Annex and micro Annex (WWW at http://www.xylogics.com) Xyplex (WWW at http://www.xyplex.com) Livingston Portmasters (WWW at http://www.livingston.com) Publishers: O'Reilly and Associates (_Managing UUCP and Usenet_ is a must-read.) ---------------------------------------------------------------------------- Celeste Stokely is an outspoken and pro-user Unix System Administration consultant who has been trying to make the world safer for Unix System Administrators since 1983. She lives in Silicon Valley, California and runs Stokely Consulting with her husband, Peter, and 2 bouncy cats, L.B. and Sparcy. Celeste can be reached via email at celeste@stokely.com.