|Developer's Daily||Unix by Example|
|main | java | perl | unix | dev directory | web log|
Do you ever find yourself leaving your system administrator's chair to go to a DOS, Windows, or Apple computer to connect to CompuServe or other on-line services? If you find yourself wishing for a low-cost, simple method of dialing out from your Solaris workstation, fear not, thereís already one included with your operating system.
In this article we'll examine the process of configuring your system
for dial-out communications with the use of the Solaris UUCP facilities.
The command youíll use to dial out is called cu, for "Call Unix." This command is a part of a much larger communication facility known as UUCP, or "Unix to Unix CoPy." The entire UUCP suite of tools allows you to perform remote logins to other systems, copy files to and from other sites, and send e-mail to remote users - all via modem connections.
UUCP is now very standard on all Unix platforms. On Unix System
V Release 4 systems, such as Solaris, it is also referred to as the Basic
Networking Utilities, or BNU. Configuring your system for dial-out
capability with the cu command is the beginning of the entire UUCP configuration.
Physically connecting the modem
The first part of the cu setup process is connecting the hardware to your computer. If you're new to this process, you'll need a modem, null-modem cable, a telephone line to connect to, and a serial port on your workstation.
If you're using a SPARC workstation, you'll also need to configure the
EEPROM setting for your serial port.
Configuring the devices file
Once your hardware has been properly connected you can begin the software configuration. To minimally configure your system for dial-out capability you only need to modify one UUCP file to connect to the outside world. That file is /etc/uucp/Devices.
You can edit the Devices file with your favorite text editor. Assuming that your modem is connected to the first serial port on your computer, add the following lines to the end of the Devices file:
ACU ttya - Any hayesMake sure there are no blank spaces at the beginning of these lines. Any line within the Devices file that begins with a blank will be considered to be a comment.
Direct ttya - Any direct
Refer to Figure 1 for the definitions of the fields in the Devices
|Figure 1:||/etc/uucp/Devices file field definitions.|
The first line added above specifies that an "Automatic Calling Unit" (i.e., a modem) is connected to the serial line /dev/ttya; connections can be made at any speed; and that a hayes dialer program will be used when issuing commands to the modem. This configuration line lets you submit a phone number to the cu command, and the dialer program takes care of the rest of the work. For example, the following command dials the phone number 568-6250:
# cu 5686250The second line added to the Devices file specifies that we also have a direct connection to the serial line /dev/ttya. This line is used to connect directly to the modem to issue commands from the Hayes command set, such as "at" or "atz0":
# cu -lttya (connect to the /dev/ttya port)Testing the devices file changes
Connected (the response from the system)
at (issue the "at" command)
OK (the response from the modem)
Once youíve made these changes to the Devices file, you can connect to the modem directly with the following command:
# cu -lttyaIf this succeeds you will receive a "Connected" response message. You can now type commands from the Hayes command set, such as "AT", and your modem should respond with the usual "OK" message, as shown below:
# cu -lttyaIf you are not receiving these messages, it might be because your modem is not turned on, it may be connected to the wrong port, the port may not be enabled properly, or you may need to use a crossover cable instead of a null-modem cable. Check the causes before proceeding any further.
If you did see these messages - congratulations! You've done everything you need to dial out from your system.
At this point you can either try dialing out to another system with the "ATDT" or "ATDP" commands, or you can disconnect from the modem. To disconnect, type the special character sequence ~. (a tilde followed by a decimal), followed by a carriage return. You should see the message "Disconnected", and be returned to your Unix prompt.
The entire connection sequence should look like this:
# cu -lttyaNote that when you typed the character sequence ~. your system name should have been displayed in between the characters you typed:
~[voyager].This happens because the ~ character has special meaning to the cu command. The tilde character is treated as a special character that allows you to run commands locally, transfer files, change connection settings, or terminate the connection. While connected to a remote system, any line you type that begins with the tilde will be treated specially by cu.
Some of the most important tilde commands are shown in Figure 2.
Note that only text files can be transferred to or from remote systems.
If you are working with binary files, youíll need to first use uuencode
to convert the file into an ASCII format, and then transfer the file with
~%take or ~%put. On the receiving system, use uudecode to restore
the file to itís original binary form.
|Figure 2:||Commands that can be issued while connected to
a remote site with cu.
|Figure 3:||cu command startup flags.|
Modifying the systems file
With your current setup you can call any computer in the outside world by (1) specifying itís phone number, or (2) connecting to the tty device and then issuing an ATDT or ATDP modem command. One additional change to another UUCP configuration file will allow you to call remote systems by name, such as:
cu compuserveThe file youíll need to change is called /etc/uucp/Systems. In this file, you specify the names of computer systems that you may want to connect to.
For instance, if your local CompuServe phone number is 568-6250, you can add the following line to your Systems file:
compuserve Any ACU Any 5686250Figure 4 shows the field definitions for the Systems file.
|Figure 4:||/etc/uucp/Systems file field definitions.|
Once you've configured the Devices file and the Systems file, you and every user on your workstation can dial out to remote computer sites to run remote applications and transfer files.
As an additional benefit, youíve also begun to configure your entire
UUCP system. If your business has several geographically separated
offices, you can continue the UUCP setup to further enable remote logins,
file transfers, and site-to-site e-mail. This is more private and
secure than using the Internet.