soheilsabz
Posts: 14
Joined: Mon May 20, 2019 1:56 pm

Sharing My LInux PC WiFi internet to raspberry Zero (USB connected)

Wed May 22, 2019 6:45 pm

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 http://www.circuitbasics.com/raspberry- ... et-gadget/ or this question via raspberrypi.stackexchange https://raspberrypi.stackexchange.com/q ... connection 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:


i could assist one IP (`192.168.7.2`) for my raspberry by running this code in my raspberry based [this instructions][3] :

Code: Select all

 sudo nano /etc/network/interfaces
    allow-hotplug wlan1
    iface wlan1 inet manual
       wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    
    allow-hotplug usb0
    iface usb0 inet static
            address 192.168.7.2
            netmask 255.255.255.0
            network 192.168.7.0
            broadcast 192.168.7.255
            gateway 192.168.7.1
I have this (`

Code: Select all

sudo ifconfig
`) in my Linux:

Code: Select all

     enp0s20f0u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 169.254.27.126  netmask 255.255.0.0  broadcast 169.254.255.255
            inet6 fe80::cff5:f703:7327:dd9  prefixlen 64  scopeid 0x20<link>
            ether 6e:2f:15:92:bd:a8  txqueuelen 1000  (Ethernet)
            RX packets 2936  bytes 244294 (238.5 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 2113  bytes 174942 (170.8 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    
     wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.1.105  netmask 255.255.255.0  broadcast 192.168.1.255
            inet6 fe80::373d:1b7f:5b9e:8ddc  prefixlen 64  scopeid 0x20<link>
            ether c8:3d:d4:3c:23:63  txqueuelen 1000  (Ethernet)
            RX packets 33305  bytes 31322783 (29.8 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 26405  bytes 4264995 (4.0 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
the `enp0s20f0u2i2` is my Raspberry zero which is using `IPV4 Link-local only method` but i could change its IP to static IP like `192.168.7.2` as described above.

And in my raspberry:

Code: Select all

   [email protected]:~ $ ifconfig -a
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 72  bytes 6840 (6.6 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 72  bytes 6840 (6.6 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 169.254.183.232  netmask 255.255.0.0  broadcast 169.254.255.255
            inet6 fe80::d7db:e53b:407d:8d65  prefixlen 64  scopeid 0x20<link>
            ether ee:70:24:ba:2d:57  txqueuelen 1000  (Ethernet)
            RX packets 182  bytes 28198 (27.5 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 172  bytes 15872 (15.5 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
so when i do this site instruction https://thej6s.com/articles/2017-10-26_ ... r-pi-zero/
I run this code in my Linux:

Code: Select all

    # Bring both interfaces into promiscuous mode
    sudo ip link set wlp2s0 promisc on
and this code in my raspberry:

Code: Select all

  sudo ip link set usb0 promisc on

when i run this code in my LINUX OS (laptop):

Code: Select all

   # Creating a new bridge interface
    sudo brctl addbr br0
    
    # Set the forwarding delay to 0.
    # While this is not necessary, I learned that it help with faster configuration
    sudo brctl setfd br0 0
SO when running next step (`

Code: Select all

sudo brctl addif br0 wlp2s0 enp0s20f0u2`
) i get this error:

Code: Select all

 can't add wlp2s0 to bridge br0: Operation not supported
so i doing this :`

Code: Select all

sudo iw dev wlp2s0 set 4addr on
` from here https://superuser.com/questions/597834/ ... ot-workingto solve this bug, but i lose my internet connection :

Code: Select all

 [email protected]:~$ ping www.google.com
    ping: www.google.com: Name or service not known
ans also lose my connection with my Raspberry zero (USB Ethernet).

SO what i must t to do to make a bridge for sharing my laptop internet with raspberry zero?



* I have this kind of question in raspberrypi.stackexchange https://raspberrypi.stackexchange.com/q ... 689_98790 site and nere (https://serverfault.com/questions/96846 ... -connected) and based on those comments,I asked this question here

Thanks your advice.

pcmanbob
Posts: 5968
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Sharing My LInux PC WiFi internet to raspberry Zero (USB connected)

Fri May 24, 2019 7:36 pm

Hi.

I think you need to ask this question on the support forum for which ever Linux distro you are using on you laptop, its not the pi that needs configuring but your Linux laptop, which you wont find support for here because we have no way of knowing which Linux distro your are running on your laptop.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

fruitoftheloom
Posts: 19569
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Sharing My LInux PC WiFi internet to raspberry Zero (USB connected)

Fri May 24, 2019 9:34 pm

soheilsabz wrote:
Wed May 22, 2019 6:45 pm
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 http://www.circuitbasics.com/raspberry- ... et-gadget/ or this question via raspberrypi.stackexchange https://raspberrypi.stackexchange.com/q ... connection 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:


i could assist one IP (`192.168.7.2`) for my raspberry by running this code in my raspberry based [this instructions][3] :

Code: Select all

 sudo nano /etc/network/interfaces
    allow-hotplug wlan1
    iface wlan1 inet manual
       wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
    
    allow-hotplug usb0
    iface usb0 inet static
            address 192.168.7.2
            netmask 255.255.255.0
            network 192.168.7.0
            broadcast 192.168.7.255
            gateway 192.168.7.1
I have this (`

Code: Select all

sudo ifconfig
`) in my Linux:

Code: Select all

     enp0s20f0u2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 169.254.27.126  netmask 255.255.0.0  broadcast 169.254.255.255
            inet6 fe80::cff5:f703:7327:dd9  prefixlen 64  scopeid 0x20<link>
            ether 6e:2f:15:92:bd:a8  txqueuelen 1000  (Ethernet)
            RX packets 2936  bytes 244294 (238.5 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 2113  bytes 174942 (170.8 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    
     wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.1.105  netmask 255.255.255.0  broadcast 192.168.1.255
            inet6 fe80::373d:1b7f:5b9e:8ddc  prefixlen 64  scopeid 0x20<link>
            ether c8:3d:d4:3c:23:63  txqueuelen 1000  (Ethernet)
            RX packets 33305  bytes 31322783 (29.8 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 26405  bytes 4264995 (4.0 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
the `enp0s20f0u2i2` is my Raspberry zero which is using `IPV4 Link-local only method` but i could change its IP to static IP like `192.168.7.2` as described above.

And in my raspberry:

Code: Select all

   [email protected]:~ $ ifconfig -a
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 72  bytes 6840 (6.6 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 72  bytes 6840 (6.6 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 169.254.183.232  netmask 255.255.0.0  broadcast 169.254.255.255
            inet6 fe80::d7db:e53b:407d:8d65  prefixlen 64  scopeid 0x20<link>
            ether ee:70:24:ba:2d:57  txqueuelen 1000  (Ethernet)
            RX packets 182  bytes 28198 (27.5 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 172  bytes 15872 (15.5 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
so when i do this site instruction https://thej6s.com/articles/2017-10-26_ ... r-pi-zero/
I run this code in my Linux:

Code: Select all

    # Bring both interfaces into promiscuous mode
    sudo ip link set wlp2s0 promisc on
and this code in my raspberry:

Code: Select all

  sudo ip link set usb0 promisc on

when i run this code in my LINUX OS (laptop):

Code: Select all

   # Creating a new bridge interface
    sudo brctl addbr br0
    
    # Set the forwarding delay to 0.
    # While this is not necessary, I learned that it help with faster configuration
    sudo brctl setfd br0 0
SO when running next step (`

Code: Select all

sudo brctl addif br0 wlp2s0 enp0s20f0u2`
) i get this error:

Code: Select all

 can't add wlp2s0 to bridge br0: Operation not supported
so i doing this :`

Code: Select all

sudo iw dev wlp2s0 set 4addr on
` from here https://superuser.com/questions/597834/ ... ot-workingto solve this bug, but i lose my internet connection :

Code: Select all

 [email protected]:~$ ping www.google.com
    ping: www.google.com: Name or service not known
ans also lose my connection with my Raspberry zero (USB Ethernet).

SO what i must t to do to make a bridge for sharing my laptop internet with raspberry zero?



* I have this kind of question in raspberrypi.stackexchange https://raspberrypi.stackexchange.com/q ... 689_98790 site and nere (https://serverfault.com/questions/96846 ... -connected) and based on those comments,I asked this question here

Thanks your advice.

Yes not a Raspberry Pi Raspbian OS issue, LMDE forum would be a good place to ask for connection sharing support...

...though I use Xubuntu and it has built in support for connection sharing.
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

soheilsabz
Posts: 14
Joined: Mon May 20, 2019 1:56 pm

Re: Sharing My LInux PC WiFi internet to raspberry Zero (USB connected)

Fri Jun 07, 2019 9:35 pm

I have found the solution and make one power point file which could be accessible here:

https://www.slideshare.net/GSHCO/raspbe ... b-in-linux

Return to “Networking and servers”