Categories: Archive

Linux and the Internet

In March ”96, 50,000 people across India received Linux on
their PC Quest CD-ROMs. The amount of mail I have received about it, is frankly, amazing.
The most common questions include How do I connect to the Internet with Linux? or
“How do I set up a web server using Linux?” This month, I am going to address
both issues, because they go hand in hand.

A Little Background
Linux needs no introduction, not after PC Quest March ”96. However, let me reiterate a few
points here:

  • Linux comes to you “Internet ready”. All the
    required tools are built in and ready to be used. All you need is to set it up, change a
    few parameters here and there, and get up and going.
  • For space reasons, we couldn”t put the complete Linux
    Slackware CD-ROM onto the PC Quest CD-ROM. One of the modules omitted was the NCSA HTTPD
    web server, used by virtually every Linux web server in the world. This has now been
    rectified: you can download it from PCQ Online, CiX (080-3341137) or the Internet.
  • You can set up a Telnet/FTP/Web/E-Mail server with the
    software we supplied, and provided you have a TCP/IP account (PPP/SLIP), you can get your
    server up and running, and accessible, virtually instantaneously, making this a perfect
    solution for a small- to medium-sized business.
    With that out of the way, let”s get the show on the road.
    get $mtu 1500
    Ip number of the slip router
    Used for the point to point type connection
    get $remote xxx.xxx.xx.x
    Set the desired serial port and speed.
    Remember that Com1 is cua0 and Com2 is cua1
    port cua1
    speed 38400
    parity N
    databits 8
    stopbits 1
    Reset the modem and terminal line.
    send \r\n\r\n
    Initialization for the modem
    send ATZ\r
    wait OK 2
    send AT&c1&d2&n0x1s10=200s7=90\r
    wait OK 2
    if $errlvl != 0 goto error
    Dial our PPP server from local phone
    Change xxxxxxx to your local dialup number
    send atdtxxxxxxx\r
    wait CONNECT 90
    if $errlvl != 0 goto error
    We are connected. Login to the system.
    wait username: 10
    if $errlvl != 0 goto error
    REPLACE uuuuuuuu with your login name.
    send uuuuuuuu\r
    wait password: 20
    if $errlvl != 0 goto error
    REPLACE pppppppp with your password.
    send pppppppp\r
    Now wait for the router prompt…
    wait > 30
    send ppp\r
    Now we wait for the assigned IP addresses.
    First comes the remote IP address (of the router)
    wait is 10
    get $rmtip remote
    if $errlvl != 0 goto error
    and now we get our IP address….
    wait is 10
    get $locip remote
    if $errlvl != 0 goto error
    That”s it! Now let’s make sure that IP packets are sent by default
    to this new connection (which is called ppp0, by the way)
    The following let’s you know what’s happening
    print PPP to $remote with address $local
    print Run ping $remote to check the connection.
    And now switch into PPP mode and start communicating
    mode PPP
    goto exit
    print PPP to $remote failed.
    End of script

Making Linux Net-Ready

Nothing to it. If you have installed Linux according to my instructions in the March issue
(or check my web page at http://pobox.com/~achitnis), and installed TCP/IP along with it
(remember, I asked you to do that), then you are almost set. Just to make sure, log in as
root and run the command ping localhost which should give you a stream of ping results
(stop them with Ctrl+C).

Run the command netconfig. This will ask you a few questions (you may have gone through
this before, but let”s do it again), answer them as follows:

When asked for Hostname, enter a name of your choice.
Remember, unless you actually register your hostname, this name has no meaning. My machine
is known as cybercom. And remember to stay in lower-case.

You will be asked about your domain. I use iisc.ernet.in,
you would use giasxx01.vsnl.net.in (where “xx” is your city code).

When asked about “Loopback only”, answer NO.

You will be asked for an IP address. You do not have a real
address at this time, so use
At the question of Gateway, enter the same address as above.

Next you will be asked for a Netmask–enter

You will now be asked for a Name Server–enter
if you are on VSNL ( for Delhi users), or if you are on ERnet.

That’s it for the moment. A warning though, if
you’ve created entries in the file /etc/hosts, backup this file before you run
netconfig, because the file will be deleted.

Shut down Linux and reboot, then check whether you can ping
your host by name (for example, I would run ping cybercom.iisc.ernet.in). If you get back
ping results, you are ready to move.

Now use your communication program (minicom) to connect to
your TCP/IP dialup number. Log in, and at the router prompt (e.g. giasro04>) type
“ppp” and press . Make sure that your get a message telling you
what the remote IP address is and what your address is. The values themselves are not
important, since they may change with every call. I just want you to be sure that you get
such a message. After you get it, you can hang up, and proceed with the installation.

Now change to the /etc directory, and create the following
script file. You can use VI for this if you are comfortable with it, else use the
“joe” editor, which is pretty much WordStar-like.

You have to change a few settings here. One of them is your
COM port (by default, it is set to “cua02”, change it to “cua0”
(cua-zero) for COM1 and “cua1” for COM2. Unless you have a 16550 serial port,
change the 38400 to 19200.

Change the phone number in the right place to the TCP/IP
dialup number for your area, and also change the username and password. Save this file as
/etc/ppp.dip. You can also pick up this file from http://ece.iisc.ernet.in/monster/library/index.html.

The Dialup Script

OK, now that we have the script installed, all you have to do is run it with the
“dip” program, which you do by running the command:

dip /etc/ppp.dip

If all goes well, you should get a message that you are connected and what your IP
addresses are. It will also ask you to run the “ping” command with the server IP
address to make sure that you are indeed connected. Doing so should give you a stream of
ping results–you can cancel this with ctrl+C.

Checking Out Your IP Connection

Once you have the IP connection up and running, you can try a few things. The first one
you could try is to use the “telnet” command. If you are connected to VSNL, try
the command telnet giasXX01.vsnl.net.in where XX
is your city code (“dl” for Delhi, “bm” for Mumbai, etc.). In a few
seconds, you should be connected and asked for your login name. Enter your login name and
password and you have access to your VSNL Shell account.

If this does not happen, you may have goofed with the DNS (Domain Name Server)
configuration. Use your editor to edit the file /etc/resolv.conf, and make sure that your
proper DNS addresses are show there. They should look something like this:

domain vsnl.net.in

If this is not the case, edit the file until it looks like the example above. Save the
file, then try the telnet command again.

Once you have things working, try an FTP (e.g. ftp sunsite.unc.edu), this should also
Now for something more thrilling. If you have another phone line, call up a friend who has
an Internet account, and ask him to telnet to your IP address (that”s what is reported to
you when you connected). Make sure you have created an account for your friend–use the
“adduser” command for this. He will receive a login prompt, where he gives the
user id and password you have given him.
That”s it! He is logged into your system. In the same fashion, he can also FTP to your
system to send and receive files, and he can also “talk” to you (use the
“talk” command for this. You can find out who is logged in and doing what with
the “w” command. To disconnect the PPP connection, run the command “dip
-k”. Make sure that everyone is logged off before you do this.

Logging Off

Right, now that we know how to create an IP connection to your Internet provider, we need
to look at more things, like how to access the World Wide Web, how to send and receive
e-mail, how to set up a Web server of your own, how to set up an FTP site, etc. That”s the
subject of discussion over the next few months, so stay tuned.


PCQ Bureau: