I have Raspberry Pi 3 (running Raspbian) and Raspberry Pi Zero (DietPi). The Raspberry Pi 3 is connected to ethernet. The Raspberry Pi Zero is set as Ethernet gadget (according to this https://dietpi.com/phpbb/viewtopic.php?f=9&t=1589&p=6639#p6639) and connected to the RPi3 via USB.
The Raspberry Pi 3 detects it as usb0. I've set static IP using the GUI.
The image:
ifconfig
from RPi3:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.10.46 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fe80::dc28:3374:b490:2a12 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:77:af:2e txqueuelen 1000 (Ethernet)
RX packets 13924 bytes 937061 (915.0 KiB)
RX errors 0 dropped 223 overruns 0 frame 0
TX packets 2621 bytes 1384168 (1.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.7.1 netmask 255.255.255.0 broadcast 192.168.7.255
inet6 fe80::8e2e:c0ad:d6f1:e985 prefixlen 64 scopeid 0x20<link>
ether aa:5f:b5:24:dc:bc txqueuelen 1000 (Ethernet)
RX packets 126 bytes 14905 (14.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 365 bytes 95162 (92.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ip a
from RPi0:
2: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 02:31:20:c9:dc:bd brd ff:ff:ff:ff:ff:ff
inet 192.168.7.2/24 brd 192.168.7.255 scope global usb0
valid_lft forever preferred_lft forever
inet6 fe80::31:20ff:fec9:dcbd/64 scope link
valid_lft forever preferred_lft forever
How do I forward the internet from RPi3 to the RPi0? I've tried the script (edited to match my options) from: Sharing the Pi's WiFi connection through the Ethernet port
But that didn't work. ping google.com
resulted in ping: google.com: Temporary failure in name resolution
. I've tried adding dns to the resolv.conf
on the Pi0, but also didn't work.
Thank you.
ip route
to your question. – Ingo Feb 22 '19 at 13:25