Let's face it: setting up PPP under Linux can be intimidating, especially for newbies. Between chat scripts and a zillion options to pppd, setting up PPP can be a hassle for experienced users. It's a wonder beginners are able to do it at all.
``eznet'' is a new program designed to make it much easier to get PPP running under Linux. Basically all you have to do is supply a name for your ISP, a login name, password and phone number and eznet will do the rest. There are not configuration files to edit, no chat scripts to design and no need to figure out what a "chap-secret" is. Assuming you have pppd and eznet correctly installed (which should happen automatically from your CD-ROM, right?) the following command is all it takes to set up PPP:
eznet add service=NAME user=ABC password=XYZ phone=5551234
The setup command has to be entered as root. But after the setup is done, any user can bring up the PPP connection by simply typing:
eznet up NAME
If everything works right, you should have a PPP connection in 30 seconds or so. The ``eznet up'' command will not return until either the connection has been established, or the connection attempt fails. The command will return a non-zero result code if the connection attempt fails, making is suitable for use within shell-scripts. ``eznet up'' prints a status message just before it returns so that interactive users can also see what happened.
The connection established by eznet will automatically go down after 5 minutes of inactivity. Or you can bring it down manually by typing:
eznet down NAME
To see the current status of a connection, type:
Eznet also supports demand dialing. If you have Eric Schenk's ``Diald'' package installed, you can start it up by typing:
eznet dialdon NAME
And turn diald back off using:
eznet dialdoff NAME
If you prefer to use the request-route feature of kerneld, then just write the following script into the file ``/sbin/request-route'':
#!/bin/sh eznet up NAME
I prefer to use diald, since it seems to work better and because kerneld will not be supported in the 2.2.X kernels. But either method works.
Eznet has a configuration file (in /var/eznet/eznet.conf) but you never need to read or edit it. Instead, use eznet itself to keep the configuration up-to-date. To see the current configuration type:
This command can be run as an unprivileged user, but if it is, the passwords will not be displayed. Be careful when using the list command as root because the passwords will appear in plain text on your screen -- make sure nobody is looking over your shoulder!
To change the configuration, use a command like the following:
eznet change NAME ARG1=VALUE1 ARG2=VALUE2...
Only root is allowed to change configuration values. The four basic configuration values are shown in the sample command above: "service" "user", "password" and "phone". But there are many others. A complete list is shown below. Hopefully, most users will never need to deal with more than the basic four.
Eznet is able to manage connections to multiple service providers. (The only purpose of the "service" option is to give a symbolic name to each service provider.) Suppose, for example, that you have a personal dialup account with AT&T WorldNet and a separate dialup account where you work. You could setup two eznet configurations like this:
eznet add service=work user=slave5 'password=yes sir!' phone=5551234 eznet add service=worldnet email@example.com \ password=xyzzy phone=5554321
Now eznet knows about both services. To log into work, just type
eznet up work
And to log into your personal WorldNet account, type
eznet up worldnet
Assuming you have two modems, you can even log into both serices at the same time!
Some eznet commands require that you specify a particular service. The "up" command is like this. Both other commands will apply to all services if no particular service name is given. For example, if you type
then eznet immediately terminates all connections. The best why to know whether or not a particular eznet command will work globally is to try it and see. Note that if you only have a single service provider defined, then there is no need to mention its name with any command -- eznet will always know which service you mean.
In some situations, eznet may require some additional hints in order to work optimally, or to work at all. If you are having trouble getting eznet to work, or wonder if you can make it work better, this section is for you.
If eznet is not working for you, the first step is to figure out why not. If eznet fails for any reason, run the command
to get a diagnostic log of what it did on the most recent connection attempt. This diagnostic log will often immediately show what the trouble is. Then all you have to do is fix the problem. Usually adding a few additional configuration options to your eznet setup will do the trick.
Eznet makes very few assumptions about your modem. Basically, it assumes that the modem supports the single Hayes modem command "atd" for dialing, and that lowering the DTR line on your serial port will cause the modem to hang up and reset. If your particular modem requires some additional setup, you can cause eznet to issue extra initialization commands to the modem using configuration parameters. For example, to dial one of my local ISPs (named "VNet") using a SupraFaxModem, I have to configure eznet as follows:
eznet change vnet init0=atz 'init1=at&d3'
The "initN" options (where N is between 0 and 9) each contain an additional modem initialization that eznet issues prior to dialing the modem. In this example, the first string resets the modem, and the second string tells the modem to hangup and reset whenever the DTR line goes low. Some folks like to turn the speaker on their modem off. The following command will do that:
eznet change vnet init2=atm0
There are some minor differences between version 2.2 and 2.3 of pppd that eznet needs to know about. Eznet assumes by default that you are using version 2.3 or later of pppd. If you get an error message like this:
idle: unrecognized command pppd version 2.2 patch level 0then configure eznet to use version 2.2 of pppd as follows:
eznet change vnet pppversion=2.2It is possible to recompile eznet to assume version 2.2 of pppd (by changing the DFLT_PPP_VERSION #define in the source code) but then it will not work right for versions 2.3 of pppd and later.
Eznet does a good job of negotiating the login name and password of most ISPs on its on, but with some ISPs it may require some additional hints. If eznet fails to connect, you can view a transcript of the connection attempt in the file "/var/eznet/transcript.*". This transcript should help you figure out what is going wrong. Beginning with version 1.8 of eznet, this transcript is a part of the "eznet log" output.
With some service providers it may be necessary to respond to unusual login prompts. Eznet allows you to code around this problem using "expectN" and "replyN" options. For example, suppose VNet prompted for the login name like this:
Enter your name:instead of the more traditional "login:". By default, eznet would not recognize this string and would not know how to respond. But you can tell it would to do like this:
eznet change vnet expect0=name: reply0=drhThe "expect0" and "reply0" option pair tells eznet that it should respond with the value of reply0 whenever it sees the text contained in expect0. You can have up to 10 such expect and reply pairs numbered 0 through 9. The order is not important.
Two particular values of the replyN string have a special meaning. A reply of "FAIL" will cause eznet to immediately abandon the connection attempt when the corresponding expectN string is encountered. Similarly, a reply of "ACCEPT" will cause eznet to immediately attempt to start pppd.
If you have to use expectN and replyN parameters to get eznet to work, please send e-mail to firstname.lastname@example.org. Include the output of "eznet log" if possible. Hopefully, the information you provide will enable me to upgrade eznet to work on your ISP without the need for additional expectN and replyN configuration options.
The following is a summary of all of the configuration options that eznet currently understands:
|service||This is a symbolic name for the ISP to which you will connect. This name is used in the output of the status command. If you configure eznet with data for two or more ISPs, then you can use this name to select a particular ISP to dial.|
|phone||This is the phone number used to dial the modem. The text associated with this value will be appended to the string ``atd'' and sent to the modem verbatim.|
|user||The username or login for your ISP account. If your ISP is running some kind of Unix, then this is the name that is entered at the ``Login:'' prompt. If your ISP runs NT, then this is the name used for PAP or CHAP authentification.|
|password||This is the password for your ISP account. The password will be entered at the ``Password:'' prompt during login or used during PAP or CHAP authentification or both.|
|baud||The is the baud rate of the serial connection between your computer and the modem. The default value is 115200. If your modem or serial port can't handle that speed, you might need to lower this number.|
|debug||If the value of the option is ``y'' or ``yes'' then pppd will be launched in debugging mode. This will cause lots of extra information to be sent to syslog, and can sometime be helpful in fixing problems.|
|tty||By default, eznet attempt to setup the PPP connection on the device named /dev/modem. You can choose a different serial device with this option.|
|defaultroute||Eznet normally sets up a default route to connections it arranges. You can disable this feature by setting the defaultroute attribute to ``no'' or ``n''.|
|idle||This parameter records the number of seconds of inactivity that will cause the PPP connection to shutdown. The default value is 300 (5 minutes). If you set it to 0, then no idle timeout will occur.|
|chat||The default value of this option is "yes". If you set it to "no", then eznet will try to set up a PPP link as soon as the modem connects, ignoring any "login:" or similar prompts from the remote machine.|
|pppversion||Specifies what version of pppd is being used. (There are changes in the command line syntax between 2.2 and 2.3 that eznet has to deal with.) The default value is determined by the #define "DFLT_PPP_VERSION" in the source code. If eznet causes pppd to fail with a long error message the first time you try to use it, you may want to set this value manually.|
|pppoptN||You can pass up to 10 additional options to pppd by setting the values of parameters pppopt0, pppopt1, ..., pppopt9 as appropriate. The values specified are placed at the end of the parameter list.|
|ip & netmask||
These parameters can be used
to select from two or more ISPs in eznet's database.
If you type:
eznet up 22.214.171.124
for example, eznet will search through its list of ISPs looking for one whose ``ip'' value matches 126.96.36.199 for every bit that is set in the ``netmask''. It will then dial the first match it finds. This feature is useful when eznet is started from /sbin/request-route and you need to dial different ISPs depending on the IP number of the machine you want to talk to.
You can have up to 10 extra modem initialization strings
named init0, init1, ...,init9.
A common option is:
eznet change 0 init0=atz
|expectN & replyN||
For more complex login procedures, you may need to specify
additional prompt strings and replies. You can enter up to
10 additional prompt strings that will respond with the
corresponding reply. For example:
eznet change 0 expect0=SERVICE: reply0=PPP
A carriage return is automatically added to every reply string.
|pppd||If your pppd is installed someplace other than /usr/sbin/pppd then you can enter an alternative name here.|
|diald||If you have diald installed as something other than /usr/sbin/diald then enter its name using this parameter.|
|local||This option can be used to specify the local IP number required by diald. The default value is 127.0.0.100.|
|remote||This option can be used to specify the remote IP number required by diald. The default value is 127.0.0.101.|
|mtu||This option sets the maximum length of a transmitted packet over the PPP link. Longer packets are fragmented. The default is 552.|
|mru||This option sets the maximum length of a received packet over the PPP link. Longer packets are fragmented. The default is 552.|
|autostart||If this option is "yes" (its default) then PPP will automatically begin its protocol negotiation with the other end if there is no response over the serial link for 8 seconds. If this option is "no", then PPP will not start on the local end until PPP packets are seen coming from the remote end.|
|routeN||Where N is any digit between 0 and 9, this option causes a route to be setup to the specified network after PPPD connects.|
|dialtimeout||This is the number of seconds that eznet will wait for a CONNECT message from the modem after issuing the dialing commands. The default is now 60 seconds.|
|chattimeout||This is the number of seconds that eznet will wait for replies to commands while doing the login chat sequence. The default is 3 seconds.|
The eznet program is completely contained in a single C source file named ``eznet.c''. You can compile and install it as follows:
gcc -o /usr/bin/eznet -O eznet.c chown root.root /usr/bin/eznet chmod 04755 /usr/bin/eznet
The eznet executable must reside in the directory /usr/bin. It won't work if you install it someplace else. If you need to install eznet elsewhere, change the value of the SELF #define near the top of the source file and recompile.
Eznet does not need to be suid. But if it isn't, then only root will be able to initiate a PPP connection. Eznet takes care to drop its root privileges as soon as possible so it should be fairly safe as a suid program. It is certainly easier to use that way.
Eznet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Eznet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.