skypi
Posts: 111
Joined: Sat Aug 09, 2014 11:48 pm

gadget mode ethernet - the mac address

Tue Dec 18, 2018 12:46 am

gadget mode ethernet - the mac address

so if designing a product and want only method of update to be plug in via usb on a zero-w based device otherwise operating in ap mode (don't want to mess with knowledge of client-to-host wifi password and implications)

but to get gadget mode working always providing same mac to host so it always uses the network connection settings you have set a fixed mac address twice on pi (the one the usb port pi plugs into's root mac and the pi's root mac)

is there a raspberry pi mac address that could be used that would be like still trusted! like a kind of trusted untrusted mac address that first N bytes identify as raspberry pi, rest are like pi-product address space...

or even better a method of assigning a full mac address to a generic multiple instance product????

one of those ironies, start logging things with paranoia, start worrying about things you do not recognise/remember you did eh!

like asking someone to set up a new network connection everytime the otg auto mac generation sets up and leave N connection settings on host machine is like... well an interesting problem, at what level of (customer) skill does someoene realise what is going on? and why? and who? and where? and when? etc. and even whether to worry about eh LOL!

User avatar
HawaiianPi
Posts: 4616
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: gadget mode ethernet - the mac address

Tue Dec 18, 2018 2:58 am

Run the following command on your Pi Zero USB Gadget once, and it will have a stable MAC address after the next boot.

Code: Select all

echo 'options g_ether host_addr='$(dmesg | awk '/: HOST MAC/{print $NF}')' dev_addr='$(dmesg | awk '/: MAC/{print $NF}') | sudo tee /etc/modprobe.d/g_ether.conf


And here's another option suggested in a previous thread.
tweak42 wrote:
Sat Jan 21, 2017 4:22 am
You can also pass the kernel parameters for static MAC addresses to the g_ether module in the cmdline.txt
I prefer this method because it's on the FAT boot partition and easily added when enabling gadget mode.

Code: Select all

modules-load=dwc2,g_ether g_ether.host_addr=00:22:82:ff:ff:20 g_ether.dev_addr=00:22:82:ff:ff:22
g_ether.dev_addr is the Pi Zero interface.
g_ether.host_addr is the host PC interface.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “General discussion”