Pi Zero Connectivity (g_ether)

I have a PiZero which I want to perform a couple of minor network functions that the UTM doesn't seem to handle (TFTP server and VPN client for instance).

I have therefore built a Jessie Minimal installation and enabled the g_ether module - When I connect to my mac it tries to DHCP, but self allocates (as does the mac) and then I can ssh to raspberry.local (bonjour working well).

When I connect it to my UTM then I get the following from dmesg:

[800929.144047] usb 1-2: new high-speed USB device number 5 using ehci-pci

[800929.500052] usb 2-2: new full-speed USB device number 2 using uhci_hcd

[800930.296056] usb 1-2: new high-speed USB device number 6 using ehci-pci

[800930.429119] usb 1-2: New USB device found, idVendor=0525, idProduct=a4a2

[800930.429127] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[800930.429132] usb 1-2: Product: RNDIS/Ethernet Gadget

[800930.429137] usb 1-2: Manufacturer: Linux 4.4.11+ with 20980000.usb

[800930.913443] cdc_ether 1-2:1.0 usb0: register 'cdc_ether' at usb-0000:00:1d.7-2, CDC Ethernet Device, 2e:e1:ac:a4:37:21

[800930.913497] usbcore: registered new interface driver cdc_ether

All of which looks quite hopeful. I also get the following interface under ip addr:

10: usb0: mtu 1500 qdisc noop state DOWN group default qlen 1000

   link/ether 2e:e1:ac:a4:37:21 brd ff:ff:ff:ff:ff:ff

Which *also* looks hopeful... However in the UI - nothing, not a sausage. It offers me the other unused NICs, but not the USB one.

Do I have to go native, or can I encourage it to appear in the UI somehow...

If I have to go native on it - is there a recognised way of making my changes persistent?

  • Hmm - On the off chance it required boot time detection I rebooted the UTM.

    Still nothing, although it is well initialised in dmesg - at the same time as the others (so the pi boots faster than UTM, which is a good start)

    Relevant extract from the output of lshw -C network (note that I have allocated a link local address manually to try and find the Pi):


           description: Ethernet interface

           physical id: 1

           logical name: usb0

           serial: 2e:e1:ac:a4:37:21

           capabilities: ethernet physical

           configuration: broadcast=yes driver=cdc_ether driverversion=22-Aug-2005 firmware=CDC Ethernet Device ip= link=yes multicast=yes

  • In reply to JohnRobson:

    OK - Good news - It works, sorta...

    I've fixed the IP of the PiZero into a locally unused RFC1918 range, and configured the usb0 interface on the command line:

    ip link set usb0 up

    ip addr add dev usb0

    I've then headed over to the firewall section and added a host 'RasPiZero' with this IP address, and allowed traffic.

    This all seems to 'just work' - I can SSH into the box from my internal network etc.

    I have an issue with DNS on the PiZero, but I think that is unrelated (not even sending queries)

    Yep - the errors were mine.

  • In reply to JohnRobson:

    The Pi works fine.

    The connectivity is good, but...

    Without the UI support the usb0 interface isn't initialised automatically, and doesn't show up on the UI - so I'm not configuring DHCP or anything on it (which would be useful)

    However once I added the IP address as a fixed host in the UI the firewall rules are behaving properly.

    Installed tftpd-hpa and downloaded the Debian netbook files to test - all works.

    I've added the TFTP helper on the UTM and set the next-server and filename options in the DHCP config...  And bingo.

    I have net booting working - for ~£6 over the cost of the UTM.  

    So this is purely a UI issue - which is really frustrating!

  • In reply to JohnRobson:

    OK - excellent news.

    I now have the PiZero showing in the interface as Eth9!

    The following lines added to the end of /etc/udev/rules.d/70-persistent-net.rules has given the interface an 'eth' name:

    # USB - RasPi connection

    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="<Mac address of usb0>", NAME="eth9"

    And with an eth name, comes an entry as an Ethernet interface on the UI.


    So - for about £6 you can add a small server to your network - really useful for home networks where the UTM may well be the only box which is permanently powered normally...




    Note that the persistent rules file has the following comment at the top:

    # This file was automatically generated by the Astaro Installer, then

    # possibly later on written by the /lib/udev/write_net_rules generator

    # script.


    # You can modify it, as long as you keep each rule on a single line.