Disable (?) NM random mac for shared XO wifi - USB0 / Chrome/ Pi Zero

Carrol Riddle ebox382 at scishare.com
Fri Jul 20 23:20:57 EDT 2018


The difficulty is that a new connection is started on each boot and starts as "automatic" IPv4 instead of the desired "share with other computers" This results from a randomized MAC address, which appears to be controlled by Network Manager. If the MAC address persists on next boot,
then the connection file will persist.

The MAC address in the cmdline.txt on Zero is vestige of efforts. It was left since I suspect it will be part of the solution. Retested without and it makes no difference when no other changes are made (i.e., only with essentials in cmdline.txt). I have tried static IP on Zero via adding ip=192.168.1.2 to cmdline.txt or in dhcpcd.config and udev rule on XO for ip=198.168.1.1  .  Uncertain if udev rule needs additional specification (parent ATTRS ?).

Reasoned that host_addr was telling Zero where to find existing MAC on XO and udev rule then tried with hw to assure it was there.  Have tried adding mac-cloned-address to NetworkManager.conf 

NetworkManager randomization of MAC addresses is widely discussed in search results and variety of solutions proposed.  I have had periods where MAC was persistent, but only have it fail a few hours later (just powered off). One case of oddity was the persistence on every other boot, if the intervening boot was without Zero attached.  However, my work with wired links to routers (TP-Link MR3020 and Village Telco MP20) shows persistence in boot of router.  

A competent programmer might just modify the started connection file (using awk, grep, sed ?) and restart NetworkManager.   :)  .  I tried replacing (cp) with model files, but that has problems (date stamp).   /etc/NetworkManger/connections 

What I see points me to NetworkManager,

Carrol Riddle
  
> On July 14, 2018 at 1:07 AM James Cameron <quozl at laptop.org> wrote:
> 
> 
> Interesting.
> 
> But why do you need to give a MAC address on cmdline.txt on the RPi
> and in the XO udev script?  g_ether should assign an address, and
> cdc_ether should receive it from USB descriptors.
> 
> On Tue, Jul 10, 2018 at 10:50:44AM -0400, Carrol Riddle wrote:
> > Soliciting info or pointers to resources for disabling mac address randomization by NetworkManager for USB0 (eth1) on XO's.  Wifi mac addresses are not randomized.
> > 
> > An XO can share its Wifi over wired ethernet link (USB0) where it can be used by
> > a Chromium browser on a linked Raspberry Pi Zero (not W).  SSH -X on the link
> > allows XO keyboard and display to be used for Chromium.
> > 
> > The several setup steps are simple, but must be repeated with each boot since
> > NetworkManager (version 0.9.8.* on XO's) supplies a different mac address for
> > the link on each boot.  To provide a simple Sugar wrapper to run Chromium, a
> > consistent mac address would be needed.
> > 
> > Methods from web searches have not been successful in disabling randomization, 
> > largely since they use features added after 0.9.8.   Using a udev rule to "ifconfig
> > usb0 hw ether address" has come the closest, but breaks after a few boots and returns to
> > randomization.
> > 
> > BACKGROUND
> > 
> > For those interested, details are below, but are only peripheral to question.  This use of the XO's display, keyboard and wifi by Chromium / Zero provides a low cost way to access a widely accepted browser. The Zero can be plugged into XO USB for power and signals. The Zero is
> > available for < $10, and with SD card and plug, total cost should be $15 - 20
> > USD. 
> > 
> > 
> > ______________________________________
> > 
> > 
> > MANUAL METHOD - XO (after Pi Zero setup)
> > 
> > In Sugar, connect to wifi . This needs to be done only the first time and is
> > persistent between boots.  Switch to Gnome and disconnect from the "Wired
> > connection ?" that just formed. Edit the connection :  IPv6 to ignore, IPv4 to
> > require IPv4 and "shared to other computers"   and save.  Connect to this
> > connection.  The connection info should show ip address starting with 10:  .
> > This link is not persistent between boots.
> > 
> > systemctl enable sshd.service
> > 
> > PI ZERO SETUP (prior)
> > 
> > Raspberry Pi Zero with Raspbian Desktop installed.  To   /boot/config.txt on  Pi
> > SD edit and add dtoverlay=dwc2 .  To /boot/cmdline.txt add after "rootwait"
> >  modules-load=dwc2,g_ether host_addr=00:22:82:ff:ff:20 dev_addr=00:22:82:ff:ff:22          (Substitute local mac addresses.)   To start with SSH, add dummy "ssh" file to /boot directory.  On XO, ssh pi at raspberrypi.local with password raspberry   .   Configure Zero to boot to
> > command line (CLI) with raspi-config  .  To use Raspbian desktop,  ssh -X
> > pi at raspberry.local, and then /etc/X11/Xsession.  The Pi Tool Bar partially
> > overlaps the Gnome Tool Bar, but selecting "medium display size" minimizes
> > affects.
> > 
> > UDEV INFO FOR RULES  (but not able to make work)
> > 
> > DRIVERS=="cdc_ether"
> > 
> > ATTRS{idVendor=1d6b}
> > 
> > ATTRS{idProduct=0001}
> > 
> > RUN+="/etc/udev/scripts/rpi"
> > 
> > 
> > Script rpi:
> > 
> > ifconfig usb0 down
> > 
> > ifconfig usb0 hw ether 00:22:82:FF:FF:20
> > 
> > ifconfig usb0 up
> > 
> > _____________________________
> > 
> > Carrol Riddle
> > 
> > ebox382 at scishare.com
> > _______________________________________________
> > Devel mailing list
> > Devel at lists.laptop.org
> > http://lists.laptop.org/listinfo/devel
> 
> -- 
> James Cameron
> http://quozl.netrek.org/
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel


More information about the Devel mailing list