Jump to content


Photo

OPIZero share internet over eth0 from wlan0


  • Please log in to reply
7 replies to this topic

#1 iDnlSM

iDnlSM

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 16 February 2017 - 03:11 PM

Hello everyone
I just bought an orange pi zero (512mb) and installed ubuntu xenial ...
I was able to connect to my wifi AP using nmtui, and now I am trying to "share" the internet with any device that is connected in eth0 ...
I followed many tutorials and read several threads, but without success.
 
My settings are defaults, I installed ubuntu xenial, just gave apt-get update and upgrade
 
I would be grateful if anyone could help me ... thank you.


#2 tkaiser

tkaiser

    Advanced Member

  • Moderators
  • 2842 posts

Posted 16 February 2017 - 03:54 PM

You can try to address this at layer 3 (TCP/IP) and let OPi Zero work as a NAT router but just the opposite direction than usual (Wi-Fi is connected to Internet Access Router and clients are behind the Ethernet connection -- so you have to adopt this for most if not all tutorials you find).

 

Another approach is to solve this at layer 2: bridging. This works fine in Ethernet segments (every network switch is just a multi-port bridge) but in your scenario with Wi-Fi being connected to another AP you'll most probably run into a problem: the AP dropping packets with 'wrong' MAC addresses. The usual way to solve this here: https://wiki.debian...._a_wireless_NIC

 

Though I would assume following the above tutorial would also require to use the old/anachronistic way to set up interfaces in Debian/Ubuntu. So no more easy going with nmtui/network-manager but dealing with wpa_supplicant or even worse adding WPA passphrase to interfaces file.

 

Since network-manager can also deal with bridges another attempt would be to simply remove eth0 from /etc/network/interfaces and try to setup the bridge with nmcli: https://access.redha...k_Bridging.html(don't know whether that works for you -- please see 2nd paragraph there)


Please don't send personal messages! Use the forum so others can participate and benefit!

 

Before you report any problem please be aware that crappy SD cards and insufficient power supply are reason N° 1 why things are failing. Try to rule this out first please, check 'getting started' recommendations and check/provide 'sudo armbianmonitor -u' output first!

 

Did you check out custom google powered forum search already (before opening new threads or asking questions)?


#3 iDnlSM

iDnlSM

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 16 February 2017 - 09:08 PM

You can try to address this at layer 3 (TCP/IP) and let OPi Zero work as a NAT router but just the opposite direction than usual (Wi-Fi is connected to Internet Access Router and clients are behind the Ethernet connection -- so you have to adopt this for most if not all tutorials you find).

 

Another approach is to solve this at layer 2: bridging. This works fine in Ethernet segments (every network switch is just a multi-port bridge) but in your scenario with Wi-Fi being connected to another AP you'll most probably run into a problem: the AP dropping packets with 'wrong' MAC addresses. The usual way to solve this here: https://wiki.debian...._a_wireless_NIC

 

Though I would assume following the above tutorial would also require to use the old/anachronistic way to set up interfaces in Debian/Ubuntu. So no more easy going with nmtui/network-manager but dealing with wpa_supplicant or even worse adding WPA passphrase to interfaces file.

 

Since network-manager can also deal with bridges another attempt would be to simply remove eth0 from /etc/network/interfaces and try to setup the bridge with nmcli: https://access.redha...k_Bridging.html(don't know whether that works for you -- please see 2nd paragraph there)

 

Almost all of the tutorials I followed used wpa_supplicant, I tried each one of them, but I could not get it to work.
At first, I thought it did not work because the network manager was conflicting with wpa_supplicant, but then I read that when you edit some interface in the / etc / network / interfaces file, the network manager ignores that interface. I tried many ways, with passphrase in all places where it was possible, but it simply did not work.
 
The brige was one of my first attempts, but it did not work either.
 
It's my second day trying this, I'm so tired, I'm still looking, but I will not try anything that nobody is sure is working ...
 
Thank you tkaiser


#4 tkaiser

tkaiser

    Advanced Member

  • Moderators
  • 2842 posts

Posted 16 February 2017 - 10:08 PM

Well, I usually do this stuff with capable Wi-Fi hardware (capable == not that what's used on el cheapo SBC and especially not the Zero which can be considered as 'as low as possible' Wi-Fi... you get what you pay for as usual) and then using either OpenWRT/LEDE or when it's Apple equipment then the appropriate utility.

 

Such a mode works but as already said you have to take care that MAC addresses get 'spoofed'. And sorry, won't try it out myself since for exactly such a use case there's an Airport Express lying around but it should be noted that some people on the forum had success getting OpenWRT to run on the Zero (relying on Armbian's build system for kernel and driver but sometimes information was conflicting since someone said he had OpenWRT with kernel 3.18 on the Zero). Just search the forum (see my sig) for 'zero openwrt' and be careful using 3rd party images of unknown origin (I would never use those, only stuff that has been built from scratch but no idea whether someone created an OpenWRT tutorial for the Zero already)


Please don't send personal messages! Use the forum so others can participate and benefit!

 

Before you report any problem please be aware that crappy SD cards and insufficient power supply are reason N° 1 why things are failing. Try to rule this out first please, check 'getting started' recommendations and check/provide 'sudo armbianmonitor -u' output first!

 

Did you check out custom google powered forum search already (before opening new threads or asking questions)?


#5 SomeArmbianForumUser

SomeArmbianForumUser

    Member

  • Senior Members
  • PipPip
  • 17 posts

Posted 16 February 2017 - 11:22 PM

Why are you messing with wpa_supplicant when you were already "able to connect to [your] wifi AP using nmtui, and now [you're] trying to share the internet with any device that is connected in eth0 ...".

 

In the simplest realization this would just need a static private IP address for eth0, ip forwarding, a NAT iptables rule, static addresses, routes, and dns settings on the connected devices.

 

You say you are tired from trying out so many things but you do not describe what went wrong in even a single try.



#6 tkaiser

tkaiser

    Advanced Member

  • Moderators
  • 2842 posts

Posted 17 February 2017 - 12:08 AM

a static private IP address for eth0, ip forwarding, a NAT iptables rule, static addresses, routes, and dns settings on the connected devices.

 

Static configurations? At least I hate this so much that I would immediately throw the Zero in the bin and replace it with any OpenWRT/LEDE supported router/AP (way better Wi-Fi performance, the usual 'you get what you pay for' rule) or would better try out 2nd link from my 1st link above (another layer 3 attempt): https://wiki.debian....ectionsProxyArp


Please don't send personal messages! Use the forum so others can participate and benefit!

 

Before you report any problem please be aware that crappy SD cards and insufficient power supply are reason N° 1 why things are failing. Try to rule this out first please, check 'getting started' recommendations and check/provide 'sudo armbianmonitor -u' output first!

 

Did you check out custom google powered forum search already (before opening new threads or asking questions)?


#7 iDnlSM

iDnlSM

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 17 February 2017 - 09:11 AM

Well, I usually do this stuff with capable Wi-Fi hardware (capable == not that what's used on el cheapo SBC and especially not the Zero which can be considered as 'as low as possible' Wi-Fi... you get what you pay for as usual) and then using either OpenWRT/LEDE or when it's Apple equipment then the appropriate utility.

 

Such a mode works but as already said you have to take care that MAC addresses get 'spoofed'. And sorry, won't try it out myself since for exactly such a use case there's an Airport Express lying around but it should be noted that some people on the forum had success getting OpenWRT to run on the Zero (relying on Armbian's build system for kernel and driver but sometimes information was conflicting since someone said he had OpenWRT with kernel 3.18 on the Zero). Just search the forum (see my sig) for 'zero openwrt' and be careful using 3rd party images of unknown origin (I would never use those, only stuff that has been built from scratch but no idea whether someone created an OpenWRT tutorial for the Zero already)

 

I'm not too worried about quality or speed, I just need this to work ...
I read some topics about OpenWRT in Pi Zero, it should work, but the other things I plan to do will not work well with openwrt ...


#8 iDnlSM

iDnlSM

    Newbie

  • Senior Members
  • Pip
  • 4 posts

Posted 17 February 2017 - 09:30 AM

Why are you messing with wpa_supplicant when you were already "able to connect to [your] wifi AP using nmtui, and now [you're] trying to share the internet with any device that is connected in eth0 ..."

 

 

In most of the tutorials I tried, wlan0 and eth0 were edited in the /etc/network/ interfaces file, and the network manager does not mess with the interfaces that are configured in the file.
 
 

In the simplest realization this would just need a static private IP address for eth0, ip forwarding, a NAT iptables rule, static addresses, routes, and dns settings on the connected devices.

 
Almost all the tutorials I tried did this, all the commands worked, but in the end something was wrong ...
 
 

You say you are tired from trying out so many things but you do not describe what went wrong in even a single try.

 
Most of the time the wifi did not connect, but when I connected, my other computer connected to the eth0 of OPIZero could not find an IP, and even if I put it manually, there was no internet.