Interface MAC address SunOS 4.1.3

Interface MAC address SunOS 4.1.3

Post by Peter Howle » Fri, 15 Mar 1996 04:00:00



Trying to get the hardware address of le0 on a SunOS 4.1.3
machine. On the BSD machines, using SIOCGIFCONF I get the
the ifconf buffer with the SIOCGCONF ioctl. Some of the
returned ifreq's in the ifconf buffer have the

   ifr_addr.sa_family == AF_INET

and some have

   ifr_addr.sa_family == AF_LINK

This is great for Net/FreeBSD, the sa_data contains the MAC,
but the SunOS box only returns AF_INET ifreq's in the buffer.
Hmmmm. so how do I get the ethernet MAC address of an interface

--------------------------------------------------------------------
Peter Howlett                           Atlantic Systems Group

http://www.ASG.unb.ca/personal/ph.html       Phone: (506) 447-3050
PGP Key available                       Fax:   (506) 453-5004

 
 
 

Interface MAC address SunOS 4.1.3

Post by Stephane Tsac » Sat, 16 Mar 1996 04:00:00


[...]
   This is great for Net/FreeBSD, the sa_data contains the MAC,
   but the SunOS box only returns AF_INET ifreq's in the buffer.
   Hmmmm. so how do I get the ethernet MAC address of an interface

I've got it... :
adb -k /vmunix /dev/mem
physmem 3fb1
le_softc/X
_le_softc:
_le_softc:      ff005000
0xff005000+0t112/X
0xff005070:     8002071
0xff005074:     d5010000

First component of struct le_softc is a struct arpcom which starts by:
struct  arpcom {
        struct  ifnet ac_if;            /* network-visible interface */
        struct  ether_addr ac_enaddr;   /* ethernet hardware address */
        struct  in_addr ac_ipaddr;      /* copy of ip address- XXX */
...

and sizeof(struct ifnet) = 112

Don't ask me if the machine has more than one interface...

  ,
Stephane
ps; references: netinet/if_ether.h, net/if.h, sunif/le_var.h
--



26 rue d'Ulm                    Phone: (33-1) 4234 6772 (W)
75231 cedex 5 Paris             40510636(fax) 4828 4994 (H)
France                          <<PUSHJ P, POPJ P, recursively>>

 
 
 

Interface MAC address SunOS 4.1.3

Post by Doug Hugh » Sat, 16 Mar 1996 04:00:00



|> I've got it... :
|> adb -k /vmunix /dev/mem
|> physmem 3fb1
|> le_softc/X
|> _le_softc:
|> _le_softc:      ff005000
|> 0xff005000+0t112/X
|> 0xff005070:     8002071
|> 0xff005074:     d5010000
|>
|> First component of struct le_softc is a struct arpcom which starts by:
|> struct    arpcom {
|>   struct  ifnet ac_if;            /* network-visible interface */
|>   struct  ether_addr ac_enaddr;   /* ethernet hardware address */
|>   struct  in_addr ac_ipaddr;      /* copy of ip address- XXX */
|> ...
|>
|> and sizeof(struct ifnet) = 112
|>
|> Don't ask me if the machine has more than one interface...

Luckily, on Suns, there is only 1 MAC for all ethernets. The mac is
stored in nvram on the motherboard, so you don't have to worry about this.
(or unluckily, depending on your point of view)
--
____________________________________________________________________________
Doug Hughes                                     Engineering Network Services
System/Net Admin                                Auburn University

 
 
 

Interface MAC address SunOS 4.1.3

Post by Peter Howlet » Sat, 16 Mar 1996 04:00:00




> |> I've got it... :
> |> adb -k /vmunix /dev/mem
> |> physmem 3fb1
> |> le_softc/X
> |> _le_softc:
> |> _le_softc:      ff005000
> |> 0xff005000+0t112/X
> |> 0xff005070:     8002071
> |> 0xff005074:     d5010000
> |>
> |> First component of struct le_softc is a struct arpcom which starts by:
> |> struct       arpcom {
> |>      struct  ifnet ac_if;            /* network-visible interface */
> |>      struct  ether_addr ac_enaddr;   /* ethernet hardware address */
> |>      struct  in_addr ac_ipaddr;      /* copy of ip address- XXX */
> |> ...
> |>
> |> and sizeof(struct ifnet) = 112
> |>
> |> Don't ask me if the machine has more than one interface...

> Luckily, on Suns, there is only 1 MAC for all ethernets. The mac is
> stored in nvram on the motherboard, so you don't have to worry about this.
> (or unluckily, depending on your point of view)

Actually, upon looking at TCP/IP illustrated Vol 2 (which SunOS
obviously is not quite the same as, but close to) the le_softc
struct is a wonderful place to find the forbidden fruit of the
ifnet struct (wish there was an ioctl for this...) arpcom would
be great to since it comes right after le_softc. But, as was
mentioned in a previous post, what if there are more than one
ethernet card in this SunOS machine I am working on? Is there a
separate le_softc for each card? (I am on a Sparc 20 clone AXIL
with le0 and le1)

Turns out, I got a mail message from a fellow who mentioned the
sysinfo program from usc.edu which tells just about everything
there is to know about a SunOS, Solaris, HPUX, AIX, IRIX machine.
It's quite impressive although I have not actually traced to
find out how it gets the MAC address yet. (Seems to probe the
prom directly?)

Many thanks for the responses....

--------------------------------------------------------------------
Peter Howlett                           Atlantic Systems Group

http://www.ASG.unb.ca/personal/ph.html  Phone: (506) 447-3050
PGP Key ID: 60F2EEC1                    Fax:   (506) 453-5004

 
 
 

Interface MAC address SunOS 4.1.3

Post by Mark Henders » Sun, 17 Mar 1996 04:00:00




>Luckily, on Suns, there is only 1 MAC for all ethernets. The mac is
>stored in nvram on the motherboard, so you don't have to worry about this.
>(or unluckily, depending on your point of view)

Well, this is usually true.

The default MAC address for every ethernet interface is stored in
NVRAM. If you don't specify an ethernet address when initialising the
interface, you get the default.

However, you can change the default MAC address for an interface with
ifconfig or just specify any ethernet address you want in your startup
files.

e.g.
ratatosk# ifconfig le0 ether 8:0:20:1:2:3
ratatosk# ifconfig le0
le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>
        inet 192.168.7.1 netmask ffffff00 broadcast 192.168.7.0
        ether 8:0:20:1:2:3

If you are content to get the default ethernet address out of the
NVRAM, then you can do this via the openprom driver. For an example
see getobphostid.c in my change-sun-hostid package available from:

ftp://ftp.netcom.com/pub/he/henderso/change-sun-hostid.tar.gz
ftp://ftp.wimsey.com/pub/crypto/sun-stuff/change-sun-hostid.tar.gz
http://www.squirrel.com/squirrel/sun-stuff/change-sun-hostid.tar.gz

On the other hand, if you really want the real current MAC address of
le0 (for example), the following should do under Sun OS 4.1.x.
N.B. This code must be run as root

#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/time.h>
#include <net/nit_if.h>

main()
{
    struct ifreq    foo;
    int             i, j;

    if ((i = open("/dev/nit", O_RDONLY)) < 0) {
        fprintf(stderr, "cannot open /dev/nit\n");
        exit(1);
    }
    strcpy(foo.ifr_name, "le0");
    foo.ifr_addr.sa_family = AF_NIT;
    if (ioctl(i, NIOCBIND, &foo) < 0) {
        fprintf(stderr, "NIOCBIND failed\n");
        exit(1);
    }
    if (ioctl(i, SIOCGIFADDR, &foo) < 0) {
        fprintf(stderr, "SIOCGIFADDR failed\n");
        exit(1);
    }
    for (j = 0; j < 6; j++)
        printf("%02x ", foo.ifr_addr.sa_data[j]);
    printf("\n");

Quote:}

e.g. the output on the machine I just executed the above ifconfig
commands on is: 08 00 20 01 02 03

--

ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1  A1 2A 2A 06 4A D5 92 46
unstrip for Solaris, Wimsey cryptography archive, Wimsey TECO archive,
change-sun-hostid, Sun NVRAM/hostid FAQ - http://www.squirrel.com/squirrel

 
 
 

Interface MAC address SunOS 4.1.3

Post by Mark C. Henders » Wed, 20 Mar 1996 04:00:00




Quote:>Dear Sun experts,
>I need your help on this one, it's really weird:

>My machine died yesterday. On switch-on, the IP address and the hostid
>showed up as FF.FF.FF.FF.FF and FFFFFFFF, and instead of saying
>'Testing...'
>the thing went testing its audio chip ('Listen for beep...').
>When it was happy, it went into an endless loop testing memory.

The internal bettery in your NVRAM chip is dead. See the Sun NVRAM/hostid FAQ
ftp://ftp.wimsey.com/pub/crypto/sun-stuff/sun-nvram-hostid.faq.html
ftp://ftp.netcom.com/pub/he/henderso/sun-nvram-hostid.faq.html
http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html
--

ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1  A1 2A 2A 06 4A D5 92 46
http://www.squirrel.com/squirrel - change-sun-hostid, unstrip for Solaris,
 computer security, TECO, FGMP, Sun NVRAM/hostid FAQ, Wimsey crypto archive
 
 
 

Interface MAC address SunOS 4.1.3

Post by Mark Sitkowsk » Wed, 20 Mar 1996 04:00:00


Dear Sun experts,
I need your help on this one, it's really weird:

My machine died yesterday. On switch-on, the IP address and the hostid
showed up as FF.FF.FF.FF.FF and FFFFFFFF, and instead of saying
'Testing...'
the thing went testing its audio chip ('Listen for beep...').
When it was happy, it went into an endless loop testing memory.

In diagnostic mode, 'boot sd(0,0)vmunix' got the reply 'SCSI device
failed to respond', while probe-scsi correctly found all SCSI devices.

The network loopback test fails with 'IDPROM data corrupt' (or similar).

Memory dumps dump, but memory fills say 'stack underflow'.

Three days ago the internal lithium battery died, but surely that's not
connected...?

If anyone out there knows the answer, please reply by email as soon as
possible, to save my sanity. I can't figure this one out.

Mark

 ------------------------------------------------------------------------------
 Mark Sitkowski                                               !
 Australian Computing and Communications Institute
 723 Swanston Street
 Carlton Victoria 3053
 ------------------------------------------------------------------------------

 Fax:   (613-9) 282-2534    WWW:
http://www.acci.com.au/People/marks.html

 Home phone: (613-9) 729-0731                                !
 Home fax:   (613-9) 720-1487
 ------------------------------------------------------------------------------

 
 
 

Interface MAC address SunOS 4.1.3

Post by Jason Corcora » Fri, 22 Mar 1996 04:00:00



> Dear Sun experts,
> I need your help on this one, it's really weird:

> My machine died yesterday. On switch-on, the IP address and the hostid
> showed up as FF.FF.FF.FF.FF and FFFFFFFF, and instead of saying
> 'Testing...'
> the thing went testing its audio chip ('Listen for beep...').
> When it was happy, it went into an endless loop testing memory.

> In diagnostic mode, 'boot sd(0,0)vmunix' got the reply 'SCSI device
> failed to respond', while probe-scsi correctly found all SCSI devices.

> The network loopback test fails with 'IDPROM data corrupt' (or similar).

> Memory dumps dump, but memory fills say 'stack underflow'.

> Three days ago the internal lithium battery died, but surely that's not
> connected...?

> If anyone out there knows the answer, please reply by email as soon as
> possible, to save my sanity. I can't figure this one out.

> Mark

>  ------------------------------------------------------------------------------
>  Mark Sitkowski                                               D|?To?!
>  Australian Computing and Communications Institute
>  723 Swanston Street
>  Carlton Victoria 3053
>  ------------------------------------------------------------------------------

>  Fax:   (613-9) 282-2534    WWW:
> http://www.acci.com.au/People/marks.html

>  Home phone: (613-9) 729-0731                                ?????!
>  Home fax:   (613-9) 720-1487
>  ------------------------------------------------------------------------------

Stack underflow.    very good.
 
 
 

Interface MAC address SunOS 4.1.3

Post by Phyllis Smi » Sat, 23 Mar 1996 04:00:00



>Dear Sun experts,
>I need your help on this one, it's really weird:

Not an expert, but try setting (from the OK prompt)
setenv diag-switch? false
then tell the system to boot.

If this doesn't help, your problem is probably worse than just the
battery dieing.

Remember that now that your nvram is dead, you will have to reset this
and any other variables you care about each time the power goes off.

Mark Hendersons' NVRAM FAQ is excellent for getting the NVRAM replaced
and back up and running.

Phyllis Smith

Computersmiths
    (719) 635-7215
fax (719) 635-7212

 
 
 

Interface MAC address SunOS 4.1.3

Post by Brian Cunningh » Sun, 07 Apr 1996 04:00:00



>Path:
> altus.speednet.com.au!news.mel.aone.net.au!inferno.mpx.com.au!goliath.apana.or
>g.au!news.cs.su.oz.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.reston.
>ans.net!psinntp!psinntp!psinntp!interramp.com!usenet

>Newsgroups:
> comp.unix.questions,comp.unix.bsd,comp.unix.internals,comp.sys.sun.apps,alt.un
>ix.wizards,can.sun-stroke,alt.sys.sun
>Subject: Re: Dead Sparc 2
>Date: Fri, 22 Mar 1996 04:27:18 GMT
>Organization: Computersmiths
>Lines: 27




>NNTP-Posting-Host: 38.11.232.125
>X-Newsreader: Forte Free Agent 1.0.82
>Xref: altus.speednet.com.au comp.unix.questions:74715 comp.unix.internals:9520
> comp.sys.sun.apps:12517 alt.unix.wizards:2557
>Status: N


>>Dear Sun experts,
>>I need your help on this one, it's really weird:

>Not an expert, but try setting (from the OK prompt)
>setenv diag-switch? false
>then tell the system to boot.

>If this doesn't help, your problem is probably worse than just the
>battery dieing.

>Remember that now that your nvram is dead, you will have to reset this
>and any other variables you care about each time the power goes off.

>Mark Hendersons' NVRAM FAQ is excellent for getting the NVRAM replaced
>and back up and running.

>Phyllis Smith

>Computersmiths
>    (719) 635-7215
>fax (719) 635-7212

Mark, your problem is that your NVRAM chip (IDPROM) has somehow become
corrupted. The only *real* fix for this (unless you know FORTH really well and
have a copy of the IDPROM editors guide) is to get this reburnt or purchase a
new one.

Don't forget however that merely reburning one to copy another will result in
duplicate MAC addresses *suddenly* being in existence ( a big no-no).

Any decent SMCC ASP or SunService Provider should be able to reburn or sell
you a new chip easily enough. I purchased one about 2 months ago for approx.
US$100.

Hope this helps,

Brian ...

----------

 ,/-v\  UNIX Specialist                 Phone  : +61 2 9901 6666
/     ) Household HFC                   Direct : +61 2 9901 6509
\/-^_/  33 Herbert St.,                 Fax    : +61 2 9906 5668
    o           St. Leonards, NSW, 2065.
                Australia
----------

 
 
 

Interface MAC address SunOS 4.1.3

Post by Mark C. Henders » Sun, 07 Apr 1996 04:00:00




>Mark, your problem is that your NVRAM chip (IDPROM) has somehow become
>corrupted. The only *real* fix for this (unless you know FORTH really well and
>have a copy of the IDPROM editors guide) is to get this reburnt or purchase a
>new one.

>Don't forget however that merely reburning one to copy another will result in
>duplicate MAC addresses *suddenly* being in existence ( a big no-no).

>Any decent SMCC ASP or SunService Provider should be able to reburn or sell
>you a new chip easily enough. I purchased one about 2 months ago for approx.
>US$100.

Why pay US$100 for a US$20 part?

One can pick up a M48T02 for about US$20, and then program a hostid
and ethernet address into it. You don't really need to know any FORTH
to do it.

For instructions see:
HTML version
ftp://ftp.wimsey.com/pub/crypto/sun-stuff/sun-nvram-hostid.faq.html
ftp://ftp.netcom.com/pub/he/henderso/sun-nvram-hostid.faq.html
http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html

Plain text
ftp://ftp.wimsey.com/pub/crypto/sun-stuff/sun-nvram-hostid.faq
ftp://ftp.netcom.com/pub/he/henderso/sun-nvram-hostid.faq
http://www.squirrel.com/squirrel/sun-nvram-hostid.faq
--

ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1  A1 2A 2A 06 4A D5 92 46
http://www.squirrel.com/squirrel/ - change-sun-hostid, unstrip for Solaris,
 computer security, TECO, FGMP, Sun NVRAM/hostid FAQ, Wimsey crypto archive

 
 
 

Interface MAC address SunOS 4.1.3

Post by Doug Hugh » Tue, 09 Apr 1996 04:00:00



|> >
|> >>Dear Sun experts,
|> >>I need your help on this one, it's really weird:
|> >
|> >Not an expert, but try setting (from the OK prompt)
|> >setenv diag-switch? false
|> >then tell the system to boot.
|> >
|> >If this doesn't help, your problem is probably worse than just the
|> >battery dieing.
|> >
|> >Remember that now that your nvram is dead, you will have to reset this
|> >and any other variables you care about each time the power goes off.
|> >
|> >Mark Hendersons' NVRAM FAQ is excellent for getting the NVRAM replaced
|> >and back up and running.
|> >
|> >
|> >Phyllis Smith

|> >
|> >Computersmiths
|> >    (719) 635-7215
|> >fax (719) 635-7212
|> >
|> >
|>
|> Mark, your problem is that your NVRAM chip (IDPROM) has somehow become
|> corrupted. The only *real* fix for this (unless you know FORTH really well and
|> have a copy of the IDPROM editors guide) is to get this reburnt or purchase a
|> new one.
|>
|> Don't forget however that merely reburning one to copy another will result in
|> duplicate MAC addresses *suddenly* being in existence ( a big no-no).
|>
|> Any decent SMCC ASP or SunService Provider should be able to reburn or sell
|> you a new chip easily enough. I purchased one about 2 months ago for approx.
|> US$100.
|>
|> Hope this helps,
|>
|> Brian ...
|>

It depends on which chip has gone bad. If it's the battery backed up one,
(the fat thick one), then you should just need a new battery. If it's
the PROM, you just have to have a prom burner and copy a good one to
the bad one. We've done this to upgrade all our pre 1.2 bootproms that
did not support security mode. Now all our 1's and 1+'s that didn't
have a security mode feature do!  The hostid, MAC address, and other
save information is stored in the battery backed up one. The boot information,
forth interface, and low level command configuration is stored in the
normal PROM, (which you should be able to buy from electronics firms
like Jameco)

 I just wanted to clarify this. We've saved a bundle just by copying
a newer PROM over older ones after blanking them with UV light.

--
____________________________________________________________________________
Doug Hughes                                     Engineering Network Services
System/Net Admin                                Auburn University

 
 
 

Interface MAC address SunOS 4.1.3

Post by Mark C. Henders » Tue, 09 Apr 1996 04:00:00




>It depends on which chip has gone bad. If it's the battery backed up one,
>(the fat thick one), then you should just need a new battery.

Installing a new battery into a MK48T02 is a tricky procedure.
Carving into chips with a knife just isn't a whole lot of fun and it
isn't worth the trouble when a new NVRAM chip runs US$20.

--

ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1  A1 2A 2A 06 4A D5 92 46
http://www.squirrel.com/squirrel/ - change-sun-hostid, unstrip for Solaris,
 computer security, TECO, FGMP, Sun NVRAM/hostid FAQ, Wimsey crypto archive

 
 
 

Interface MAC address SunOS 4.1.3

Post by Bob Garnet » Fri, 12 Apr 1996 04:00:00


You might want to try holding L1 key and the N key down while
you power on the sparc2. This will force the NVRAM to be set to
factory defaults.
If the battery is dead the system should still boot up but you
should see an ethernet address of ff:ff:ff:ff:ff. and the date
will be wrong.

                      bob garnett
                      Sun Microsystems , SSE

 
 
 

1. Command for assigning IPv6 address and MAC address on the interface

Hello,

iceman a crit :

man ifconfig
man 8 ip

Please can you elaborate ? How do you see it does not work ?

Yes, it works for me. You can also assign an IPv6 address with the 'ip'
command from the iproute/iproute2 package :

ip -6 address add 2001:0db8:0:f101::1/64 dev eth0

Note that the 2001:0db8::/32 range is to be used for documentation
purpose only. If you do not have a global prefix you can create and use
a prefix in the unique local address range (ULA, cf. RFC 4193). A
generator is available at <http://www.kame.net/~suz/gen-ula.html>.

2. Question: Running Apache SSL and Apache non-SSL on one server

3. Change MAC address without down interface

4. Mail encryption

5. vif-1.11 released (multiple IP addresses per interface for SunOS, HP-UX, Ultrix)

6. Why ppp1 instead of ppp0

7. MAC address for each interface

8. WTB: Solstice RAID software for Solaris v2.5.x

9. Interface hardware address on SunOS 4.1.3

10. How assign MAC address to logical interface hme0:1?

11. getting interface mac address

12. changing mac-address (2 hme interfaces)

13. MAC-Address of my interface?