Dialing the ISP

This was one of the things that was a lot harder than I expected -- I was booting Windows for this for several weeks.

My real problem was probably that I answered a question wrong when I first installed LINUX: I said my computer wasn't going to be a networked computer. I thought "Is this a networked computer?" might mean "Do you have an ethernet card?", which I don't. It really means "Do you want to install the programs which are going to enable this computer to talk to other computers?", which I did. If you don't make that mistake, probably lots of the things I tried before getting all the RPM's installed that I needed would work the first time.

My ISP (The World) gives me a unix shell account. So once I installed minicom and figured out the interface (the big problems were that it swallows ^A's and needs a different "stty erase" command from the DOS program I had been using), I was able to dial up and check mail. If I need to actually work as a terminal to the ISP's computer, I still do this, since it's faster than using telnet with ppp. (My machine, a K6 233, was a fast computer last year.)

If you can call up your ISP this way, it's a good thing to do first, because it verifies that LINUX can see your modem and that it's set up to work with the ISP.

The next thing you want to do is to connect with your ISP using a ppp connection. I tried several things which would probably have worked if ppp had been installed. (ezppp is one that people speak well of.) The one which actually ended up telling me that this was the problem was a program I ran into on comp.os.linux.announce called wvdial. It gave me an error message with just a number in it, but the man page was written well enough to make me believe that they wanted to know about my problems, so I sent the error message to their email address, and they replied almost immediately that that one meant that ppp wasn't in my path.

Note that this story illustrates both the good and the bad things about LINUX. A more mature technology would protect someone from the kind of mistakes I made or at least give errors which would point more directly at a solution. However, a technology that people were less excited about using would offer less help in the form of newsgroups and email support from the people actually working on solving the problems.

I discovered that, at least in the redhat version of ppp, there is a script in /etc/ppp/ip-up, which is executed every time a ppp connection is established. This script executes another script called /etc/ppp/ip-up.local. This is where you want to put the things you do regularly every time you connect to your ISP. Here's mine: ip-up.local A problem that stumped me for longer than I care to admit was why ip-up.local didn't execute when I put stuff in it. The answer is that you need to do: chmod +x /etc/ip-up.local in order for ip-up to be able to execute it.

The next problem I tackled was the problem of how to automate this so that I could call up the isp, have it check my email, etc., and then immediately log off. I asked on the internet how people did this, and the only answer I got was that you could use diald to automatically log on when you were doing something that needed the network connection, and log off when you stopped. This seemed like overkill for my purposes.

So I wrote a script, called dialup, which used the scripting language 'expect' to spawn wvdial, watch to see when ip-up is finished, and kill the wvdial process immediately afterwards.

So now I could say wvdial when I wanted to get onto the net, anddialup when I wanted the computer to check my mail and didn't want to bother remembering to control-C out of wvdial when I was through.

I have recently started having crontab run wvdial every hour, except when I'm sleeping. I could turn the modem sound off and run it during sleeping hours, too, but at the moment I still like being able to hear that the system is functioning. For those who haven't delved into the mysteries of crontab yet, the command you use to change what crontab does is crontab -e and the magic line to insert for this purpose is:

# run dialup script once per hour every day except for sleeping hours

20 7-23 * * * /root/bin/dialup

This says: