5

I'm trying to connect to my Raspberry Pi Zero over USB. The steps I followed are:

  1. Added dtoverlay=dwc2 to config.txt at boot partition
  2. Added modules-load=dwc2,g_ether after rootwait to cmdline.txt at boot partition
  3. Connected my rpi to my computer through the micro-usb data port.

This results in network manager from my computer creating a new wired connection, which implies a new network interface with an IPv6 assigned ip.

avahi-daemon is up and running, but something is failing. My wired connection disconnects and reconnects all the time.

avahi-browse returns something like:

+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
- enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
- enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
- enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
- enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
- enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local
+ enp0s26u1u1 IPv6 raspberrypi [12:81:40:9a:91:66]               Workstation          local

A quick fix I found for the disconnections is to go to IPv6 Settings from my wired connection and select Link-Local Only as method. Later, to connect to my pi, I ping the whole network to retrieve its IPv6 address $ ping6 -I enp0s26u1u1 ff02::1. Finally I connect through ssh to the IP I just discovered $ ssh -6 pi@fe80::fa1a:6601:e3a1:4a31%enp0s26u1u1.

Inside the raspberry pi, running $ ip a s shows that the rpi has an IPv4 address! So know that I know the network, I can assign an IPv4 address to my workstation.

The problem is that I have to repeat, all this steps each time I connect/disconnect the USB from the rpi.

I was wondering if someone knows how to avoid repeating all the process, because obviously something is failing.

Thanks!

1
  • Does either machine (Ubuntu or Pi) show a reason for the disconnect? I too had a lot of difficulty getting Ethernet connectivity between my Pi Zero and a Ubuntu laptop. I was able to get the Pi zero to automatically assign an Automatic Private IP address (APIPA-169.254.0.0/16) address by putting iface usb0 inet dhcp into /etc/network/interfaces on the Pi 0 and then un-commenting the timeout in /etc/dhcp/dhclient.conf. However, I had to configure a static IP address on the network interface created in Ubuntu for the Pi enp0s29u1u2 to get a reliable connection. May 8, 2017 at 20:06

1 Answer 1

6

Open the Edit Connections dialog, edit your wired connection x on your Ubuntu machine (16.04LTS here) and in the tab IPv4-settings set Method to Link-Local Only

That will make a reliable connection, and you can ssh afterward

ssh [email protected]

The first time I could easily connect wit ssh, but the pi zero itself had no internet access. I disconnected and connected again and afterwards the pi had internet access so I could apt update the pi, without changing anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.