Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1

    Multiple piCorePlayer on RPI with USB Ethernet adapter, all with same MAC address

    Hi,
    all is in the title : I'm trying to build an network of pcp, each running on a RPI zero.

    These RPIs have no WiFi, so they have a USB to Ethernet adapter.

    The issue is that, each adapter has the same MAC address (!). After searching in forums this seems to be rather common with cheap adapters.
    This disturbs of course the Ethernet switch that connects all the RPIs.

    I managed to get the system to work, by adding on each RPI a command executed at boot time (in /opt/bootlocal.sh) which sets the adapter MAC address :
    sudo ifconfig eth0 hw ether NEW_MAC_ADDRESS

    The NEW_MAC_ADDRESS is different for each RPI.
    I've also put this command in the user commands (pcp menu, Tweaks/User commands).

    These tricks are not fully stable : sometimes I have to start a RPI twice, because at first boot the adapter gets its original MAC address and not the new one.
    I've also tried to set the MAC address from the 'Squeezelite Settings' in the pcp menu, but this doesn't change the address (maybe it's only for WiFi connection ?).

    I consider 2 options :
    - replace my adapters with standard compliant ones (so with a different MAC address for each adapter),
    - replace my Ethernet switch by a managed switch (seems that with a managed switch I could set the IP address of each connected device, from it's port number on the switch).
    But a software solution is preferred.

    Maybe my command (added in /opt/bootlocal.sh) is too late in the boot process.
    Any suggestion is welcome.

    Claude

  2. #2
    Senior Member
    Join Date
    Jan 2010
    Location
    Hertfordshire
    Posts
    7,254
    Quote Originally Posted by ClaudeBoulard View Post
    Hi,
    all is in the title : I'm trying to build an network of pcp, each running on a RPI zero.

    These RPIs have no WiFi, so they have a USB to Ethernet adapter.

    The issue is that, each adapter has the same MAC address (!). After searching in forums this seems to be rather common with cheap adapters.
    This disturbs of course the Ethernet switch that connects all the RPIs.

    I managed to get the system to work, by adding on each RPI a command executed at boot time (in /opt/bootlocal.sh) which sets the adapter MAC address :
    sudo ifconfig eth0 hw ether NEW_MAC_ADDRESS

    The NEW_MAC_ADDRESS is different for each RPI.
    I've also put this command in the user commands (pcp menu, Tweaks/User commands).

    These tricks are not fully stable : sometimes I have to start a RPI twice, because at first boot the adapter gets its original MAC address and not the new one.
    I've also tried to set the MAC address from the 'Squeezelite Settings' in the pcp menu, but this doesn't change the address (maybe it's only for WiFi connection ?).

    I consider 2 options :
    - replace my adapters with standard compliant ones (so with a different MAC address for each adapter),
    - replace my Ethernet switch by a managed switch (seems that with a managed switch I could set the IP address of each connected device, from it's port number on the switch).
    But a software solution is preferred.

    Maybe my command (added in /opt/bootlocal.sh) is too late in the boot process.
    Any suggestion is welcome.

    Claude
    There is an option in Squeezelite settings to set a new MAC address.
    Edit I see you have tried it but I assume it should work. Did you reboot after changing the MAC address?

    Sent from my Pixel 3a using Tapatalk
    Last edited by slartibartfast; 2021-05-28 at 15:13.

  3. #3
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    4,215
    The squeezelite option only changes how LMS recognizes the device(software) You have to change the hardware address at the driver level. More than likely, you have to change the address after the card is recognized by the kernel, but before the network is configured. At teh moment, I think the easiest way to handle that would be to use the static IP address option in pCP. This will create a file /opt/eth0.sh which will configure the static address. You should be able to edit that file to do your work. Make sure to backup changes when done. If you use the pCP interface to make changes to the static configuration later on, this file will get overwritten, so be aware of that.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  4. #4
    Hi all,
    Thanks for the advice.

    I'll try asap.

    Claude

  5. #5
    Quote Originally Posted by slartibartfast View Post
    There is an option in Squeezelite settings to set a new MAC address.
    Edit I see you have tried it but I assume it should work. Did you reboot after changing the MAC address?

    Sent from my Pixel 3a using Tapatalk
    Hello,
    Yes I've tried to reboot after the change, but with no luck.

  6. #6
    Senior Member
    Join Date
    Jan 2010
    Location
    Hertfordshire
    Posts
    7,254
    Quote Originally Posted by ClaudeBoulard View Post
    Hello,
    Yes I've tried to reboot after the change, but with no luck.
    I realised that wouldn't work after seeing the post after mine.

    Sent from my Pixel 3a using Tapatalk

  7. #7

    [Solved] piCorePlayer on RPI zero and USB Ethernet adapter

    Hi,
    Finally I made it work.

    I've added the following line in file /opt/bootlocal.sh

    ...
    /opt/eth0.sh
    #Added line :
    sudo ifconfig eth0 hw ether 11:22:33:44:55:66
    ...

    Replace '11:22:33:44:55:66' by the MAC address you want to be associated to your Ethernet adapter.
    Each MAC address must be unique on your network.

    The eth0.sh file was modified by the Picoreplayer app, when setting the IP address as static.
    After that I've not changed it manually. As mentioned in this post, a manual change on this file may be overwritten by a backup from Picoreplayer.

    After this modification, made on each RPI, each one has a different MAC address and its static IP address is correctly managed by the Ethernet switch.

    Hope this can help anyone in similar situation.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •