[comp.unix.questions] Determining my ethernet address

bigbroth@cathedral.cerc.wvu.wvnet.edu (James M. Coleman) (03/21/91)

I need to find out the ethernet address of the machine my
program is running on without the help of the file /etc/hosts
(They are not maintained on my site). I know my hostname
and internet address.  Surely there must be a standard
way to do this but I'll be damned if I can find it.


Thanks for any help,

Jim Coleman





      Jim Coleman
      Concurrent Engineering Research Center (C.E.R.C.)
      West Virginia University
      955 Hartman Run Road
      Morgantown, WV 26506

      Phone:   (304) 293-7536
      Home :   (304) 292-6603
      FAX:     (304) 293-7541
      ARPAnet: bigbroth@cerc.wvu.wvnet.edu

jik@athena.mit.edu (Jonathan I. Kamens) (03/21/91)

In article <1467@babcock.cerc.wvu.wvnet.edu>, bigbroth@cathedral.cerc.wvu.wvnet.edu (James M. Coleman) writes:
|> I need to find out the ethernet address of the machine my
|> program is running on without the help of the file /etc/hosts
|> (They are not maintained on my site). I know my hostname
|> and internet address.  Surely there must be a standard
|> way to do this but I'll be damned if I can find it.

  No, ther eis no standard way of doing this.  It is quite dependent on the
hardware you are running on (including, quite possibly, which ethernet boards
you are using) and on the operating system running on that hardware.

  If you tell us what hardware you're using and what OS it's running, we will
probably be able to help you more effectively.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

Gary White (03/21/91)

In article <1467@babcock.cerc.wvu.wvnet.edu>
bigbroth@cathedral.cerc.wvu.wvnet.edu (James M. Coleman) writes:
>
>
>I need to find out the ethernet address of the machine my
>program is running on without the help of the file /etc/hosts

Jim-
If you are on a unix machine, generally the ifconfig command will 
tell you.  You say        ifconfig port    where you determine 
the name of the ethernet device 'port' by first doing netstat -n -r.

Alternatively, even if you are *not* running Unix, if you can log
in to a Unix host (on the *same* ethernet cable, not on another
subnet) and then type    arp -a   you should find out.

-Gary White
 

torek@elf.ee.lbl.gov (Chris Torek) (03/22/91)

In article <1467@babcock.cerc.wvu.wvnet.edu>
bigbroth@cathedral.cerc.wvu.wvnet.edu (James M. Coleman) writes:
>I need to find out the ethernet address of the machine my
>program is running on ...

Why do you assume that you even *have* an Ethernet address?  The
machine I am typing at is on the Internet but is not on an Ethernet.
(It happens to have an Ethernet address anyway, as it is a Sparcstation
SLC.)  Any machine may have any number of Ethernet addresses, from 0
to infinity (well... :-) ).

Although the intent of the original Xerox Ethernet design was that each
machine would have a single Ethernet address (wired into its backplane,
or in a PROM, or---as in this SLC---in a piece of battery-backed-up RAM
[and what happens when the battery dies, anyway?  The TOD clock fails,
but the machine also forgets not only its ether address but also that
it is a Sun-4/XX.  Yow!]), there have been plenty of violations.  You
must not count on having exactly one ether address per machine.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov

bigbroth@babcock.cerc.wvu.wvnet.edu (James M. Coleman) (03/22/91)

From article <11292@dog.ee.lbl.gov>, by torek@elf.ee.lbl.gov (Chris Torek):
> In article <1467@babcock.cerc.wvu.wvnet.edu>
> bigbroth@cathedral.cerc.wvu.wvnet.edu (James M. Coleman) writes:
>>I need to find out the ethernet address of the machine my
>>program is running on ...
> 
> Why do you assume that you even *have* an Ethernet address?  The
> machine I am typing at is on the Internet but is not on an Ethernet.
> (It happens to have an Ethernet address anyway, as it is a Sparcstation
> SLC.)  Any machine may have any number of Ethernet addresses, from 0
> to infinity (well... :-) ).
 
Stuff Deleted . . .
> -- 
> In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
> Berkeley, CA		Domain:	torek@ee.lbl.gov


Chris,

You are right that just because a machine is on the Internet or is a Unix machine
it is not necessarily on an Ethernet or even has a Ethernet number.  There are 
certainly many other types of LAN networks.  But ALL the machines which
will be running my monitor will be on an Ethernet and will be Unix based systems.
This has been a requirement for the systems we develop for.  I imagine the people
in the know here feel this isn't very limiting and porting to other network access
protocols can be done when we get a solid base on Ethernets.  My original problem
remains unsolved: I need a way to determine from within my program what is the
Ethernet address of the machine it's running on.  I am developing on Sun's, HP's,
DECStations,VAXstations, and SGI's.  I thought it would be as easy as finding
out my Internet address(that one took me abouy half an hour) but so far no luck.

Jim



      Jim Coleman
      Concurrent Engineering Research Center (C.E.R.C.)
      West Virginia University
      955 Hartman Run Road
      Morgantown, WV 26506

      Phone:   (304) 293-7536
      Home :   (304) 292-6603
      FAX:     (304) 293-7541
      ARPAnet: bigbrot