Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want connect my two Linux PCs running in 2.6 kernel via cross over cable. To do this I have done the following settings after a Google search:

In PC1

  1. ifconfig eth0 10.10.11.16 netmask 255.255.255.0 up
  2. route add default gw 10.10.11.13 eth0 (default gateway which is ip of pc2 )

In PC2

  1. ifconfig eth0 10.10.11.13 netmask 255.255.255.0 up
  2. route add default gw 10.10.11.16 eth0 (default gateway which is ip of pc1 )

Then i tried pinging i could not able to connect.Are these above settings enough or any thing am i missing?

For your more information

In PC1

ifconfig output

eth0      Link encap:Ethernet  HWaddr 00:16:76:A1:33:37  
          inet addr:10.10.11.16  Bcast:10.10.11.255  Mask:255.255.255.0
          inet6 addr: fe80::216:76ff:fea1:3337/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:49984 errors:6 dropped:0 overruns:0 frame:6
          TX packets:17221 errors:0 dropped:0 overruns:0 carrier:0
          collisions:439 txqueuelen:1000 
          RX bytes:14295749 (13.6 MiB)  TX bytes:2684625 (2.5 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:511 errors:0 dropped:0 overruns:0 frame:0
          TX packets:511 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:62780 (61.3 KiB)  TX bytes:62780 (61.3 KiB)

route -n output

Destination     Gateway         Genmask       Flags  Metric Ref      Us Iface

10.10.11.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     1002   0        0 eth0
0.0.0.0         10.10.11.13     0.0.0.0         UG    0      0        0 eth0

In PC2

ifconfig output

eth0      Link encap:Ethernet  HWaddr 00:40:CA:A1:C7:1B  
          inet addr:10.10.11.13  Bcast:10.10.11.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:705 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:63557 (62.0 KiB)  TX bytes:9973 (9.7 KiB)
          Interrupt:11 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:112 errors:0 dropped:0 overruns:0 frame:0
          TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12400 (12.1 KiB)  TX bytes:12400 (12.1 KiB)

route -n output

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

10.10.11.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         10.10.11.16     0.0.0.0         UG    0      0        0 eth0
share|improve this question

migrated from stackoverflow.com May 5 '11 at 12:39

This question came from our site for professional and enthusiast programmers.

4  
It is unnecessary (and wrong) to have each PC as gateway of the other (it's like an infinite loop). Are you sure the cable works? Do you see the light at the ethernet port? It is possible that the machines are not responding to ping or that one pc (or both) has a firewall? –  Carlos Campderrós May 5 '11 at 11:53
    
Thanks for your quick reply Carlos, Cable is working because i tested that cable with windows machine and one linux machine.Cable is blinking at both the ends.And also firewall is not blocking.I have removed one gateway from one machine then also i am not able to ping –  Yuvaraj May 5 '11 at 12:17
    
Most Distros run a firewall by default these days... –  Turbo J May 5 '11 at 22:17
add comment

3 Answers

up vote 4 down vote accepted

I connected two Fedora machines. Here, I used A and B as the machine names.

Step 1:

Edit File

vim /etc/sysconfig/network-scripts/ifcfg-eth0

and enter details for machine A

DEVICE="eth0"
HWADDR="<Machine A NIC HW ADDR CAN BE ENTERED USING ifconfig>"
BOOTPROTO="static"
ONBOOT="yes"
NM_CONTROLLED="yes"
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.1
BROADCAST=192.168.1.255
IPV4_FAILURE_FATAL=yes
IPV6INIT=no

Step 2:

Edit File

vim /etc/sysconfig/network-scripts/ifcfg-eth0

and enter details for machine B

DEVICE="eth0"
HWADDR="<Machine B NIC HW ADDR CAN BE ENTERED USING ifconfig>"
BOOTPROTO="static"
ONBOOT="yes"
NM_CONTROLLED="yes"
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=192.168.1.2
BROADCAST=192.168.1.255
IPV4_FAILURE_FATAL=yes
IPV6INIT=no

Step 3:

Connect both machines with an Ethernet crossover cable.

Step 4:

Optional reboot.

Step 5:

ping 192.168.1.1 from machine B and ping 192.168.1.2 from machine A

Following are the steps in case if you are still not able to ping. It might be possible that because of the network card's speed difference your machines are not able to ping. Set both machines' speed to constant. Then it might work.

-  On Machine A enter command:
    ethtool -s eth0 speed 10 duplex half

-  On Machine B enter command:
    ethtool -s eth0 speed 10 duplex half

Then repeat Step 5. If your machines are still not able to ping each other then do the following:

[root@localhost ravidborse]# lspci 
00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
00:1b.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)
00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3)
00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 03)
00:1f.2 IDE interface: Intel Corporation 82801FBM (ICH6M) SATA Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controller (rev 03)
06:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
06:09.0 CardBus bridge: Texas Instruments PCI7420 CardBus Controller
06:09.2 FireWire (IEEE 1394): Texas Instruments PCI7x20 1394a-2000 OHCI Two-Port PHY/Link-Layer Controller
06:09.3 Mass storage controller: Texas Instruments PCI7420/7620 Combo CardBus, 1394a-2000 OHCI and SD/MS-Pro Controller
06:0a.0 Network controller: Intel Corporation PRO/Wireless 2200BG [Calexico2] Network Connection (rev 05)

Check which drivers are loaded in dmesg | grep Ethernet lsmod | grep 8139

I entered the lspci command and looked at which Ethernet controller is using your machines.

My A Machine is using RTL8101E/8102E and above lspci output is of Machine B. Download the respective Linux drivers for the Ethernet card and install them. These drivers are very easy to install. Read the readme in the driver's folder.

share|improve this answer
add comment

you don't need a route or an gateway if the hosts are in the same subnet (which is the case in your example) So remove the routes and restart the routing daemon (or restart network service)

If that still doesn't work: maybe there could be an problem with speed-negotiation look at the output of ethtool:

$ ethtool eth0

use ethtool to change duplex, speed and other settings. All thoes settings should be the same on both systems

share|improve this answer
add comment

The configuration that you have done appears to be correct, although it is not neccesary to set each PC as the gateway of the other, the PC just need to be on the same LAN for it to work.

Maybe it's a problem with you cable.

If your network cards have autosensing capabilities, any regular cable of cross-over cable will work (for that reason your test with the Windows PC work) but if they lack this function then you have to use a cross-over cable and a regular UTP cable will not work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.