- 论坛徽章:
- 0
|
今日,偶然得到一个文档,讲述怎样修改MAC地址。
摘录了一些内容如下,主要是通过mkp命令修改IDPROM的设置:
General sun4c, sun4m, sun4d, sun4u IDPROM Programming
If you have a valid NVRAM chip installed (IDPROM is ok) then before doing anything else, write down a copy of the IDPROM information. You can get it under Sun OS 4.1.x by running /usr/etc/devinfo -vp or under Solaris 2.x by executing /usr/sbin/prtconf -vp. Alternatively you can get the IDPROM information at the OpenBoot monitor "ok" prompt by typing the command .idprom (yes the "." is part of the command). You'll need this information if the NVRAM gets screwed up and you need to try and back out.
Step 1.
Go to the OpenBoot monitor (ok prompt). You can do this by turning on your machine, pressing L1/Stop-A to interrupt the boot sequence, and entering "new command mode". Alternatively, if your machine is running, just shut down your operating system.
If you are installing a new NVRAM type set-defaults followed by the <Enter>; key and then setenv diag-switch? false followed by the <Enter>; key.
Generally a machine will reset the NVRAM to the default values (excluding the IDPROM information) when it detects a new NVRAM. Still, it is good to do a set-defaults just in case this fails.
Step 2.
The command to reprogram the IDPROM part of NVRAM is "mkp". The format for the command is
<value>; <location>; mkp
where location is read off the following table (all values are in hexadecimal). Note that some Sun clones (e.g. Tatung COMPstation 25 with TWS boot PROM REV 1.7) don't have an "mkp" command. If "mkp" doesn't work on your system, see the section below entitled Other more arcane methods for modifying the IDPROM.
byte(s) contents
0 always 01 - format/version number
1 first byte of hostid (machine type)
2-7 6 byte ethernet address (first three bytes should be 08,00,20)
8-b date of manufacture (usually all 0s, doesn't really matter)
c second byte of hostid
d third byte of hostid
e fourth byte of hostid
f IDPROM checksum - bitwise xor of bytes 0-e
As mentioned above, you can look at the complete idprom by executing .idprom. Bytes c through e in the table above are collectively referred to as the serial number. If you convert the concatenation of bytes c-e to decimal, this is the serial number you see when you turn the machine on.
Alternatively, you can use the idprom@ command to get a particular byte from the IDPROM
<location>; idprom@
returns the IDPROM value of byte <location>;
so
<location>; idprom@ .
prints the IDPROM value of byte <location>; because . is the FORTH command to print the value on the bottom of the stack.
Now make the changes using mkp. Be very careful and be sure to compute the checksum after making changes. If you don't, you'll get nasty warnings about an incorrect IDPROM checksum on boot. A quick and dirty way to compute and store the checksum in location f is to execute the following at the "ok" prompt _after_ you have made your changes to locations 0-e.
0 f 0 do i idprom@ xor loop f mkp
Don't change the first byte of the hostid to something that doesn't correspond to your system type (see table below). Similarly, the first three bytes of the ethernet address should be (08,00,20). The first byte of the hostid is often used to determine the architecture when booting from CDROM on some Sun models. If you don't set the first three bytes of the ethernet address to 08,00,20 you might get message which says that you have a defective motherboard (but then I don't know of any other consequences of changing this to some reasonable value, especially avoid ff:ff:ff:ff:ff:ff !. On some systems you can get away with changing the first three bytes of the ethernet address to more or less anything you want).
If you'd rather not use the table below, you can find out what you should make the first byte of the hostid by typing real-machine-type . at the "ok" prompt. Note that real-machine-type may not be defined on some machines with older boot proms.
e.g. modify the hostid of an IPX to be 57c0ffee and the ethernet address to be 08:00:20:c0:ff:ee. At the OpenBoot monitor prompt (ok)
1 0 mkp
real-machine-type 1 mkp
8 2 mkp
0 3 mkp
20 4 mkp
c0 5 mkp
ff 6 mkp
ee 7 mkp
0 8 mkp
0 9 mkp
0 a mkp
0 b mkp
c0 c mkp
ff d mkp
ee e mkp
0 f 0 do i idprom@ xor loop f mkp
Step 3.
If you are on an SS1000, type update-system-idprom at the OpenBoot PROM "ok" prompt.
For any of the above machines, now type reset at the ok prompt. Your machine should then attempt to reboot with your new hostid/enet addr. |
|