plipbox icon indicating copy to clipboard operation
plipbox copied to clipboard

Where to change the MAC address ?

Open salocinx opened this issue 7 years ago • 13 comments

Hello - I was looking through your sources, but did not find the line where the static MAC address is defined. Could you please point me to the correct line of code? I would be very thankful for a quick response. Thanks a lot!

salocinx avatar Mar 16 '17 10:03 salocinx

Actually, you can already change the MAC address via the SANA-II interface with S2_CONFIGINTERFACE from your TCP/IP stack.

Amiga side: device.c:228 server.c:501

AVR Side: param.c:46 bridge.c:82

cnvogelg avatar Mar 16 '17 18:03 cnvogelg

Could you please explain the procedure a little more detailed? Do I have to use S2_CONFIGINTERFACE as command in the Amiga Shell/CLI in order to change the MAC address? Is the newly configured MAC address afterwards persistently stored on the Arduino?

peterfalk27 avatar Oct 01 '17 16:10 peterfalk27

I would also be interested in this topic, because I have two Plipoxes and the DHCP fails to assign an IP address to both of them. I guess I need so change the MAC address somehow. Any ideas?

gerdovic avatar Oct 02 '17 20:10 gerdovic

I guess that S2_CONFIGINTERFACE is part of a C API. MiamiDX and Roadshow do implement it, compare to the Amiga installation guide here. Unfortunately I didn't found a possibility to change the MAC address by using AmiTCP or Genesis, is that correct?

salocinx avatar Oct 10 '17 13:10 salocinx

Correct, the S2_CONFIGINTERFACE is the SANA II C API for a network driver to accept a MAC address. AmiTCP indeed does not seem to support it. At least a quick scan through the 3.0b2 source code does lead to this assumption.

However, you can alter the mac address via a serial terminal directly at your plipbox device. With the m 00:11:22:33:44:55 command you set the new address and with psyou store it in EEPROM.

See the manual for details.

cnvogelg avatar Oct 10 '17 19:10 cnvogelg

Thanks for your answer. In your intro.md you write the following:

It has to have the same value as it is used in the plipbox.device driver. The address will be automatically transferred by the driver to the firmware on startup. By default both use the mac address 1a:11:a1:a0:47:11.

Isn't the MAC address overwritten again by the plipbox.device on startup if the MAC address is changed on the Arduino only?

salocinx avatar Oct 11 '17 11:10 salocinx

I can confirm AmiTCP 3 changes the mac address back to the default despite changing the mac address on the plipbox and saving to NV ram, and confirming the change was saved by unplugging and reconnecting to plipbox. This makes the m command basically useless on an Amiga.

David-Zvekic avatar Oct 22 '17 11:10 David-Zvekic

I found a TCPIP Stack agnostic solution. Use a HEX editor on plipbox.device. I used FileX-68K available on aminet - did a hex search (i.e. unclicked the "string search" button), searched for 1A11AFA04711 and replaced it with 1A11AFA04712 and now my A1200 has a MAC address of 1a:11:Af:A0:47:12 and my A1000 has the default, and both plipboxes exist happily on the same network.

David-Zvekic avatar Oct 22 '17 20:10 David-Zvekic

Thanks for sharing! Works very fine after rebooting the Amiga.

salocinx avatar Oct 23 '17 07:10 salocinx

No need to hex edit the driver.

All TCP/IP stacks on the Amiga has the functionality to specify/override the default MAC address stored on the card.

For example in Roadshow you use the hardwareaddress parameter in the NetInterfaces/Plipbox file and in AmiTCP you use the ADDRESS parameter for the plipbox line in AmiTCP:db/interfaces file.

The Roadshow part is already detailed in the documentation: https://github.com/cnvogelg/plipbox/blob/master/doc/src/amiga.md#25-roadshow

patrikaxelsson avatar Dec 28 '22 11:12 patrikaxelsson

All TCP/IP stacks on the Amiga has the functionality to specify/override the default MAC address stored on the card.

Scratch AmiTCP3.0b2 from that statement 😓. The ADDRESS parameter feature to set the MAC address was added in AmiTCP4.0.

patrikaxelsson avatar Dec 28 '22 12:12 patrikaxelsson

My guess is that the Sana-II specs provide the interface to change the MAC adress, but the question is if the plipbox.device driver implements this interface 🤔 Not sure about this, maybe Christian can answer.

salocinx avatar Dec 28 '22 19:12 salocinx

It works fine when I test it with Roadshow at least. The MAC address change is visible in the serial terminal if you are in verbose mode: 000014.4846 pio: init: enc28j60: ok! mac=1A:11:AF:A0:47:33 flags=04 rev=07

The funny thing is that this new MAC address is saved in the plipbox - if I cut the power and restart it, it will print the new address at the welcome message:

Welcome to plipbox 0.6 20190105
by lallafa (http://www.lallafa.de/blog)

m: mac address   1A:11:AF:A0:47:33

fd: full duplex  00
fc: flow control 00

tl: packet len   05EA
tt: packet type  FFFD
ti: ip address   192.168.002.222
tp: udp port     1A90
tm: test mode    00

Press <return> to enter command mode or <?> for key help
free stack:010E

However, if plipbox.device is used without the hardwareaddress override, it will revert back to the default :11 address, so its like plipbox.device does not care which address is saved in the plipbox, which it reasonably should - it would have been a highly useful feature to be able keep the MAC-address in the plipbox, like it is on a normal network card.

The MAC address can also be saved in the plipbox via the command mode as mentioned above:

  1. enter
  2. m xx:yy:zz:gg:hh:ii
  3. ps

However, as plipbox.device does not care about what is saved, it is not useful.

patrikaxelsson avatar Dec 28 '22 20:12 patrikaxelsson