Solved

MAC address of a Remote machine given the IP address in Linux

Posted on 2007-03-18
7
2,449 Views
Last Modified: 2008-02-01
I would like to get the MAC address of a Remote machine given the IP address using C in an Redhat Linux vers 2.6 environment.
0
Comment
Question by:DaveAlmeida
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 1

Accepted Solution

by:
crackrocksteady earned 43 total points
ID: 18745619
Is the remote machine and the Redhat box going to be on the same broadcast domain? If not I don't see how you are going to arp for that mac address over the network...

Only thing I can think of is that you could use snmp and walk the iftable OID (1.3.6.1.2.1.2.2). That table has an entry called physical address that would have the mac address for that interface.

I'm sure there is a C library to easily do snmp gets.

0
 
LVL 12

Assisted Solution

by:ibu1
ibu1 earned 41 total points
ID: 18746375
/sbin/arp -a 192.168.1.1   (ip of remote machine)
0
 
LVL 14

Assisted Solution

by:pablouruguay
pablouruguay earned 41 total points
ID: 18746700
0
 

Author Comment

by:DaveAlmeida
ID: 18750532
The remote Machine Is not restricted to a Linux PC. It is most certainly within the same sub-net as the DHCP server for the interface is running on the local Linux device. The actual configuration is a point-point connection over USB between a PC host and a Linux Device. The user space application needs to set up a raw socket connection without knowing A Priori what the MAC address of the Remote Machine. The use of raw sockets is to demonstrate/dispute the performance gain of using raw sockets vs normal sockets when streaming UDP packets.  

In one of the solutions proposed, will not opening a socket connection to the USB network IFACE requesting all packets (ETH_P_ALL) and subsequently calling the driver with the ioctl call SIOCGIFHWADDR return the MAC address of the local USB device?

How can i accomplish this  short of isssuing an ARP command and examining the routing table afterwards?

Are there any libraries available used by packet sniffers/capture utilities that would could possibly do the trick?

It has been suggested to me that Issuing an ICMP request ove a connectionless socket and monitoring the resulting echo might be a solution. However I don't see how it could provide access to the Ethernet frame of the echo response.

0
 
LVL 14

Expert Comment

by:pablouruguay
ID: 18750606
sorry, not for me.. i give a solution about your question How to obtein a ip address from MAC.  now is another question more more more complex than the fist...


maybe anyone can help you... maybe iun linux programming
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question