LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By echo77 at 2004-11-15 07:03
How to Network 2 Computers on LAN with a Crossover Cable.
or
A Newbie's Guide to Small Home LAN.

REASON FOR WRITING THIS TUTORIAL:
There may be a lot of people turned off by Linux because most of the tutorials available as of now, are significantly technical in nature, and you need to read a lot of jargon before you get to the point of 'what exactly is to be done to get it working'. And the 'what exactly to be done...' tends to rely on the jargon that you just skipped because it went over your head. A lot of users who would like to switch over from other operating systems to Linux would like
simple steps on how to connect to the internet, set up printers, set up a LAN, connect and use various peripherals. This tutorial is intended to provide simple steps, that are supposedly easy to follow. I will also mention some terms that you really need to know with their "newbie definitions" ;-)

This is kinda inspired by Eric S. Raymond's CUPS Horror Story,
http://www.catb.org/~esr/writings/cups-horror.html

INTENDED AUDIENCE:
This is intended for the Linux Newbie, or regular Linux users who are not into networking or system administration. This is a networking newbie telling others how he went about networking his 2 computers on a LAN using a crossover cable, setting up NFS shares, Samba shares, sharing the printer and sharing the internet connection. This is NOT meant for experts, and a lot of technical jargon is kept away.

THANX:
Thanks to www.linuxforums.org, www.linuxforum.com. www.linuxquestions.org,
www.homenethelp.com, www.linuxgazette.com, en.tldp.org, and of course, www.google.com which helped me find all the above sites.

DISTRO USED: Fedora Core 2. I will mention that I have used GUI components, and not commands. So those trying this tutorial on other Linux flavours should look out for differences.
GUI: Gnome Desktop v2.6

NOTE:
Part 1 has been tested by others and have had a good feedback when I posted it to my circle of friends and acquaintances. Please provide a feedback for the next parts. I will continue the newbie series as I get the time to do so.

CONTACT ME: neenad AT gmail <DOT> com

----------------------------------------------------------------------

THE PROBLEMO:
I have 2 computers. I've called them TOM and JERRY. TOM has Fedora Core 2. JERRY is a dual boot with Fedora Core 2 and Windows XP. I connect to the internet using TOM. I have the printer on JERRY. I want to set up a small home network, so that I can surf the web/send mail with both computers sharing one internet connection, and also share the printer. I would also like to access files on each comp, from both operating systems.

HARDWARE REQUIRED:
I have LAN (Ethernet) cards installed on both. I can connect the two together without buying a hub. This can be done with a crossover cable. A crossover cable has some wires interchanged so that input of one comp is the output of the other and vice versa. (I do not know the restrictions on cable length) In my case, both comps are in the same room, and I have a cable 5m long.

ADDITIONAL REQUIREMENTS:
You need to know the root password for both machines. I will skip the step where you will need to enter the root password. Please do so.

----------------------------------------------------------------------

PART 1: Setting up the Network
Connect the crossover cable into the slots on the LAN card. When both computers are on, you will see the led on the ethernet card light up. This means that the connection is recognized by the hardware. Now you need the software to recognize it (without which you cannot use the connection). I assume you have booted up in Linux.

On TOM: Click on 'Hardware Browser' in 'System Tools'. The hardware browser will start and you will get a listing of hardware in your computer. Click on 'Network Devices' on the left. You will be shown the detected LAN Card and device information. Keep this window open so that you can recheck the card name & number, manufacturer, driver file and device. This is just in case, as mostly the card will be autodetected.

Next, go to 'System Settings' >> 'Network'. You will get a network configuration dialog. Click on the Hardware tab. You should see your device here. If no, click on new. Select Ethernet. Select the adapter that has the same number as the number of the card in the hardware browser. (If there are multiple numbers, you can select any one). Select device eth0. Keep IRQ to unknown and click OK. Your hardware is set.

Click on the devices tab. Click on New. Select Ethernet Connection and click Forward. Click on your Ethernet card name and click forward. Click on statically set IP addresses. There are only certain addresses that are legal to be used on the local network. Using any other address will screw up your internet connection as well. You can use 192.168.XXX.XXX with a subnet mask of 255.255.255.0. For example, I have used 192.168.10.1 for TOM and 192.168.10.2 for JERRY. Click forward and click on apply. Your device is now shown, and will be inactive.

Go to DNS tab. Enter a hostname of your choice (eg: tom.myhome.org). In the Primary DNS (and secondary DNS) enter the primary (and secondary) DNS addresses of your Internet Service Provider (ISP). If you do not know what they are, open a terminal window and type:
cat /etc/resolv.conf
In this there will be something like:
nameserver XXX.YYY.ZZZ.AAA
nameserver xxx.yyy.zzz.aaa
These numbers are your primary and secondary DNS addresses. Enter them in corresponding fields on the DNS tab.

If you cannot find resolv.conf or it is empty, then skip the above step. It means that the internet connection is not set up properly. We shall handle this later.

Come back to the devices tab, select the device and click activate.

Repeat the above for JERRY. Remember to give it a different IP address and hostname. (eg: jerry.myhome.org, 192.168.10.2)

Open a terminal and type:
ping 192.168.10.1 (or tom's address/hostname)
ping 192.168.10.2 (or jerry's address/hostname)
Do this for both machines. You will get a response, which means your network is working! If not, please post the procedure that you followed in the forums and ask for a networking guru to help you.

Now we have to set up NFS shares, SAMBA shares, share the printer, and share the
internet connection.

----------------------------------------------------------------------
PART 2: Sharing files Linux-to-Linux using NFS (Network File System)
NFS Shares: Sharing your files among Linux comps.
Tom & Jerry: both running Linux
This is just a basic configuration of the NFS. Please read the NFS Help document in case
you wish to customise your shares.
You are on Tom. In the menu, click on System Settings > Server Settings > NFS
In the NFS Server Configuration driver that comes up, click on 'Add'. In the directory, enter the directory you wish to share, or click on Browse and select the directory you wish to share. In Hosts, you will want to enter the hosts to which you want to share your directory. You can specify jerry.myhome.org or even *.myhome.org. Use the radio buttons to set the share as read-only (recommended) or read/write. You do not need to change any other options in the other tabs, so click on OK. Go through the NFS Help files (obtained by clicking on the Help button) if you want more details of configuration of NFS, or if you want
to configure it more. Assume that the '/home/username/shared' directory is shared. You
will have to start the NFS Server. Go to the menu System Settings > Server Settings >
Services, and search for nfs. Click it and click on the start button and wait for confirmation.
You may check the nfs checkbox to start the NFS Server at startup.

Once you have set up this directory, move to Jerry. Open a terminal window on Jerry. Get into superuser mode and change directory to /mnt. Create a directory that will map to the shared directory of Tom. Suppose you call that directory as tom_share, then type the following command:
mount tom.myhome.org:/home/username/shared ./tom_share
The shared directory from Tom will now be available in the /mnt/tom_share directory on Jerry. You will have your permissions as you have set them.

----------------------------------------------------------------------
PART 3: Sharing files Linux-to-Windows using the Samba Server
Samba Shares: Setting up Samba: Sharing a Linux directory to be accessed from Windows.
Tom: running Linux, Jerry: running Windows, and has networking services turned ON.
You are on Tom. In the menu, click on System Settings > Server Settings > Samba
In the Samba Server Configuration driver that comes up, click on 'Add'. In the directory,
In directory, enter the directory you wish to share or click on browse and select the directory you wish to share. You may leave the description blank, or enter an appropriate description.
Provide the permissions. In the next tab "Access", you can either allow access to specific users or to all users. Since it is a small home network, you may set it to all to avoid access denials. Read help (obtained by clicking on the Help button) for more details.

Go to the menu System Settings > Server Settings > Services, and search for smb. Click it and click on the start button and wait for confirmation. You may check the smb checkbox to start the Samba Server at startup.

Once you have set up this directory, move to Jerry (windows). Refresh the network places. The shared Samba directory will now be seen from windows and you will be able to browse it in the windows explorer.

by michaelk on Wed, 2004-11-17 17:06
With just a quick reading my first comment would be to leave the DNS stuff until later ( part 4?) Instead would add the hostnames to the /etc/hosts file.

by echo77 on Sat, 2004-11-20 05:48
Thank you for your response. I could gather such responses and fine tune the tutorial to make it more userfriendly.

Also thanks to LinuxQustions.org for accepting the tutorial.

by arty_schroeder on Sun, 2004-11-21 10:33
Hello everyone I'm Arty I'm currently in the Intro to linux and I can't figure out how to write a simple script called reverse63. That reverse's the order of output 1 2 3; 3 2 1 I know the first line Is #!/bin/bash, I can't get passed here .

by AiKi on Tue, 2004-11-30 17:30
Hi
Nice try echo77 but i think you are using windows for to much time..
I`m sure you can write a tutorial to do the lan without using GUIs.. i`ll
be waiting for that tutorial...

Keep the good work... cya

by echo77 on Wed, 2004-12-01 07:15
Quote:
I`m sure you can write a tutorial to do the lan without using GUIs
My intention is NOT to do that. I am aiming at people who want an easy way out. I am aiming at getting Linux into small home/office networks without bringing in too much technicality. I want them to switch from Windoze to Linux. There are too many people out there who want to use GUI and DON'T want to use the terminal. Many of them don't switch to Linux because they think everything needs to be configured via the terminal.

by AiKi on Thu, 2004-12-02 18:09
...OK...


so... you dont mind if i put this Link over here..?

by echo77 on Fri, 2004-12-03 01:19
Yeah. We need all the help! Thanks for the link (it will help Debian users)
I'd be happier, if someone could shorten (and split) that up, and change the considerable amount of technicality to simplewords.
Although I'm able to understand it perfectly it is still too technical for the common man. We have to remember the ratio of comp engineers w.r.t. rest of the world. We want the rest of the world to use Linux, don't we?

by Qwertie on Thu, 2004-12-16 15:26
My Red Hat menu doesn't have System Settings > Server Settings > Samba. Samba wasn't installed (or at least I couldn't tell it was installed) so I installed it with yum install samba. What now?

- Distro: Fedora Core 2

by echo77 on Fri, 2004-12-17 13:42
I assume people would install the GUI based managers that comes with the Fedora CDs.
In the package manager (add/remove applications), you could choose the appropriate admin/system UI tools.
Well, if you know how to use yum, then should know how to use the terminal. Ask some guru to help you.

by Bebo on Mon, 2004-12-20 05:38
Hi there, echo 77,

I was reading through your howto, and I thought that there are some things missing. When you state the problem you say that you want to be able to connect to the internet with both computers. But later in the text you don't mention this at all. For your setup (internet <---> Tom <---> Jerry), Tom needs two NICs and you also have to do FORWARD:ing and SNAT:ing in Tom to get Jerry through to the internet.

Well, just some thoughts


  



All times are GMT -5. The time now is 12:34 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration