simple ping; pinging 101

Kevin J. Cummings cummings at kjchome.homeip.net
Sat Jul 9 01:39:08 UTC 2005


THUFIR HAWAT wrote:
> two computers, arrakis and caladan, are
> connected with some standard RJ45 Cat 5e cable
> and a hub. arrakis can ping caladan from eth0.
> arrakis cannot ping caladan from eth1.
> 
> what's wrong with arrakis eth1, please?
> 
> I'm 99.999% sure it's not a hardware problem.
> eth0 is built-in to the motherboard,
> eth1 is a D-Link NIC.
> 
> 
> arrakis eth0           192.168.0.100
> arrakis eth1           192.168.0.101

Don't do this!  It will give you more headaches than you want!

Use a *different* subnet for arrackis eth0.  I suspect that the default 
subnet for 192.168.0.0 network on arrakis is to use eth0, thus the 
packets intended for caladan get sent on eth0.

> caladan eth0           192.168.0.102

> [root at arrakis init.d]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
> # built-in
> DEVICE=eth0
> ONBOOT=yes
> BOOTPROTO=none
> HOSTNAME=arrakis
> #HWADDR=00:0D:88:37:FA:22
> NETMASK=255.255.255.0
> IPADDR=192.168.0.100
> USERCTL=yes
> PEERDNS=yes
> TYPE=Ethernet
> IPV6INIT=yes

> [root at arrakis init.d]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
> # D-Link System Inc RTL8139 Ethernet
> DEVICE=eth1
> ONBOOT=yes
> BOOTPROTO=none
> HOSTNAME=arrakis
> HWADDR=00:0D:88:37:FA:22
> NETMASK=255.255.255.0
> IPADDR=192.168.0.101
> USERCTL=yes
> PEERDNS=yes
> TYPE=Ethernet
> IPV6INIT=yes

> [root at arrakis init.d]# ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:0A:E6:A0:24:27
>           inet addr:192.168.0.100  Bcast:192.168.0.255
> Mask:255.255.255.0
>           inet6 addr: fe80::20a:e6ff:fea0:2427/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:123 errors:6 dropped:0 overruns:0 frame:6
>           TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:21 txqueuelen:1000
>           RX bytes:15378 (15.0 KiB)  TX bytes:4144 (4.0 KiB)
>           Interrupt:5 Base address:0xd400
> 
> eth1      Link encap:Ethernet  HWaddr 00:0D:88:37:FA:22
>           inet addr:192.168.0.101  Bcast:192.168.0.255
> Mask:255.255.255.0
>           inet6 addr: fe80::20d:88ff:fe37:fa22/64 Scope:Link
>           UP BROADCAST MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:45 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:0 (0.0 b)  TX bytes:3090 (3.0 KiB)
>           Interrupt:5 Base address:0xd000
> 
> 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:108 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:8528 (8.3 KiB)  TX bytes:8528 (8.3 KiB)
> 
> [root at arrakis init.d]# route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> 192.168.0.0     *               255.255.255.0   U     0      0        0
> eth0
> 192.168.0.0     *               255.255.255.0   U     0      0        0
> eth1

Two routes for 192.168.0.0 is not what you want to see.  If you instead 
replace the second route with one directly to caladan, it *might* work.

   192.168.0.102    *              255.255.255.0   UH    0      0 
  0 eth1

You would need to add the route via:

route -add 192.168.0.102 eth0

As you can see, this is complicated.  Instead, use a different subnet 
for arrakis eth0 (like 192.168.1.0).  Then configure arrakis to forward 
packets from caladan to the arrakis eth0 network (by setting a gateway 
on caladan and configuring IP forwarding on arrakis).

> 169.254.0.0     *               255.255.0.0     U     0      0        0
> eth1
> [root at arrakis init.d]#
> 
> [root at arrakis init.d]# echo "arrakis eth1 pinging caladan eth0"
> arrakis eth1 pinging caladan eth0
> [root at arrakis init.d]# ./network restart
> Shutting down interface eth0:                              [  OK  ]
> Shutting down interface eth1:                              [  OK  ]
> Shutting down loopback interface:                          [  OK  ]
> Disabling IPv4 packet forwarding:                          [  OK  ]
> Setting network parameters:                                [  OK  ]
> Bringing up loopback interface:                            [  OK  ]
> Bringing up interface eth0:                                [  OK  ]
> Bringing up interface eth1:                                [  OK  ]
> [root at arrakis init.d]# ping 192.168.0.102
> PING 192.168.0.102 (192.168.0.102) 56(84) bytes of data.
> 
>>From 192.168.0.100 icmp_seq=1 Destination Host Unreachable
>>From 192.168.0.100 icmp_seq=2 Destination Host Unreachable
>>From 192.168.0.100 icmp_seq=3 Destination Host Unreachable
>>From 192.168.0.100 icmp_seq=5 Destination Host Unreachable
>>From 192.168.0.100 icmp_seq=6 Destination Host Unreachable
>>From 192.168.0.100 icmp_seq=7 Destination Host Unreachable
> 
> --- 192.168.0.102 ping statistics ---
> 8 packets transmitted, 0 received, +6 errors, 100% packet loss, time
> 6999ms
> , pipe 4

I'm sure that a traceroute will indicate that you're going out through 
eth0 instead of eth1.

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us




More information about the fedora-list mailing list