LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-30-2005, 08:17 PM   #1
Mr_Nightmare
LQ Newbie
 
Registered: Aug 2005
Distribution: Fedora 2
Posts: 1

Rep: Reputation: 0
Setting up a direct LAN between 2 PCs


Dear All,

I am a new user of the Linux OS,

I have 2 PCs with Linux Fedora 2 installed on both. I want to set up a direct LAN connection between both computers while both are running Linux. I know how to do the connection under windows (I got a Cat5 crossover cable), but I have no idea what the commands may be under Linux.

Can anybody please give me a step-by-step procedure on how to complete this task?
I tried to search for a similar topic on this site, but I didn't find any. So I guess this one is one of its kinds!!

Note: I want to do the set up using command lines, not using any GUI tool (otherwise, the task would be very similar to windows...)

Last edited by Mr_Nightmare; 08-30-2005 at 08:20 PM.
 
Old 08-30-2005, 09:46 PM   #2
charon79m
Member
 
Registered: Oct 2003
Distribution: Just about anything... so long as it is Debain based.
Posts: 297

Rep: Reputation: 30
I'm no Redhat guy, but I'll give you some direction here...

Check out the directory /etc/sysconfig/networking/

You'll find some info in the devices and the profiles directories that contain the IP info for the interfaces.

I'd assume you are familiar with the IP addressing needed to get the machines talking; if not, just post back and we'll go over it.

Oh, by the way... there is nothing wrong with using the GUI to make changes and then using the command line to see how those changes have affected the text files that hold the configuration.

You can also man ifconfig or ip to learn about addressing your machines.

MrKnisely
 
Old 08-31-2005, 12:00 AM   #3
sonajiso
Member
 
Registered: Oct 2003
Posts: 34

Rep: Reputation: 15
You have 2 choices:
1. Install a DHCP server on one of the boxes
2. Assign static IP's to each system, manually configure the routing - if required at all.

Since you only want to connect two PC's via a crossover cable, I suggest option 2. Its much easier to achieve.This is how you do it:

Lets suppose your computers are A and B. A has 3 NIC's (I believe on redhat they would be numbered eth0 to eth2) while B has 7 NIC's (eth0 - eth6). Let suppose A and B are connected via NIC's A.eth1 and B.eth3. All we have to do is assign static IP's to these 2 and enable arp on each of the 2 interfaces.

Please choose 2 IP's like 10.#.#.# or 192.168.#.#, where # is a base 10 number from 0-254. Choose these 2 IP's carefully. Make sure they do not fall in a range that is already routed "outside" via the other intrfaces. Lets say route returns the following on A:

Code:
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
10.5.0.0         *               255.255.0.0      U    0       0         0 eth2
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
As part of the above example, I would not want to choose any IP's in the range 192.168.0.0 - 192.168.0.255 and 10.5.0.0 and 10.5.255.255. It is also relatively unwise to choose the IP of the default gateway - if you have any.

So let suppose IP's 192.168.10.100 and 192.168.10.101 satisfy the above restrictions. All you have to do is assign one IP to A and one to B.

As root execute the following on A (Assigns the static IP of 192.168.10.100 to A.eth1):
Code:
ifconfig eth1 up
ifconfig eth1 inet 192.168.10.100 netmask 255.255.255.0 arp
Note that the address resolution protocol is probably enabled by default, but just making sure it's enabled we will pass arp to ifconfig eth1.

As root execute the following on B:
Code:
ifconfig eth3 up
ifconfig eth3 inet 192.168.10.101 netmask 255.255.255.0 arp
Now as a regular user, on A try
Code:
ping 192.168.10.101
..and on B try:
Code:
ping 192.168.10.100
The 2 computers should see one another.
If not, you might have to tweak your routing table. That can be achieved as easily as:

On A:
Code:
route add -net 192.168.10.0 netmask 255.255.255.0 dev eth1
..and on B:
Code:
route add -net 192.168.10.0 netmask 255.255.255.0 dev eth3
Although when an interface is activated, Linux tends to update the routing table as well, so it would be strange if you had to manually update it.
 
Old 08-31-2005, 07:58 PM   #4
charon79m
Member
 
Registered: Oct 2003
Distribution: Just about anything... so long as it is Debain based.
Posts: 297

Rep: Reputation: 30
Ifconfig is a one time only thing...

It is important to remember that with ifconfig you are setting up IP addresses for now. Once you reboot your system, you're back to the unconfigured state.

You need to edit the sysconfig files in Fedora to get them changed for good.

MrKnisely
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setting up direct printer in gnome muerte42200 Linux - Newbie 2 01-04-2005 10:07 PM
help to join 2 network ID PCs in single LAN cranium2004 Linux - Networking 2 10-27-2004 02:58 AM
Linux as Gateway in a LAN out of 20 PCs stormblast Linux - Newbie 2 04-30-2004 12:22 AM
RH9 PRINTER SERVER. PCs IN LAN DONT PRINT Juliancito Linux - Networking 0 07-01-2003 02:34 PM
Converting from Direct Dial modem to ADSL via LAN campsbayrich Linux - Networking 1 06-18-2003 06:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07: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
Open Source Consulting | Domain Registration