Jump to content

[Solved] OPIZero share internet over eth0 from wlan0


iDnlSM

Recommended Posts

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.

 

Link to comment
Share on other sites

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.org/BridgeNetworkConnections#Bridging_with_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.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_Network_Bridging.html(don't know whether that works for you -- please see 2nd paragraph there)

Link to comment
Share on other sites

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.org/BridgeNetworkConnections#Bridging_with_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.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_Network_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
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.org/BridgeNetworkConnectionsProxyArp

Link to comment
Share on other sites

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 ...
Link to comment
Share on other sites

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. 
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines