![]() |
|
Site MenuColumns
Alternate Formats |
Linux and the InternetNow that people have Linux in their hands, let's get them on the Internet! In March '96, almost 50,000 people across India received Linux on their PC Quest CDs. And the amount of mail I have been receiving about it is, frankly, amazing! And the most common question people have is "How do I connect to the Internet with Linux", "How do I set up a web server using Linux?", etc. This month, I am going to address both issues, because they go hand in hand. A little backgroundLinux needs no introduction anymore, not after PC Quest March '96. However, let me reiterate a few points here:
Making Linux Net-readyNothing to it. If you have installed Linux according to my instructions in the March issue (if you missed it, check the article on my web pages 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 ^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:
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 <Enter>. 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 it 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. The Dialup script#!/usr/sbin/dip main: get $mtu 1500 # Ip number of the slip router # Used for the point to point type connection # 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. flush 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 login: # We are connected. Login to the system. wait sername: 10 if $errlvl != 0 goto error # REPLACE uuuuuuuu with your login name. send uuuuuuuu\r wait assword: 20 if $errlvl != 0 goto error # REPLACE pppppppp with your password. send pppppppp\r # Some VSNL sites need this... 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 done: # 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) default # 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 error: print PPP to $remote failed. exit: # End of scriptOK, 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 ^C. If you do not get ping results, you may need to run this command: route add -net default dev ppp0 before things begin working. Checking out your IP connectionOnce 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 commandtelnet giasXX01.vsnl.net.in where XX is your city code ("dl" for Delhi, "bm" for Bombay, etc.). In a few seconds, you shouldbe connected and will be asked for your login name. Enter your login name and password, and you will be in 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 nameserver 202.54.1.30 nameserver 202.54.1.18 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 (like "ftp sunsite.unc.edu"), this should also work. Now for something more thrilling - if you have another phone line, call up a friend who as a 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. Do disconnect the PPP connection, run the command "dip -k". Make sure that everyone is logged off before you do this! Logging offRight, 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! Cheerio!
|
Copyright © 1993-2005 Atul Chitnis. All Rights Reserved. |