linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* questions about link-level loopback, PF_PACKET and ETH_P_LOOP
@ 2001-06-14 21:03 Christopher Friesen
  2001-06-14 23:28 ` Ben Greear
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Friesen @ 2001-06-14 21:03 UTC (permalink / raw)
  To: linux-kernel


I'm attempting to write a piece of code that will validate the physical ethernet
link from a NIC to the nearest router/hub/switch.  What I'd like to do is to
send out an ethernet packet addressed to me, bounce it off the
hub/switch/router, and then read it back in.  This is all at the ethernet layer.

Needless to say, I've been having some issues.

1) Is it even possible to do something like this?  I notice that tcpdump shows
the packets outgoing (and properly formatted) but the packets don't seem to come
back to me.  Even if I send it out with the broadcast address, I don't seem to
get the packet back to the interface that sent it.  Is this standard behaviour? 
Is there any way to send out a packet addressed to myself and have it come back
to me?

2) Using ETH_P_LOOP as the protocol in the call to socket(), I can't seem to
receive any messages whatsoever.  If I set this to ETH_P_ALL, then I get all
messages (including ones with protocol set to ETH_P_LOOP).   It almost seems
like ETH_P_LOOP isn't properly handled by the kernel.  Is this the case?

The nitty-gritty on this is that I have a machine that has two NICs but only one
IP address.  I want to do some kind of packet loopback at the ethernet layer to
verify that my NIC transceiver is working properly.

If anyone has any bright ideas, I'd be glad to hear them.

Thanks,

Chris


-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: questions about link-level loopback, PF_PACKET and ETH_P_LOOP
  2001-06-14 21:03 questions about link-level loopback, PF_PACKET and ETH_P_LOOP Christopher Friesen
@ 2001-06-14 23:28 ` Ben Greear
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Greear @ 2001-06-14 23:28 UTC (permalink / raw)
  To: Christopher Friesen; +Cc: linux-kernel

Christopher Friesen wrote:
> 
> I'm attempting to write a piece of code that will validate the physical ethernet
> link from a NIC to the nearest router/hub/switch.  What I'd like to do is to
> send out an ethernet packet addressed to me, bounce it off the
> hub/switch/router, and then read it back in.  This is all at the ethernet layer.
> 

No properly configured ethernet hub or router will return you the
same packet you sent.  You can get some of this information out of the
drivers though, as their hardware knows the link state, at least the
physical layer.

Check out Becker's mii-diag program.  There are some options
in it to dump out all kinds of neat information about the drivers
and link condition.

> The nitty-gritty on this is that I have a machine that has two NICs but only one
> IP address.  I want to do some kind of packet loopback at the ethernet layer to
> verify that my NIC transceiver is working properly.

Ping your switch.  Or use something like ethernet channel bonding.

If both ports are up, then you should be able to send a pkt
from one NIC with your other NICs MAC in it, and the switch should deliver
that pkt to your other NIC.  However, if you don't receive the packet, you
cannot determine which one of your links/NICs is bad without going to
a third party (which I suggest should be your switch itself).

-- 
Ben Greear <greearb@candelatech.com>          <Ben_Greear@excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-14 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 21:03 questions about link-level loopback, PF_PACKET and ETH_P_LOOP Christopher Friesen
2001-06-14 23:28 ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).