Frequently Asked Questions for FreeBSD 2.X : Serial Communications : How can I enable dialup logins on my modem?
Previous: What's the difference between ttyd1, ttyid1, and ttyld1? Or, how can I set the default serial parameters for a port?
Next: How can I make my spare computer a dumb terminal connected to my FreeBSD box?

11.7. How can I enable dialup logins on my modem?

So you want to become an Internet service provider, eh? First, you'll need one or more modems that can autoanswer. Your modem will need to assert carrier-detect when it detects a carrier and not assert it all the time. It will need to hang up the phone and reset itself when the data terminal ready (DTR) line goes from on to off. It should probably use RTS/CTS flow control or no local flow control at all. Finally, it must use a constant speed between the computer and itself, but (to be nice to your callers) it should negotiate a speed between itself and the remote modem.

For many Hayes command-set--compatible modems, this command will make these settings and store them in nonvolatile memory:

            AT &C1 &D3 &K3 &Q6 S0=1 &W
          
See the section on sending AT commands below for information on how to make these settings without resorting to an MS-DOS terminal program.

Next, make an entry in /etc/ttys for the modem. This file lists all the ports on which the operating system will await logins. Add a line that looks something like this:

            ttyd1 "/usr/libexec/getty std.57600" dialup on insecure
          
This line indicates that the second serial port (/dev/ttyd1) has a modem connected running at 57600 bps and no parity (std.57600, which comes from the file /etc/gettytab). The terminal type for this port is ``dialup.'' The port is ``on'' and is ``insecure''---meaning root logins on the port aren't allowed. For dialin ports like this one, use the ttydX entry.

It's common practice to use ``dialup'' as the terminal type. Many users set up in their .profile or .login files a prompt for the actual terminal type if the starting type is dialup. The example shows the port as insecure. To become root on this port, you have to login as a regular user, then ``su'' to root. If you use ``secure'' then root can login in directly.

After making modifications to /etc/ttys, you need to send a hangup or HUP signal to the init process:

            kill -1 1
          
This forces the init process to reread /etc/ttys. The init process will then start getty processes on all ``on'' ports. You can find out if logins are available for your port by typing
            ps -ax | grep '[t]tyd1'
          

You should see something like:

            747 ??  I      0:00.04 /usr/libexec/getty std.57600 ttyd1 
          


Frequently Asked Questions for FreeBSD 2.X : Serial Communications : How can I enable dialup logins on my modem?
Previous: What's the difference between ttyd1, ttyid1, and ttyld1? Or, how can I set the default serial parameters for a port?
Next: How can I make my spare computer a dumb terminal connected to my FreeBSD box?