🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.misc
Article #3400

Re: Ethernet id

#3400
From: B. Erickson Herring
Date: Fri, 13 Nov 1992 09:36
116 lines
5516 bytes
>>>>> On Thu, 12 Nov 1992 18:37:47 GMT, tagreen@lothario.cica.indiana.edu 
      (Todd A Green) said:

[ Someone asked how to get the ethernet address of a given NeXT        ]
[ machine.  Apostolos Lytras directed us to type "hostid" in a         ]
[ Terminal window (returns something that looks like "0x1007b72" that  ]
[ is not the _whole_ ethernet address).  Todd responds that his program]
[ (posted in csn.marketplace) will return the full ethernet address -  ]
[ but has the limitation that one must be root in order to run it.     ]
[ This seems unfair to me, as not everyone has root access on their    ]
[ machine.  It is hopelessly elitist to deny these users programmatic  ]
[ access to their machine's ethernet address, unless you also make it  ]
[ impossible for them to "grep _pat_ /usr/adm/messages" (chmod 600     ]
[ /usr/adm/messages?).  The relevant discussion, as well as my (much   ]
[ more egalitarian) solution, follows:                                 ]

Todd> In article <1992Nov12.101718.7912@ifi.unizh.ch>
      lytras@avalon.physik.unizh.ch (Apostolos Lytras) writes:
      >>
      >> [how to get ethernet addr?]
      >
      > This question has been raised here a few times already. There
      > *is* an easier way. Open a Terminal (shell) window, type
      > 'hostid'. There you are. (Isn't this in FAQ already? )

Todd> This only gives you part of the enet addr; a ethernet address is 6
Todd> bytes, hostid only returns 4.  See a program I posted in
Todd> comp.sys.next.marketplace to get the enet addr (Don't ask me why I
Todd> posted it there....that was where the thread was..)

Todd> Taken from "man 2 gethostid" : 

Todd> The hostid is a four byte number with the first byte
Todd> being the CPU version (only version 1 exists today) and the
Todd> last three bytes are the last three bytes in the ethernet
Todd> address

Egalitarian solution to this wretched problem follows:

#!/bin/sh -f
hostid | \
sed 's/0x[0-9]00/00000f00/g
     s/[0-9a-f][0-9a-f]/&:/g
     s/:$//g'

Note: This has only been tested on a 25MHz NeXTCUBE running 3.0.  As
      is usual, neither guarantee nor warrantee of fitness is given
      for this program.  The functioning of this program relies on a
      little-known characteristic of NeXT machines - the first four
      bytes of the ethernet address are "00:00:0f:00".  It is extremely
      difficult to discover this (undocumented!) tidbit (you have to
      ask someone who knows, or contact the IEEE...).
      
      I don't expect this to work on NS486, unfortunately.

In the interests of completeness, I will point out two more ways to
obtain the ethernet address.

The first is NeXT's suggested method:

   2.	Immediately after the *Testing System: message goes away, stop
   the boot process by holding down the Command bar and pressing the ~
   key (without pressing Shift). On keyboards with two Command keys,
   hold down the right Command key while pressing the ~ key. This
   displays the ROM monitor window, which contains information about
   the hardware, including the Ethernet address.  

   Here's an example of the ROM monitor output (yours will look
   slightly different): 

   CPU MC68040 33 MHz, memory 70 nS
   Ethernet address: 0:0:f:0:7:3d
   Memory size 16MB

   NeXT>

   Note:  If you were a little slow with your key sequence, you see
          the Restart/Power-Off panel instead. Press the Power key and
          try again. 

   3.	Write down the Ethernet addressPit's the sequence of numbers
   separated by colons (in the example, the Ethernet address is
   0:0:f:0:7:3d). Be sure to copy the number exactly as it appears.


The second is another tidbit from the documentation (also quite well
hidden -- I had to search on "ethernet address"!!!):

   /private/tmp# /usr/etc/snmpd -A
   /private/tmp# 
   [pd] /tmp> snmp status localhost
   localhost (NeXT.1.1), Uptime: 1 day, 17:52:09
   NeXT Mach 3.0: Wed Jul 29 19:43:28 PDT 1992;
   root(rcbuilder):mk-127.15/BUILD/RELEASE_M68K

   Name         Speed Type     Stat Ibyte Obyte Ierr Oerr  Physical
   Address
   en0                other    up   541MB  16MB <.1% <.1%  00:00:0F:00:7B:72
   lo0                other    up    13MB  13MB <.1% <.1%  
   en0                other    down   0 B   0 B            
   en0           10Mb ethernet up   856MB  16MB <.1% <.1%  

Both of these methods require root access, though you don't need a C
compiler.


Tongue firmly in cheek,

Erick
--
-----
Erick Herring           |   Computation is the art of carefully throwing
NeXT Manden             |   away information [and] Life is the art of
Polyteknisk Data,       |   carefully throwing away opportunities, an 
Lyngby, Danmark         |   interesting coincidental parallel.
herring@iesd.auc.dk     |    - Guy L. Steele Jr.
Technical Details
Message-ID: <HERRING.92Nov13093648@loke.iesd.auc.dk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!iesd!iesd.auc.dk!herring
References: <Qf09lty00WB51jQmoZ@andrew.cmu.edu> <1992Nov12.101718.7912@ifi.unizh.ch> <BxM930.34I@usenet.ucs.indiana.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!dkuug!iesd!iesd.auc.dk!herring
From: herring@iesd.auc.dk (B. Erickson Herring)
Subject: Re: Ethernet id
In-Reply-To: tagreen@lothario.cica.indiana.edu's message of Thu, 12 Nov 1992 18:37:47 GMT
Message-ID: <HERRING.92Nov13093648@loke.iesd.auc.dk>
Followup-To: comp.sys.next.misc
Sender: news@iesd.auc.dk (UseNet News)
Organization: Mathematics and Computer Science, Aalborg University
References: <Qf09lty00WB51jQmoZ@andrew.cmu.edu>
 <1992Nov12.101718.7912@ifi.unizh.ch>
 <BxM930.34I@usenet.ucs.indiana.edu>
Date: 13 Nov 92 09:36:48
Lines: 117