home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / next / misc / 21961 < prev    next >
Encoding:
Text File  |  1992-11-13  |  5.3 KB  |  133 lines

  1. Newsgroups: comp.sys.next.misc
  2. Path: sparky!uunet!mcsun!sunic!dkuug!iesd!iesd.auc.dk!herring
  3. From: herring@iesd.auc.dk (B. Erickson Herring)
  4. Subject: Re: Ethernet id
  5. In-Reply-To: tagreen@lothario.cica.indiana.edu's message of Thu, 12 Nov 1992 18:37:47 GMT
  6. Message-ID: <HERRING.92Nov13093648@loke.iesd.auc.dk>
  7. Followup-To: comp.sys.next.misc
  8. Sender: news@iesd.auc.dk (UseNet News)
  9. Organization: Mathematics and Computer Science, Aalborg University
  10. References: <Qf09lty00WB51jQmoZ@andrew.cmu.edu>
  11.     <1992Nov12.101718.7912@ifi.unizh.ch>
  12.     <BxM930.34I@usenet.ucs.indiana.edu>
  13. Date: 13 Nov 92 09:36:48
  14. Lines: 117
  15.  
  16. >>>>> On Thu, 12 Nov 1992 18:37:47 GMT, tagreen@lothario.cica.indiana.edu 
  17.       (Todd A Green) said:
  18.  
  19. [ Someone asked how to get the ethernet address of a given NeXT        ]
  20. [ machine.  Apostolos Lytras directed us to type "hostid" in a         ]
  21. [ Terminal window (returns something that looks like "0x1007b72" that  ]
  22. [ is not the _whole_ ethernet address).  Todd responds that his program]
  23. [ (posted in csn.marketplace) will return the full ethernet address -  ]
  24. [ but has the limitation that one must be root in order to run it.     ]
  25. [ This seems unfair to me, as not everyone has root access on their    ]
  26. [ machine.  It is hopelessly elitist to deny these users programmatic  ]
  27. [ access to their machine's ethernet address, unless you also make it  ]
  28. [ impossible for them to "grep _pat_ /usr/adm/messages" (chmod 600     ]
  29. [ /usr/adm/messages?).  The relevant discussion, as well as my (much   ]
  30. [ more egalitarian) solution, follows:                                 ]
  31.  
  32. Todd> In article <1992Nov12.101718.7912@ifi.unizh.ch>
  33.       lytras@avalon.physik.unizh.ch (Apostolos Lytras) writes:
  34.       >>
  35.       >> [how to get ethernet addr?]
  36.       >
  37.       > This question has been raised here a few times already. There
  38.       > *is* an easier way. Open a Terminal (shell) window, type
  39.       > 'hostid'. There you are. (Isn't this in FAQ already? )
  40.  
  41. Todd> This only gives you part of the enet addr; a ethernet address is 6
  42. Todd> bytes, hostid only returns 4.  See a program I posted in
  43. Todd> comp.sys.next.marketplace to get the enet addr (Don't ask me why I
  44. Todd> posted it there....that was where the thread was..)
  45.  
  46. Todd> Taken from "man 2 gethostid" : 
  47.  
  48. Todd> The hostid is a four byte number with the first byte
  49. Todd> being the CPU version (only version 1 exists today) and the
  50. Todd> last three bytes are the last three bytes in the ethernet
  51. Todd> address
  52.  
  53. Egalitarian solution to this wretched problem follows:
  54.  
  55. #!/bin/sh -f
  56. hostid | \
  57. sed 's/0x[0-9]00/00000f00/g
  58.      s/[0-9a-f][0-9a-f]/&:/g
  59.      s/:$//g'
  60.  
  61. Note: This has only been tested on a 25MHz NeXTCUBE running 3.0.  As
  62.       is usual, neither guarantee nor warrantee of fitness is given
  63.       for this program.  The functioning of this program relies on a
  64.       little-known characteristic of NeXT machines - the first four
  65.       bytes of the ethernet address are "00:00:0f:00".  It is extremely
  66.       difficult to discover this (undocumented!) tidbit (you have to
  67.       ask someone who knows, or contact the IEEE...).
  68.       
  69.       I don't expect this to work on NS486, unfortunately.
  70.  
  71. In the interests of completeness, I will point out two more ways to
  72. obtain the ethernet address.
  73.  
  74. The first is NeXT's suggested method:
  75.  
  76.    2.    Immediately after the *Testing System: message goes away, stop
  77.    the boot process by holding down the Command bar and pressing the ~
  78.    key (without pressing Shift). On keyboards with two Command keys,
  79.    hold down the right Command key while pressing the ~ key. This
  80.    displays the ROM monitor window, which contains information about
  81.    the hardware, including the Ethernet address.  
  82.  
  83.    Here's an example of the ROM monitor output (yours will look
  84.    slightly different): 
  85.  
  86.    CPU MC68040 33 MHz, memory 70 nS
  87.    Ethernet address: 0:0:f:0:7:3d
  88.    Memory size 16MB
  89.  
  90.    NeXT>
  91.  
  92.    Note:  If you were a little slow with your key sequence, you see
  93.           the Restart/Power-Off panel instead. Press the Power key and
  94.           try again. 
  95.  
  96.    3.    Write down the Ethernet addressPit's the sequence of numbers
  97.    separated by colons (in the example, the Ethernet address is
  98.    0:0:f:0:7:3d). Be sure to copy the number exactly as it appears.
  99.  
  100.  
  101. The second is another tidbit from the documentation (also quite well
  102. hidden -- I had to search on "ethernet address"!!!):
  103.  
  104.    /private/tmp# /usr/etc/snmpd -A
  105.    /private/tmp# 
  106.    [pd] /tmp> snmp status localhost
  107.    localhost (NeXT.1.1), Uptime: 1 day, 17:52:09
  108.    NeXT Mach 3.0: Wed Jul 29 19:43:28 PDT 1992;
  109.    root(rcbuilder):mk-127.15/BUILD/RELEASE_M68K
  110.  
  111.    Name         Speed Type     Stat Ibyte Obyte Ierr Oerr  Physical
  112.    Address
  113.    en0                other    up   541MB  16MB <.1% <.1%  00:00:0F:00:7B:72
  114.    lo0                other    up    13MB  13MB <.1% <.1%  
  115.    en0                other    down   0 B   0 B            
  116.    en0           10Mb ethernet up   856MB  16MB <.1% <.1%  
  117.  
  118. Both of these methods require root access, though you don't need a C
  119. compiler.
  120.  
  121.  
  122. Tongue firmly in cheek,
  123.  
  124. Erick
  125. --
  126. -----
  127. Erick Herring           |   Computation is the art of carefully throwing
  128. NeXT Manden             |   away information [and] Life is the art of
  129. Polyteknisk Data,       |   carefully throwing away opportunities, an 
  130. Lyngby, Danmark         |   interesting coincidental parallel.
  131. herring@iesd.auc.dk     |    - Guy L. Steele Jr.
  132.  
  133.