I've been trying to configure my Pi-3b+ and Pi-Zero to share a network connection for about a week now without success. Can anyone tell me how to configure the two pi's to enable the following network?
Pi-3B+ wired ┌─────bridge─────┐ wired wan Pi-Zero <-------> |(usb0) br0 (eth0)| <-------> router <-----> internet \ | / DHCP-server (dhcp) (dhcp) 192.168.0.1
Pi-Zero Current Configuration
The Pi Zero is properly configured as a USB OTG Gadget using this guide and I've been able to SSH into it from my Windows PC when plugged into the Windows PC. I've edited it's dhcpcd.conf file to give it a static IP of 192.168.7.2 (this would need to change, I assume).
Pi-3B+ Current Configuration
The Pi-3B+ is currently set up to use DHCP and gets it's IP from the router. The router uses the eth0 MAC address to set this IP. The Pi can see the usb0 interface and eth0 interfaces just fine:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.27 netmask 255.255.255.0 broadcast 192.168.0.255 ether ab:cd:ef:gh:ij:kl txqueuelen 1000 (Ethernet) RX packets 1334182 bytes 686391055 (654.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1441095 bytes 1126857152 (1.0 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether ab:cd:ef:gh:ij:kl txqueuelen 1000 (Ethernet) RX packets 26756 bytes 752390 (734.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Attempted Steps I've tried to follow this guide as well and here's where I ran into problems. So far I've run the following commands:
brctl addbr br0 brctl addif br0 usb0 <<<<<<< This errors out and says it is not possible to add this interface brctl addif br0 eth0 <<<<<<<< This kills my SSH connection entirely
My hunch is that the bridge has it's own MAC address and the router doesn't recognize it so it assigns a new IP. However I can't seem to find the Pi at all on the network once I run this command.
Any advice or suggestions on how to properly do this? Do I need to configure /etc/network/interfaces first? I'm very wary of this setup process since these Pi's are headless and a real pain to recover from any mis-configuration that knocks out SSH. Thanks!
Edited again Ok so I realized part of the problem was with a conflict between dhcpcd and the /etc/network/interfaces file
Here's my new configuration which boots but still doesn't assign an IP to the pi zero
auto br0 iface br0 inet manual bridge_ports usb0 eth0
... denyinterfaces eth0 usb0 profile static_br0 static ip_address=192.168.0.27/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1 126.96.36.199 188.8.131.52 interface br0 fallback static_br0