How to fix random MAC addresses at USB?

asked 2019-09-27 21:21:06 +0200

iourine gravatar image

updated 2019-09-28 12:29:38 +0200

Nearly (!) every time when I connect my Jolla to the PC over USB (in tethering mode), it generates new MAC addresses for both sides. SFOS 3.1.0.11. More specifically, journalctl says that

  • Sailfish kernel provides a random MAC address;

  • Sailfish kernel provides the Host MAC address specified in /etc/modprobe.d/g_ether.conf .

The provided MAC address is the one finally assigned to rndis0. The provided Host MAC address has no effect and appears to be replaced by another random address which finally appears on the PC interface. The consequences are:

  • At the host, the existing record for Jolla connection is no longer used, and a new one is created.

  • iptables rules appear not to work, despite being present. In particular, DHCP traffic is dropped, thus I have to set the IP address manually at the PC.

  • Also due to iptables, tethering over USB does not work until the masquerading rule is re-created manually.

Thus,

  1. Why does it happen? (And does NOT in some cases; e.g. it seems not to happen if Jolla is rebooted while staying connected to the PC, and also in some other cases that I haven't figured yet.)
  2. What are the reasons for using such behavior rather than permanent addresses?
  3. How to fix the address and make iptables working again?
edit retag flag offensive close delete