### Configuring a Device for a Modem

Use this procedure will configure a RealPort device for a Dial-in/Dial-out modem connection.

Note: Configuring a device for a modem requires familiarity with both the operating system and the modem being used. While the following procedure is sufficient for most cases, it may be necessary to take additional steps to properly configure your modem or to set up the operating system for a specific application.

For more information on configuring a serial device for a modem see "Managing Modems and UUCP on the DG/UX System" and "Setting Up and Managing Terminals on the DG/UX System" on the user documentation CD that came with your system.

#### Requirements

The PortServer and RealPort should be properly installed, configured and functioning before proceeding.

#### Procedure

Note: The following procedure contains an example. This example shows that you are configuring a dial-in and dial-out modem on port 16 of the first PortServer, which corresponds to device /dev/tty17.

1. Connect a proper cable between the port and modem. See DB-25 Modem Cable, RJ-45 10-pin Modem Cable and RJ-45 8-pin Altpin Modem Cable.
2. Power the modem on.
3. Set the port to dev=prn on the PortServer by entering this command at a PortServer root prompt:

   `set dev port=prn ra=16`

   This example sets dev=prn for port 16 of a PortServer.

4. If you are using 8-pin RJ-45 cabling from the PortServer to the terminal, set the port to altpin=on by entering this command at a PortServer root prompt:

   `set port altpin=on ra=16`

   This example sets altpin=on for port 16 of a PortServer.

5. You must be logged in as root to perform the following steps.
6. Run sysadm and choose Networking, UUCP, Devices, and then Add.

   When prompted, enter the TTY number; for /dev/tty17 this would be 17.

   When prompted for Local modem type?, enter `direct`. When prompted, enter a modem speed, for example 9600.

7. Edit the file /etc/uucp/Devices.

   At the end of the file you should find the Direct line for the device you just added. Modify this line by adding an `M` at the end of the second field, which will be the device name.

   In this example, the line should look like this after editing:

   Direct tty17,M - 9600 direct

8. Change the ownership of the device to uucp with the chown command:

   `chown uucp /dev/tty17`

9. You should now be able to connect to the modem and enter modem commands. The following procedure is an example.
   1. Enable forcedcd on the device.

      `# stty-ncxa forcedcd /dev/tty17`

   2. Connect to the modem with the cu command.

      `# cu -l tty17`

      Connected

      If you do not get the "Connected" message, check the UUCP device configuration above.

   3. Test the connectivity with the at command.

      `at`

      OK

      If you do not see at or "OK", check the modem: power it down and back up, try modem commands ate1, atq0, and atq2, or see your modem manual for other suggestions.

   4. Set the modem to answer after the first ring with this command:

      `ats0=1`

   5. Train the modem to the port speed with this command:

      `at&w`

   6. Enter any other desired at commands.
   7. Disconnect from the modem by entering a tilde-period:

      `~.`

      Disconnected

      #

10. IMPORTANT: Restore the -forcedcd setting with the stty-ncxa command:

    `# stty-ncxa -forcedcd /dev/tty17`

11. Edit the file /etc/ttydefs.

    On each line that begins with an M add `clocal` just before the second ":" in the line. Add `-clocal` just before the third ":".

    These should be separated by spaces like the other options. For example, here is the "M9600" line after editing.

    M9600: 9600 echo echoe echok kill ^u erase ^? intr ^c hupcl cs8 opost onlcr icrnl cread clocal : 9600 echo echoe echok iexten kill ^u erase ^? intr ^c hupcl icanon cs8 opost icrnl onlcr cread ixon ixoff isig tab3 -clocal ::M9600

12. To configure dial-in logins on the modem port, you must have a port monitor running. You can use an existing port monitor or add a new one. This example assumes that you will add a new one.

    Run sysadm and choose Device, Port, Port Monitor, and then Add. Use the defaults (just press enter) for all the prompts except "Port monitor tag" where you will enter a name for the port monitor. In this example, modem is used for the name.

    When this is completed the port monitor should be added to the system.

13. Add the port service for this port.

    In sysadm go to Device > Port > Port Service > and then choose Add.

    You are prompted for several responses; in most cases you can accept the default by pressing enter, except for the following.

    For Controlling port monitor, enter the name of the port monitor, modem.

    For Port service tag, enter the device name, `tty17`.

    For Path name of terminal device, enter the full path of the device, `/dev/tty17`.

    For TTY Definition Label, enter a modem definition label such as `M9600`.

    For Bidirectional?, enter `yes` if you want to use the modem for dial-out or to connect to the modem with cu to send modem commands.

    When this is completed the port service for this port should be added to the system.

    You can change any port service settings later with sysadm by choosing Modify in the Port Service menu.

14. If you want hardware flow control on the port, this can be configured in the /etc/ttydefs file for dial-in, or with stty-ncxa for dial-in or dial-out. For example,

    `stty-ncxa rtspace ctspace /dev/tty17`

15. The port is now configured for dial-in and, if you answered yes to "Bidirectional?" in the port service configuration, for dial-out use.

    To dial-out you will need to first run stty-ncxa to set forcedcd to connect to the modem:

    `stty-ncxa forcedcd /dev/tty17`

    When you are done with dial-out, you must reset -forcedcd:

    `stty-ncxa -forcedcd /dev/tty17`

    If you forget to reset -forcedcd, logins will not be terminated when the modem drops carrier.