[comp.unix.questions] Getting the Ethernet Address?

patrick@vicorp.UUCP (Patrick Johnstone) (02/08/90)

I've been slogging through the Unix manuals trying to find a way to get
the Ethernet address of my system.  I've found a number of ways to get
the Internet address, but I'm interested in getting the raw Ethernet
address (the one with format %x:%x:%x:%x:%x:%x).  I'm working on
Sun's (all types) but am wondering if the procedure is the same on
all (BSD) Unix systems.  If there's anyone that can tell me how this
is done, can point me in the right direction, or whatever, please email
to me at the address below.  I'll post a summary on request.

Patrick Johnstone
V.I. Corporation
Amherst, MA 01002
	patrick@vicorp.uu.net
	...!vicorp!patrick

chris@mimsy.umd.edu (Chris Torek) (02/08/90)

In article <12763@vicorp.UUCP> patrick@vicorp.UUCP (Patrick Johnstone) writes:
>I've been slogging through the Unix manuals trying to find a way to get
>the Ethernet address of my system.

What makes you think that a system as *an* Ethernet address?  We have
a number of machines with 2 or more Ethernets, and a few with none
(because their underlying network is not Ethernet).

>... I'm interested in getting the raw Ethernet address (the one with
>format %x:%x:%x:%x:%x:%x).

There is no generally-available 4BSD or SunOS ioctl to read an Ethernet
address from an interface, but there is a generally-available ioctl to
read an ARP address.  Hence, if your Ethernet uses ARP to implement
Internet address translation, you can bounce a packet off the IP address
(forcing an ARP query) and then ask for the ARP entry with SIOCGARP
or with /etc/arp.

If you have 4.3BSD and run the Xerox NS protocols, the Ethernet address
of an interface appears as part of the XNS address.  (XNS runs only on
Ethernets and things that allow themselves to be addressed as if they
were Ethernets.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

dold@mitisft.Convergent.COM (Clarence Dold) (02/08/90)

in article <12763@vicorp.UUCP>, patrick@vicorp.UUCP (Patrick Johnstone) says:

> the Ethernet address of my system.  I've found a number of ways to get
> the Internet address, but I'm interested in getting the raw Ethernet
> address (the one with format %x:%x:%x:%x:%x:%x).  I'm working on

rlogin to another machine on your net, then do 'arp -a'.
-- 
---
Clarence A Dold - dold@tsmiti.Convergent.COM            (408) 435-5293
               ...pyramid!ctnews!tsmiti!dold        FAX (408) 435-3105
               P.O.Box 6685, San Jose, CA 95150-6685         MS#10-007

generous@dev.dtic.dla.mil (Curtis Generous) (02/09/90)

patrick@vicorp.UUCP (Patrick Johnstone) writes:

|| ... but I'm interested in getting the raw Ethernet
||address (the one with format %x:%x:%x:%x:%x:%x).  I'm working on
||Sun's (all types) but am wondering if the procedure is the same on
||all (BSD) Unix systems.
||Patrick Johnstone
||	patrick@vicorp.uu.net
||	...!vicorp!patrick

Try looking at the SIOCGARP ioctl request if your machine supports it.

--curtis
-- 
Curtis C. Generous
Defense Technical Information Center (DTIC)
ARPA: generous@dev.dtic.dla.mil
UUCP: {uunet,vrdxhq}!dev!generous