0

I got a Raspberry Pi 3 which I haven't used in a while, and have decided to boot it up with its built-in wifi card as its own Hotspot, and the official Raspberry Pi Wifi Dongle as an interface to my modem.

So in the end, you connect to the Pi on wlan0 (built-in), and to access the internet it bridges the connection to wlan1 (dongle). Except, what I want to be able to do, is also bridge that connection to eth0 incase my dongle is removed or not working for some reason.

So at that stage, you connect on wlan0, and your data goes through wlan1 if it's there, and if not try eth0.

I'm following this tutorial, and near the bottom the author has brushed over the iptables commands:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

What I have tried (with no luck), is typing these commands in:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE  

sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  
sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT  

sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT  
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT  

Don't ask why but I just assumed this would do something. The current state of the whole thing is that my Pi broadcasts a connection, but I (my MacBook) cannot connect to it. I'm actually using it right now through eth0 by SSH'ing over my LAN, and can see that the server has been configured on wlan0, it just won't actually let me connect.

Any ideas how to bridge these three?

0

I've a variation on the same theme. It sounds like you are using the documentation on use RPi as WAP

I started off the same and ended up messing around with the same config in the same way. It did work. I think the bit you are missing is the iptables "MASQUERADE" rules, which if you do sudo nano /etc/(nameoffile) you need to add in a MASQUERADE RUle for your eth0 (I think!!)

Good Luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy