How do I find ethernet address? - Solaris programming question

How do I find ethernet address? - Solaris programming question

Post by Michael VanLo » Thu, 02 Aug 2001 05:36:37



I'm looking for a good way to find the ethernet address of the first
NIC in a Solaris box.

There has to be a syscall or something that does this.

I tried looking at the "ethers" man page but when I actually try to
write code, the headers don't match up, and ether_hostton isn't
defined anywhere in the headers or libraries in my system.

This is on a 2.6 box, but should be general enough to work on 2.5 thru
8.

Thanks!

 
 
 

How do I find ethernet address? - Solaris programming question

Post by Paul Johnsto » Thu, 02 Aug 2001 19:20:57


Hi,

Quote:> I'm looking for a good way to find the ethernet address of the first
> NIC in a Solaris box.

Have you tried strace'ing ifconfig?
I just tried that on my Linux box and can see it gets it's information
using ioctl's on a UDP socket.

Paul  

 
 
 

How do I find ethernet address? - Solaris programming question

Post by Michael VanLoo » Fri, 03 Aug 2001 11:54:04


Not yet.  I'll have to play with strace.  It's not obvious how it functions
on Solaris.

When you first mentioned it I thought it might be something like ktrace on
*BSD, but it appears it's a different creature.

I wrote some code on my FreeBSD box using ioctl's (SIOCGIFCONF and friends)
that successfully retrieves the link (Ethernet) addresses from interfaces,
and works great.  Unfortunately, that same code, when built on Solaris (2.6
anyway) retrieves only IP interfaces and link-level interfaces are not
listed.  Oh well onto the next idea...


Quote:> Hi,

> > I'm looking for a good way to find the ethernet address of the first
> > NIC in a Solaris box.

> Have you tried strace'ing ifconfig?
> I just tried that on my Linux box and can see it gets it's information
> using ioctl's on a UDP socket.

> Paul  

 
 
 

How do I find ethernet address? - Solaris programming question

Post by Ian Durka » Fri, 03 Aug 2001 17:23:07


: Not yet.  I'll have to play with strace.  It's not obvious how it functions
: on Solaris.

I think the earlier poster meant the 'truss' command. That does on
Solaris what 'strace' does on Linux.

--
 +--  ///\   Ian Durkacz  ------------------------------------------+
 |    C-oo   Department of Automatic Control & Systems Engineering  |
 |    \  >   The University of Sheffield, Sheffield, England        |

 
 
 

How do I find ethernet address? - Solaris programming question

Post by those who know me have no need of my nam » Fri, 03 Aug 2001 17:30:18



Quote:>Not yet.  I'll have to play with strace.  It's not obvious how it functions
>on Solaris.

you probably want truss rather than strace.

--
okay, have a sig then

 
 
 

How do I find ethernet address? - Solaris programming question

Post by Peter Seeba » Sat, 04 Aug 2001 14:00:53




>I'm looking for a good way to find the ethernet address of the first
>NIC in a Solaris box.

"the" ethernet address?  I assume you mean the MAC, not the IP.
Why do you want this?  Are you sure there can't be multiple values, or
confusing or meaningless answers?  Are you sure the "first" interface
is the right one?

If, like many people, you are seeking a unique cookie, it's called "hostid"
on Sparc hardware, at least.

-s
--

 +--- Need quality network services, server-grade computers, or a shell? ---+
 v   C/Unix wizard, Pro-commerce radical, Spam fighter.  Boycott Spamazon!  v
Consulting, computers, web hosting, and shell access: http://www.plethora.net/

 
 
 

1. How do I find ethernet address? - programming question

I'm looking for a good way to find the ethernet address of the first
NIC in a Solaris box.

There has to be a syscall or something that does this.

I tried looking at the "ethers" man page but when I actually try to
write code, the headers don't match up, and ether_hostton isn't
defined anywhere in the headers or libraries in my system.

This is on a 2.6 box, but should be general enough to work on 2.5 thru
8.

Thanks!

2. KGhostview - blank pages

3. Finding the ip address and hardware (ethernet) address of client behind a gateway

4. DHCP client configuration problem on Redhat 7.2

5. Program to lookup ethernet address (ARP-type thing?)

6. Gnomemeeting

7. Finding ethernet address

8. route does not vanish after end of connection

9. How do I find ethernet address? - Solaris programming question

10. How can I obtain my workstation's ethernet address in c program?

11. Re : Finding an ethernet address on a Sun/3

12. Finding an IP via HW Ethernet address

13. How can we find the MAC addresses for the two ethernet ports on a storedge 3510