Connecting two linux PCs with crossover cable

I was wondering how I would have to do that. I simply can’t find a how-to or anything with google or the search function.

I have one PC with two ethernet ports. eth0 is connected to the router, it works perfectly. OpenSUSE 11 is installed on it.

Now I want to connect eth1 to eth0 of a second PC with Fedora 8 on it so I can transfer some files, and have an internet connection on the second one.

Later on I will also try to connect my GameCube to the openSUSE PC instead of the Fedora PC.

Any help would be greatly appreciated since I know absolutely nothing about this sort of stuff!

Can we assume that you PREFER to do it this way?
(i.e. rather than use the traditional approach to connect each PC
and GameCube to the router, which you mention you already have).

I googled for what you want to do, and found:
Quick HOWTO : Ch03 : Linux Networking - Linux Home Networking
among others.
[You want the section about making Linux into a router, about 3/4 of the way down.]

Cheers…

Dave

It makes no sense to me. I cant’ even find net.ipv4.ip_forward in /etc/sysctl.conf.

I’ve also tried following this thing: ICS - openSUSE. But I don’t seem to have a “Routing” option in YaST -> Network Services. I’ve tried figuring out which package I might need, but can’t find it. Although I did figure out some interesting stuff about apache2 on openSUSE in the process!

I’ve also tried this:

ifconfig eth1 192.168.0.1 up
echo "1" > /proc/sys/net/ipv4/ip_forward

On the Fedora box:

ifconfig eth1 192.168.0.2 up

After that they were able to ping each other. But that was it. I only remember this from some google searches, so it might not make much sense to do this.

I don’t understand why something that seems so simple is so difficult. I usually only understand half of what I’m reading about the topic.

I could connect the Fedora box and GameCube to the router but that would mean one or two extra cables through the ceiling/walls… It seemed easier this way.

They re-architected things just a bit different in 11.0. To do the ‘forwarding’ part,
there is a check-box labeled ‘Enable IP Forwarding’ in the ‘Routing’-tab
(under Yast2->Network Devices->Network Settings), when you configure
the network-interface. [Someone needs to update the Howto…looks like
either a typo or a layout-change between 10.3 an 11.0?!?!]

Yeah, it is a bit complex…it’s definitely an ‘advanced’ topic in network engineering.
[Which is why I suggested hooking the boxes to the existing router, as that is
definitely the preferred approach…that way, each machine has an independent
path to the Internet and doesn’t require any other machine to be up and running.]

Hope this helps…

Dave [who hasn’t actually done this since about 1990, on an old Red-Hat system]

I simply can’t figure it out. I might try again tomorrow if I have the time.

Did you understand hat when you have a network like that, you have in fact two networks, one between the router and PC1 and one between the two PCs? So you need two seperate network address ranges else nobody would know where to send the traffic. When you have 192.168.0.0/16 for one network, either subnet it or take e.g. (a subnet of) 10.0.0.0/8 for the other.

I magically got it to work somehow. I think the problem might have been that eth0 on the Fedora box was controlled by NetworkManager. Could that be the case?

I did indeed understand that I needed two networks, I just have no Idea what exactly is happening. As far as I can tell the openSUSE box forwards everything it gets from the Fedora box to the router. And it also forwards everything it gets from the router to the Fedora box.

Although that doesn’t make much sense, since the Fedora PC would also get all packets that are meant for the openSUSE PC. So I’m guessing the SUSE PC tells the router which packets come from the Fedora one (and thus would get packets back with the Fedora IP)?

Like I said before, I only half know what I’m doing. Or possibly even less. I’m not even sure what a packet is.

Thanks for the patience though. :slight_smile:

Nice it works.

I will try to explain a bit to help you to understand what is going on.

Packet. All network trafic is done in packets (like the postal service in you co
untry carries packages grom a source to a destination). Each packet (a bunch of
bytes as I think you understood already) has a payload part (that what should be
transported) and a wrapper (much as a normal postal package mentioned earlier).
The wrapper contains among other things the (IP) address where it should go.

Again analog to the postal service. You write the address on it and the only thi
ng you do is bring it out of the house to the nearest postal box (the gateway) o
f the postal system. Further transport is done withinn the postal system (Intern
et).

Inside a system you need an address (IP address, including a netmask). When pack
ages are send and the address belongs to the same network (all the addresses hav
ing the same common first part as your own address with length of the mask) stay
inside the LAN. So when you have address 192.168.10.12 with netmask 255.255.0.0
(also written as /16) all addresses 192.168.. are reached directly. Your SUSE
box and Fedora box can talk to each other (e.g. your ping, but also telnet, ftp
, whatever).

When you want to send packets outside your LAN you have to tell where the postal box (gateway) is. In most situations you will use only one gateway and that is your default gateway. In your Fedora box you configure your SUSE box as your default gateway. I do not know which managing tools are used for this in Fedora, but

sudo netstat -rn

will show you if the deafultgateway is the IP address of your SUSE box.

The SUSE box itself has also a default gateway. This is the router that connects you to the Internet. Now when the SUSE box gets packages from the Fedora box they are either for the SUSE box (and will be managed by the appropriate programs (or not)) or they must be send through to the router. In other words the SUSE box must bcome a router itself. This normaly doen as a kernel parameter somewhere (which I suppose you found in the docs you mentioned earlier).

Incoming packets from the Internet is the next problem (when you want to know more please ask), but I hope the mechanisms behind packets are a biit clearer now.

Using a crossover cable to network to PCs is messy. Spend a couple of bucks and purchase a hub to connect your PCs. Doing it this way is much more elegant that using a crossover cable.

I used YaST to configure things as in the link I gave a few posts above. So I wouldn’t know if I set any kernel parameters.

I’ve also managed to copy some files via SFTP. I’m figuring out how this happens at the moment. I can access my openSUSE PC from the Fedora box, but not the other way around. So I probably need to start some service on the Fedora box. It’s not simply sftp, but that’s still a useful command. Glad I accidentally found out about it.

I also can’t access Fedora via http, even though I was running an apache server. I can do that the other way around… That’s two services, maybe it’s the firewall or SELInux.

This is the output of “netstat -rn”:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt 
Iface
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 
eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 
eth0
0.0.0.0         192.168.0.254   0.0.0.0         UG        0 0          0 
eth0

192.168.0.254 Is indeed my SUSE PC’s static IP.

I’m interested in knowing how incoming packets are managed. I’d think multiple wrappers? Since the router doesn’t seem to know the Fedora box even exists, everything is sent to the openSUSE box which then “unwraps” it and finds another wrapper which points to the Fedora box? :slight_smile:

Gobetno - I don’t really want to spend €50 on one. Plus, I’m learning a lot this way.

A 5 port 100Mb switch is about $20.

But I suppose you could use the opportunity to learn about IP routing and forwarding. No, no encapsulation involved, as you seem to think. Just routing rules.

Might buy one later then. And I’ll look up routing rules, no clue what those are.

Apparently sshd wasn’t running on Fedora.