0

I connected a raspberry pi 0 to a raspberry pi 4b+ via USB and i would like to know how can i share the internet connection. The pi4 is connected to the internet via the ethernet port. P.S.: I did all the configuration needed for the pi0 (loaded dwc2, gether and the rest), also both pi run lattest version of raspbian

0

This is how I achieved it:


on the pi4

to /etc/dhcpcd.conf [before the first line that starts with interface or to the end of the file, if no such lines exists]

denyinterfaces eth0 usb0

to the end of the file, add

interface br0

create the following files in /etc/systemd/network - note, the names of the files are unimportant, the important thing is the extension (.netdev/.network) and the content

bridge-br0.netdev

[NetDev]
Name=br0
Kind=bridge

br0-member-eth0.network

[Match]
Name=eth0

[Network]
Bridge=br0

br0-member-usb0.network

[Match]
Name=usb0

[Network]
Bridge=br0

enable systemd-networkd

systemctl enable systemd-networkd

Thats it for the pi4


on the pi 0

add the following the end of /etc/dhcpcd.conf

interface usb0

Though, I've done the following (as fallback in case DHCP fails)

profile static_usb0
static ip_address=192.168.1.122/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface usb0
fallback static_usb0

Obviously, you'd need to use your own local ip address, router and dns address as required

2
  • i tryed this 2 times , one time i couldnt connect my pi4 to the internet, and the other one i got the pi 0 connected to the internet, but the pi 4 could connect again
    – F G B
    May 31 '21 at 15:57
  • Not sure what part you did wrong then - works great for me Jun 1 '21 at 6:49

Your Answer

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

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