1

I am running Raspbian Stretch Lite

Linux testpi1 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l GNU/Linux

I am able to SSH to my pi zero over the OTG USB cable as many guides online have detailed however I am trying to have 2 pi zeroes connected to each other so that they can transfer files without having a wifi connection. I have tried setting up an interface on each pi by creating a file in /etc/network/interfaces.d/usbinterface

auto usb0
allow-hotplug usb0
iface usb0 inet static
    address 192.168.42.42
    netmask 255.255.255.0
    network 192.168.42.0
    broadcast 192.168.42.255
    gateway 192.168.42.1

and the other pi:

auto usb0
allow-hotplug usb0
iface usb0 inet static
    address 192.168.42.43
    netmask 255.255.255.0
    network 192.168.42.0
    broadcast 192.168.42.255
    gateway 192.168.42.1

The pi's will obtain static IPs on the usb0 interface however I am unable to ssh from one to the other.

I have a feeling I have to setup the routing table to make this work however I am not sure how to set it up. A simple sudo route add default usb0 did not work.

Edit:

I've modified my config to :

auto usb0
allow-hotplug usb0
iface usb0 inet static
    address 169.254.42.43
    netmask 255.255.0.0

and 169.254.42.42 for the other pi.

Now my route table looks correct but I still cannot ssh from one to the other.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    303    0        0 wlan0
link-local      0.0.0.0         255.255.0.0     U     0      0        0 usb0
192.168.0.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0
  • 2
    gateway 192.168.42.1 If your Zeros are connected directly then this IP address is probably invalid. BTW on Raspbian Stretch the norm is to use /etc/dhcpcd.conf for settings. There should be no need to use /etc/network/interfaces. broadcast and network are also unnecessary. – Dirk May 15 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.