0

I connected my Pi Zero to my PC ( Linux LMDE 3 Cindy) via USB port successfully, SO i want to connect to internet via my laptop which is connected to internet by its WIFI.

I found this instruction or this question via raspberrypi.stackexchange but those are working for window or MAC OS,but i don't find it for Linux!!!!

SO i need the similar instruction for enabling sharing my internet via USB enp0s20f0u1 device (PI Zero) in Linux. for example in windows we need to :

In the WiFi Properties window, click on the “Sharing” tab : similar to this photo:

WiFi internet sharing

I use this code to have one specific IP for my USB Ethernet (enp0s20f0u1 find from ``ifconfig -a` for USB Connection) :

sudo ip a add 192.168.7.1/24 dev enp0s20f0u1    
sudo ip link set dev enp0s20f0u1 up    
sudo ifconfig enp0s20f0u1 192.168.7.1 up    
sudo ssh pi@192.168.7.2    
sudo avahi-autoipd -D enp0s20f0u1

but connecting to PI via ssh (sudo ssh pi@192.168.7.2) dont working.

I also try using iptable like this (enp0s20f0u1 find from ``ifconfig -a` for USB Connection):

# select correct interfaces from "ifconfig":
BBGW_IFACE=enp0s20f0u1 
# Ethernet
PC_IFACE=wlp2s0
# Wireless
#PC_IFACE=todo

sudo sysctl net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface $PC_IFACE -j MASQUERADE
sudo iptables --append FORWARD --in-interface $BBGW_IFACE -j ACCEPT

but the result is only when i run ping www.google.com i get this:

so@notebook:~$ ping www.google.com
PING www.google.com (172.217.169.228) 56(84) bytes of data.
From notebook (192.168.7.2) icmp_seq=1 Destination Host Unreachable

So i understand i need to have one IP for my raspberry and share that IP with my WiFi setting as you could see here:

enter image description here

So in Linux version what is the similar instruction to share my PC internet with the PI?

  • i have this kind of question in raspberrypi.stackexchange site and based on those comments,I asked this question here.i have seen this Que which have closed because of being of topic.

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.