Page 1 of 1

Pi 3 as a bridge between wired router and phone hotspot

Posted: Wed Nov 08, 2017 11:52 am
by cjdawson
Hi everyone.,

I'm looking for a little help with what should be a relatively simple (he says) project. I have a Raspberry Pi 3. And what I'd like to do is set it up to connect to a Wifi connection, which will have internet access. (This could be my phone, but it could also be a hotspot that requires login once connected - this bit might happen later)

Then, what I'd like to do is plug the Ethernet port into the WAN port of a wireless router. Connect other devices to the router. Then allow whatever devices are connected to the router to be able to access the internet.

The idea is that I want to be able to have a wireless network in my caravan with internet access. I'm planning on connecting several devices to this - ipad, iphone, macbook pro, Another PI (running OSMC) and a windows laptop.

If there is not hotspot, I'd want to be able to connect as follows (should be easier to setup too)

iphone hotspot wirelessly connects to PI3, then wired connection to the router WAN socket, again allowing internet access from the other devices.


Can anyone point me in the right direction for a good tutorial on how to put this together? Ideally, I'd love to be able to do this using my PI3 that is already running OSMC, if not, a seperate PI3 could be used.

Re: Pi 3 as a bridge between wired router and phone hotspot

Posted: Wed Nov 08, 2017 12:21 pm
by SurferTim
Been there. Done that (with Raspbian Stretch). It isn't a bridge, it's a NAT.

Install dnsmasq

Code: Select all

sudo apt-get install dnsmasq
Add this to the bottom of /etc/dhcpcd.conf

Code: Select all

interface eth0
static ip_address=192.168.4.1/24
Move the original dnsmasq.conf

Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Open /etc/dnsmasq.conf with a text editor like nano, then add this

Code: Select all

interface=eth0
dhcp-range=192.168.4.20,192.168.4.100,255.255.255.0,12h
Open /etc/sysctl.conf and uncomment this line:

Code: Select all

net.ipv4.ip_forward=1
Open /etc/rc.local with a text editor and add this above "exit 0"

Code: Select all

iptables -t nat -A  POSTROUTING -o wlan0 -j MASQUERADE
Reboot.

Re: Pi 3 as a bridge between wired router and phone hotspot

Posted: Mon Mar 05, 2018 7:24 am
by apchar
Thanks Tim. All answers should be so good. But where do we go from there? How do you identify the hotspot? In a wds capable router it'll survey the area and find the hotspot with little feedback or details. How do you specify the hotspot on a Pi ?

Re: Pi 3 as a bridge between wired router and phone hotspot

Posted: Mon Mar 05, 2018 12:19 pm
by SurferTim
AFAIK, the RPi does not support wds. You can select the hotspot with the GUI network tool, or you can enter the hotspot ssid/passphrase in /etc/wpa_supplicant/wpa_supplicant.conf.