I have two machines, one connected to one ISP, the other connected to another ISP. Both machines have two Ethernet cards (aka NIC cards). I want to connect the two machines directly together so that traffic back and forth between them can go direct, rather than from one ISP to the other. How? Easy!
First, connect the second Ethernet card in each machine with a crossover cable. This is a regular Ethernet cable but for the fact that its “send” and “receive” wires are crossed over (this is an over-simplication, but it helps). When you go to the store to buy this cable, make sure you buy a crossover cable rather than a regular patch cable. As an alternative, you can plug both machines, using regular patch cables, into the same hub; the effect is the same.
Next, set up the network connection on the first machine’s second Ethernet card:
ifconfig eth1 192.168.1.1 netmask 255.255.255.0 up route add -net 192.168.1.0 netmask 255.255.255.0 eth1
This assigns an IP address of 192.168.1.1 to the second Ethernet connection. This IP is of a special collection set aside for this “private” purpose; just don’t pick one at random!.
Next, do the same on the second machine:
ifconfig eth1 192.168.1.2 netmask 255.255.255.0 up route add -net 192.168.1.0 netmask 255.255.255.0 eth1
Same deal here, but this machine gets an IP address of 192.168.1.2.
That’s it! At this point you should be able to ping 192.168.1.1 from 192.168.1.2 and vice versa.
I’ve just set up a couple of machines like this for polling day here on Prince Edward Island; both of them have gigabit Ethernet cards. You wouldn’t believe how fast files fly from one to the other!
I’m posting this here because most of what you’ll Google when searching for how to do this is instructions for connecting one machine to the Internet using a second machine’s existing Internet connection, and that’s not what this is about.
I’m assuming, by the way, that you’ve already handled getting the second Ethernet cards in each machine recognized and configured as eth1.