Network: Mgetty: dailing into your machine

(last edit: 2001-11-02)


You probely have a permanent internet connection and don't use a modem anymore but there is a very useful job for your old external modem. What if you're not at home and your so permanent internet connections fails? Wouldn't it be nice to dail in to your own machine to read some log files to start kicking that support dude of your ISP? This document describes how you can setup mgetty and ppp. Mgetty is a program which handles all modem initialisation and answering. It can also send and receive faxes but since I'm not interested in faxes I won't discuss how to configure faxes.


I have never succeeded in getting an internal modem to work (I never got my hands on a full hardware internal modem) so I use an external modem. The installation of the external modem is very difficult: plug your serial cable in your com port and remember which com port you used. Now plug in the power and phone line, that's all :)


Make sure you have a serial device in your kernel: device sio0 at isa? port IO_COM1 flags 0x10 irq 4 The '0x10' option is there by default and is used for serial connections, if you connect your modem to this com port then you don't need this option (is does no harm, you can leave is there). If necesary compile the new kernel and reboot. You can check if the com port has been found by using the following command 'grep sio /var/run/dmesg.boot'. This should produce something like this (depending on you kernel config): sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 Oke now you have a com port, next step


You can find the mgetty installation in '/usr/ports/comms/mgetty+sendfax/' and install it with a simple 'make' and 'make install'. The 'make install' will ask you a large number of questions which you can answer with the default (just hit ENTER) exept for the following: 'data-only' - set this one to YES to disable fax 'rings' - set this to your desired number of rings before modem answer One of the first questions is about which port you want to use (default '/dev/cuaa1') make sure this corresponds with your com port ('/dev/cuaa0' = sio0 = com1, '/dev/cuaa1' = sio1 = com 2). Don't worry about this questions, you're just making a config file which you can edit later. After the installation the mgetty config is installed in '/usr/local/etc/mgetty+sendfax/' You must run mgetty from '/etc/ttys'. Open this file and edit the line starting with 'ttyd0'. Change it to: ttyd0 "/usr/local/sbin/mgetty /dev/cuaa0" dailup on secure (make sure you use the propper device). Now make the changes active by restarting init by using the following command 'kill -1 1'. If all went as supposed to you should see a mgetty process running. Now let's look at the config. There are three files in the '/usr/local/etc/mgetty+sendfax/' directory:
  • dailin.config
  • login.config
  • mgetty.config
The 'dailin.config' file consists of only comments by default and you don't need to change it. The 'login.config' has allot of comments but you should trim it to the following two lines: /AutoPPP/ - - /usr/bin/ppp -direct pap * - - /usr/bin/login @ The second param 'pap' is a reference to a secion in the ppp config (see below). The first dash means to not set a login user id and keep the uid/euid root which is needed for /bin/login. The second dash means to not set an utmp enty, use @ to set it to the username entered. You shouldn't need to change the mgetty.config file because this is why you had to answer a ziljon questions during install.


There is a default ppp.conf file in '/etc/ppp'. It contains at least a 'default' section which you don't need to change. Get rid of the rest of the sections and create a new one: pap: enable pap set ifadrr [machine IP] [dailin IP] [netmask] enable proxy enable passwdauth The 'dailin IP' is the ip number which is given to the machine dialin in. A good example for ifaddr would be 'set ifadrr' asuming your machine has ip See the '/usr/share/examples/ppp/ppp.conf.sample' file for an explanation of the above ppp options.

Logging in

Make sure there is a 'normal' user (as in not root, operator etc.) and find another machine which can setup an ppp connection. Dail your own phonenumber and use the username and password to log in. After a successfull login you should be able to ping at least the and if there are more machines in the network, you should be able to ping them. If you encounter any problems see the '/var/log/mgetty.cuaa0.log' file. It could be usefull to log all ppp data, this is not done by default. You can enable this by adding the following lines to '/etc/syslog.conf': !ppp *.* /var/log/ppp.log After this do a 'touch /var/log/ppp.log' and a 'chmod 600 /var/log/ppp.log' followed by a 'killall -HUP syslogd'. PPP generated ALOT of info in the log file so you should add something like this to '/etc/newsyslog.conf' /var/log/ppp.log 600 10 100 * Z This wil rotate the ppp.log file. Well I hope you can dail-in to your machine, set up a ssh connection, a telnet connection etc, etc, etc. If you have any questions mail them to

Click here to go back to the index.