22.5. Dial-out Service
Poprzedni | Rozdział 22. Serial Communications | Następny

## 22.5. Dial-out Service

The following are tips for getting your host to be able to connect over the modem to another computer. This is appropriate for establishing a terminal session with a remote host.

This is useful to log onto a BBS.

This kind of connection can be extremely helpful to get a file on the Internet if you have problems with PPP. If you need to FTP something and PPP is broken, use the terminal session to FTP it. Then use zmodem to transfer it to your machine.

### 22.5.1. My Stock Hayes Modem Is Not Supported, What Can I Do?

Actually, the manual page for `tip` is out of date. There is a generic Hayes dialer already built in. Just use `at=hayes` in your `/etc/remote` file.

The Hayes driver is not smart enough to recognize some of the advanced features of newer modems—messages like `BUSY`, `NO DIALTONE`, or `CONNECT 115200` will just confuse it. You should turn those messages off when you use `tip` (using `ATX0&W`).

Also, the dial timeout for `tip` is 60 seconds. Your modem should use something less, or else tip will think there is a communication problem. Try `ATS7=45&W`.

### Uwaga:

As shipped, `tip` does not yet support Hayes modems fully. The solution is to edit the file `tipconf.h` in the directory `/usr/src/usr.bin/tip/tip`. Obviously you need the source distribution to do this.

Edit the line `#define HAYES 0` to `#define HAYES 1`. Then `make` and `make install`. Everything works nicely after that.

### 22.5.2. How Am I Expected to Enter These AT Commands?

Make what is called a „direct” entry in your `/etc/remote` file. For example, if your modem is hooked up to the first serial port, `/dev/cuad0`, then put in the following line:

cuad0:dv=/dev/cuad0:br#19200:pa=none

Use the highest bps rate your modem supports in the br capability. Then, type `tip cuad0` and you will be connected to your modem.

Or use `cu` as `root` with the following command:

`#` `cu -l`line` -s`speed``

`line` is the serial port (e.g.`/dev/cuad0`) and `speed` is the speed (e.g.`57600`). When you are done entering the AT commands hit ~. to exit.

### 22.5.3. The `@` Sign for the pn Capability Does Not Work!

The `@` sign in the phone number capability tells tip to look in `/etc/phones` for a phone number. But the `@` sign is also a special character in capability files like `/etc/remote`. Escape it with a backslash:

pn=\@

### 22.5.4. How Can I Dial a Phone Number on the Command Line?

Put what is called a „generic” entry in your `/etc/remote` file. For example:

tip115200|Dial any phone number at 115200 bps:\ :dv=/dev/cuad0:br#115200:at=hayes:pa=none:du: tip57600|Dial any phone number at 57600 bps:\ :dv=/dev/cuad0:br#57600:at=hayes:pa=none:du:

Then you can do things like:

`#` `tip -115200 5551234`

If you prefer `cu` over `tip`, use a generic `cu` entry:

cu115200|Use cu to dial any number at 115200bps:\ :dv=/dev/cuad1:br#57600:at=hayes:pa=none:du:

and type:

`#` `cu 5551234 -s 115200`

### 22.5.5. Do I Have to Type in the bps Rate Every Time I Do That?

Put in an entry for `tip1200` or `cu1200`, but go ahead and use whatever bps rate is appropriate with the br capability. `tip` thinks a good default is 1200 bps which is why it looks for a `tip1200` entry. You do not have to use 1200 bps, though.

### 22.5.6. I Access a Number of Hosts Through a Terminal Server

Rather than waiting until you are connected and typing `CONNECT <host>` each time, use tip's `cm` capability. For example, these entries in `/etc/remote`:

pain|pain.deep13.com|Forrester's machine:\ :cm=CONNECT pain\n:tc=deep13: muffin|muffin.deep13.com|Frank's machine:\ :cm=CONNECT muffin\n:tc=deep13: deep13:Gizmonics Institute terminal server:\ :dv=/dev/cuad2:br#38400:at=hayes:du:pa=none:pn=5551234:

will let you type `tip pain` or `tip muffin` to connect to the hosts pain or muffin, and `tip deep13` to get to the terminal server.

### 22.5.7. Can Tip Try More Than One Line for Each Site?

This is often a problem where a university has several modem lines and several thousand students trying to use them.

Make an entry for your university in `/etc/remote` and use `@` for the `pn` capability:

big-university:\ :pn=\@:tc=dialout dialout:\ :dv=/dev/cuad3:br#9600:at=courier:du:pa=none:

Then, list the phone numbers for the university in `/etc/phones`:

big-university 5551111 big-university 5551112 big-university 5551113 big-university 5551114

`tip` will try each one in the listed order, then give up. If you want to keep retrying, run `tip` in a while loop.

### 22.5.8. Why Do I Have to Hit Ctrl+P Twice to Send Ctrl+P Once?

Ctrl+P is the default „force” character, used to tell `tip` that the next character is literal data. You can set the force character to any other character with the `~s` escape, which means „set a variable.”

Type `~sforce=`single-char`` followed by a newline. `single-char` is any single character. If you leave out `single-char`, then the force character is the nul character, which you can get by typing Ctrl+2 or Ctrl+Space. A pretty good value for `single-char` is Shift+Ctrl+6, which is only used on some terminal servers.

You can have the force character be whatever you want by specifying the following in your `$HOME/.tiprc` file:

force=<single-char>

### 22.5.9. Suddenly Everything I Type Is in Upper Case??

You must have pressed Ctrl+A, `tip`'s „raise character,” specially designed for people with broken caps-lock keys. Use `~s` as above and set the variable `raisechar` to something reasonable. In fact, you can set it to the same as the force character, if you never expect to use either of these features.

Here is a sample .tiprc file perfect for Emacs users who need to type Ctrl+2 and Ctrl+A a lot:

force=^^ raisechar=^^

The ^^ is Shift+Ctrl+6.

### 22.5.10. How Can I Do File Transfers with `tip`?

If you are talking to another UNIX® system, you can send and receive files with `~p` (put) and `~t` (take). These commands run `cat` and `echo` on the remote system to accept and send files. The syntax is:

`~p` local-file [remote-file]

`~t` remote-file [local-file]

There is no error checking, so you probably should use another protocol, like zmodem.

### 22.5.11. How Can I Run zmodem with `tip`?

To receive files, start the sending program on the remote end. Then, type `~C rz` to begin receiving them locally.

To send files, start the receiving program on the remote end. Then, type `~C sz `files`` to send them to the remote system.

Poprzedni | Początek rozdziału | Następny
22.4. Dial-in Service | Spis treści | 22.6. Setting Up the Serial Console

This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.