Operating System - Linux
1829541 Members
2607 Online
109992 Solutions
New Discussion

Finding which ethernet cards are connected to the network.

 
SOLVED
Go to solution
Prasad Joshi
Regular Advisor

Finding which ethernet cards are connected to the network.

Hi All,

The question is for Linux OS.

I have some servers each of which are having 6 Ethernet cards from eth0-eth5 but, only some of them are connected to the network. Most of the times they are eth0-eth2 of which eth0 is configured an IP Address but, not always the case.

I want to findout the which Ethernet cards are connected to the network.

Generally, what I do is assign a temporary unused IP Address to each eth card and check whether it is pingable but, this procedure will take too much of time if I have to repeat the procedure for more than 10 servers (and which is the case with me).

Is there any better way of doing the same? I am looking for any utility link linkloop on HP-UX. I tried linkloop from this URL http://freshmeat.net/projects/linkloop/ but, it is giving segmentation fault.

Please inform. Thanks in advance.

Thanks and Regards,
Prasad.
5 REPLIES 5
Rob Leadbeater
Honored Contributor
Solution

Re: Finding which ethernet cards are connected to the network.

Hi Prasad,

I think you'll probably want to look at mii-tool

Regards,

Rob
Prasad Joshi
Regular Advisor

Re: Finding which ethernet cards are connected to the network.

Thanks a lot mii-tool worked the way I wanted.

Now, I have one more question.

How can I find out whether I am able to communicate between

eth1 card of A machine and eth1 card of B machine.

In short I want to know whether the communication between the two machines is possible through which eth cards (these cards must not be from cards configured with Ip address)?

Please reply. Thanks in advance.

Thanks and Regards,
Prasad.
Rob Leadbeater
Honored Contributor

Re: Finding which ethernet cards are connected to the network.

Hi,

I'm not sure that's possible if I've understood your requirement correctly...

Surely you can't communicate over an interface if it's not configured...?

Cheers,

Rob
Wouter Jagers
Honored Contributor

Re: Finding which ethernet cards are connected to the network.

With the -I option to ping (that's a capital i) you can tell the machine to use a specific interface for the ping.

You could for example 'ping -I eth1 machineB' from machineA, and then check the arp cache:

# arp -i eth1 -a machineB

Then you'd know the MAC address of machineB which returned the ping packets from machineA's eth1.

Linkloop would be easier and less time consuming (and there might be a better way than the above), but hey, as long as we get the job done I guess :-)

Cheers,
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
Ralph Grothe
Honored Contributor

Re: Finding which ethernet cards are connected to the network.

Hi Prasad,

I only wanted to thank you for pointing my attention to the linkloop tool which I knew well from HP-UX.
But I didn't know that someone had written a port for Linux.

If I could, I would assign you 10 points for showing me the Linux port of linkloop.

So I downloaded the source tarball, compiled and installed it.
Luckily, it seems to work for me, and I don#t get a segmantation fault.
However, it must be run as root (or maybe the suid bit be set on the executable)

e.g. "ping" layer2 level a NIC from an HP-UX box

$ linkloop -i eth0 0x001083f5abcd
Link connectivity to LAN station: 0x001083f5abcd (HW addr 00:10:83:F5:AB:CD)
socket: Operation not permitted

Ok, one must be root

$ su -c "linkloop -i eth0 0x001083f5abcd"
Password:
Link connectivity to LAN station: 0x001083f5abcd (HW addr 00:10:83:F5:AB:CD)
-- OK -- 1 packets


Nice to have linkloop now also on Linux :-)
This is the distro I built it on:

$ uname -srv
Linux 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005

$ cat /etc/redhat-release
Red Hat Enterprise Linux WS release 4 (Nahant)


As the others already have mentioned,
the usual tool on Linux for link checking
is mii-tool (use -v to see more)
or ethtool.
Btw, ethtool has lots of features.
A nice gimmick is that you can make a NICs LED blink to help in identifying the HW.
(see -p in man ethtool)










Madness, thy name is system administration