KingSnuggleMuffin
Posts: 1
Joined: Thu Feb 05, 2015 3:58 pm
Location: Kuala Lumpur, Malaysia

Sharing Hotel Wifi (Browser Login) with VPN/Tor

Thu Feb 05, 2015 4:15 pm

Hello Everyone,

I'm looking for a Raspberry Pi project that I can follow that will allow me the following:
  • 1. Share Hotel Wifi to My Devices
    2. Can share Hotel Wifi, even if it requires a browser login (captive portal) common in hotels
    3. Can support OpenVPN or Tor for more private/secure data connection for all connected devices
I have found a GitHub project that does #1, but it looks like it assumes a normal SSID/Password connection:
http://mobilesociety.typepad.com/mobile ... unnel.html

I've seen #2 in a a few places (Ethernet to Wifi with Tor/VPN) and searching here, I see that you can do #2 manually (access wifi via captive portal/browser login):
http://www.raspberrypi.org/forums/viewt ... in#p462558

But is there a project that puts all #1, #2, #3 together neatly that a noob like me can handle?

Any advice and tips would be appreciated!

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 7:31 am

I'm looking for almost the same guide.

Many attemps later: Raspberry Pi 3 as access point for VPN connection. There is no working tutorial out there (yet).

Let me know if you find something useful! :-)

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 2:21 pm

Everything I've found is either outdated, or not quite what I'm looking for.

Thus far, I have managed to get the Pi connected to the Internet over Wireless and gotten it connected to my VPN provider. It is also accessible over SSH. Just a matter of figuring out how to share that connection with other devices.

From my understanding, you need two things. A DHCP server to assign IP addresses, and a package that can create access points. None of them that I've configured have worked for one reason or another.

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 3:01 pm

I've tried setups with hostapd, dhcpd or dnsmasq. I've managed to create an AP, but no data comes through when connected to it.

What did you use? OpenVPN with a tun0 connection seems not the main problem (works locally), but the data flow through wlan0 AP. Can you tell me more about the tutorials you relied on?

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 4:48 pm

I'm currently at a retreat and away from my computer. If I get a chance later today, I'll fire up my laptop and get the links for the tutorials I've tried to use as a guide.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 5:32 pm

whiskeytangofoxtrot wrote:I've tried setups with hostapd, dhcpd or dnsmasq. I've managed to create an AP, but no data comes through when connected to it.

What did you use? OpenVPN with a tun0 connection seems not the main problem (works locally), but the data flow through wlan0 AP. Can you tell me more about the tutorials you relied on?
Here goes. Get ready for links. This is more-or-less everything I've looked at.

viewtopic.php?f=29&t=67819

viewtopic.php?t=17702

http://makezine.com/projects/browse-ano ... or-router/

https://alphaloop.blogspot.ca/2014/01/r ... ccess.html

https://learn.adafruit.com/onion-pi/overview

https://learn.adafruit.com/setting-up-a ... cess-point

https://github.com/martinsauter/WLAN-VPN-Pi

https://wiki.debian.org/BridgeNetworkCo ... onnections

https://www.maketecheasier.com/set-up-r ... ess-point/

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 6:02 pm

Thanks for your effort! The links look very familiar to me. The good news is, I just made my Raspberry Pi 3 to establish a working Access Point (with a Jessie lite image on my Raspberry Pi), thanks to your link:

adafruit - setting up a raspberry pi as a wifi access point

Thats really reassuring! Now I can try the OpenVPN part while hoping not to destroy the prior effort ;)

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 7:21 pm

whiskeytangofoxtrot wrote:Thanks for your effort! The links look very familiar to me. The good news is, I just made my Raspberry Pi 3 to establish a working Access Point (with a Jessie lite image on my Raspberry Pi), thanks to your link:

adafruit - setting up a raspberry pi as a wifi access point

Thats really reassuring! Now I can try the OpenVPN part while hoping not to destroy the prior effort ;)
That is good news. I'll have to take a closer look at that link. I'd love to hear if you get that working along with the OpenVPN connection.

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 9:15 pm

Yes, follow the tutorial closely and it should work for you too. However, I noticed very slow data transfer with my Access Point. I'm on a 100Mbit downstream/10Mbit upstream landline, but I get only about 16Mbit downstream with the Raspberry. I'll try to find a way to gain more speed and I'll let you know if I find something useful.

If I break my current working Access Point with the OpenVPN setup, I will try to install OpenWRT (OS to route internet traffic, similar to the preinstalled software on any consumer routers) to my Raspberry Pi 3 as I need a device for VPN access only.

->> https://wiki.openwrt.org/toh/raspberry_ ... spberry_pi

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 11, 2017 10:32 pm

Ok I have a working AP with VPN!

If you're on a Raspberry Pi 3 with a fresh Jessie Lite image installed, follow this tutorial:

- https://cdn-learn.adafruit.com/download ... -point.pdf

-----------------------------------
After your AP is working you can install OpenVPN with:

Code: Select all

sudo apt-get install openvpn
Copy the VPN files (consult your VPN host) into the directory

Code: Select all

/etc/openvpn/
Start the OpenVPN service with:

Code: Select all

sudo service openvpn start
I did a reboot of the Pi and then checked, if

Code: Select all

tun0
appears in the list of the command

Code: Select all

ifconfig
Now we need to add new rules to our iptables to add a network translation between

Code: Select all

wlan0
and our VPN

Code: Select all

tun0
Execute below:

Code: Select all

sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sudo iptables -A FORWARD -i tun0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o tun0 -j ACCEPT
sudo iptables -A INPUT -i tun0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i tun0 -j DROP
Important: after you executed the iptable rules above, go on and save it in the same iptables file we created before for our AP

Code: Select all

sudo sh -c "iptables-save > /etc/iptables/rules.v4"
Reboot again and it should work :-)

additional: the wifi speed has improved a bit (prior 16Mbit, now about 20-30Mbit [on a 100Mbit landline]), thanks to this guide
https://nwgat.ninja/fixing-raspberry-pi-network-issues/

-----
Parts of the OpenVPN setup above with help from this tutorial: https://alphaloop.blogspot.de/2014/01/r ... ccess.html

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 12, 2017 12:05 am

whiskeytangofoxtrot wrote:Ok I have a working AP with VPN!

If you're on a Raspberry Pi 3 with a fresh Jessie Lite image installed, follow this tutorial:

- https://cdn-learn.adafruit.com/download ... -point.pdf

-----------------------------------
After your AP is working you can install OpenVPN with:

Code: Select all

sudo apt-get install openvpn
Copy the VPN files (consult your VPN host) into the directory

Code: Select all

/etc/openvpn/
Start the OpenVPN service with:

Code: Select all

sudo service openvpn start
I did a reboot of the Pi and then checked, if

Code: Select all

tun0
appears in the list of the command

Code: Select all

ifconfig
Now we need to add new rules to our iptables to add a network translation between

Code: Select all

wlan0
and our VPN

Code: Select all

tun0
Execute below:

Code: Select all

sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sudo iptables -A FORWARD -i tun0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o tun0 -j ACCEPT
sudo iptables -A INPUT -i tun0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i tun0 -j DROP
Important: after you executed the iptable rules above, go on and save it in the same iptables file we created before for our AP

Code: Select all

sudo sh -c "iptables-save > /etc/iptables/rules.v4"
Reboot again and it should work :-)

additional: the wifi speed has improved a bit (prior 16Mbit, now about 20-30Mbit [on a 100Mbit landline]), thanks to this guide
https://nwgat.ninja/fixing-raspberry-pi-network-issues/

-----
Parts of the OpenVPN setup above with help from this tutorial: https://alphaloop.blogspot.de/2014/01/r ... ccess.html
When I get back home, I will give this a try. Hopefully, I will be just as successful as you were.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 2:29 am

I followed these instructions and had partial success. I got an access point setup, and devices can connect to it, but I can't get internet access.

I used two Wireless devices. The Pi connects to my router with the built in wlan, and broadcasts an AP with a USB wlan device. The Pi has access the internet, and I switched out all of the references to "eth0" to "wlan1" but there is still not internet access for connected devices.

The reason I did it this way, is because I am hoping to both use it as a simple repeater, and using it to share an OpenVPN connection. I read something about "most Access Points (APs) will reject frames that have a source address that didn’t authenticate with the AP" leading me to think that I would need to change some settings somewhere around MAC addresses.

Any thoughts, or read anything that might be useful to my setup? Thanks!

Link for that quote: https://wiki.debian.org/BridgeNetworkCo ... reless_NIC

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 3:33 am

MZGSZM wrote:I followed these instructions and had partial success. I got an access point setup, and devices can connect to it, but I can't get internet access.

I used two Wireless devices. The Pi connects to my router with the built in wlan, and broadcasts an AP with a USB wlan device. The Pi has access the internet, and I switched out all of the references to "eth0" to "wlan1" but there is still not internet access for connected devices.

The reason I did it this way, is because I am hoping to both use it as a simple repeater, and using it to share an OpenVPN connection. I read something about "most Access Points (APs) will reject frames that have a source address that didn’t authenticate with the AP" leading me to think that I would need to change some settings somewhere around MAC addresses.

Any thoughts, or read anything that might be useful to my setup? Thanks!

Link for that quote: https://wiki.debian.org/BridgeNetworkCo ... reless_NIC
I figured it out after some messing around. Turns out that I had the positions of the interfaces in the wrong order. All I have to do now is setup a script that will update the iptables to use the "tun0" interface rather than "wlan0" whenever I am intending on using VPN.

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 7:55 am

congrats!

Any additional wifi should be defined as wlan1 - I believe.

Adjust iptables and the conf files (i.e. hostapd.conf) accordingly and it should work.

Are you satisfied with your bandwidth on the Pi? Any thoughts on that issue?

Also, I recommend to verify if your connection is successfully encrypted. Reference: http://www.online-tech-tips.com/compute ... encrypted/

Furthermore, verify if your VPN connection leaks DNS, WebRTC or IPv6 (i.e. ipleak.net, https://www.dnsleaktest.com/)

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 2:45 pm

whiskeytangofoxtrot wrote:congrats!

Any additional wifi should be defined as wlan1 - I believe.

Adjust iptables and the conf files (i.e. hostapd.conf) accordingly and it should work.

Are you satisfied with your bandwidth on the Pi? Any thoughts on that issue?

Also, I recommend to verify if your connection is successfully encrypted. Reference: http://www.online-tech-tips.com/compute ... encrypted/

Furthermore, verify if your VPN connection leaks DNS, WebRTC or IPv6 (i.e. ipleak.net, https://www.dnsleaktest.com/)
The speed is not quite as nice as connecting directly to my router, but that is understandable for a few reasons. 1. The connection is making two wireless jumps. 2. The internet here is Satellite. Satellite and VPN don't work well together. The VPN performance is not very impressive because of the high latency.

I already checked, and there are no DNS leaks, so that's good. Checked for other leaks as well with that other link you provided, all good there. The only problem I've had so far, is that the Pi seems to lose internet connection after a while, and I have to reboot it to get that back. I'm not quite sure why that is happening.

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 3:56 pm

A few thoughts on your post:

- Your Raspberry is connected via Wifi to your Router? Why not ethernet?

---------------------------

Router/Modem <<------>> Ethernet <<------->> Raspberry Pi 3 <<------->> Encrypted Wifi (VPN)
I
I
I
(Unencrypted Wifi)

---------------------------

- Check if your Wifi networks use different channels. They might interfere with each other, if on the same channel
- Choose a VPN server close to your location.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Mon Mar 13, 2017 4:32 pm

I have it connected with WiFi just to test how well it works. Once I get it to stay connected and working properly for days on end, I will likely change it to ethernet while it is at home.

As for WiFi channels, they are running on different ones, so they shouldn't be interfering with each other.

I'll try a different VPN server, but I don't think that is the issue either as disconnecting doesn't restore the connection on the Pi. Still can't ping anything.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 25, 2017 7:32 pm

After having setup the VNC server on my Pi, the access point no longer shares an internet connection, and I cannot figure out why for the life of me. Anyone seen anything like that before?

All of the setting I changed seemed unchanged. I even reinstalled Raspbian and installed VNC server first. The access point shows up and can be connected to, but doesn't allow access to the internet.

FireDragon
Posts: 4
Joined: Sat Mar 25, 2017 11:25 pm

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sat Mar 25, 2017 11:32 pm

Guys,

I'm working on a similar setup, just to make sure we are on the same page, you guys are using:

- Raspberry Pi 3 with latest version of Raspbian
- Edimax WiFi Adapter

You are trying to use the RPi with two WiFi networks, one (wlan0 - internal) as an AP and the other one (wlan1 - Edimax USB dongle) that will be used to connect to an Internet enabled WiFi network (e.g. Hotel Wifi), right?.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 12:37 am

My setup is very similar to that.

I decided to use the build in wlan to connect to the network, as it has a little better range. The USB wlan I'm using is one made by Panda, but there two drivers there to choose from (one of which) should work.

FireDragon
Posts: 4
Joined: Sat Mar 25, 2017 11:25 pm

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 2:12 am

I got the AP working on wlan0 sharing internet connection from both: Ethernet and 2nd WiFi network (wlan0).

I did that by configuring the RPi to forward packets from both interfaces (wlan1 and ethernet) to the AP wireless network:

Code: Select all

# Routing and forwarding between eth0 and wlan0 (RPi internal WiFi)
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

# Routing and forwarding between wlan0 (RPi internal WiFi) and wlan1 (Edimax USB adapter)
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
I'm not sure if I'll be installing the OpenVPN client. I already have it installed in the wireless devices that connect to the RPi AP, and it's easy enough to disconnect from it if I trust the wireless network I'm connecting to.

I'm considering installing https://syncthing.net/ so that I can backup documents and photos to a remote location while on the road.

If you guys are interested in using the Raspberry Pi to backup photos while traveling, you might want to check my post on the subject: http://bit.ly/2gyMepQ

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 2:34 am

Glad to hear you got it working. I am hoping I can figure out what went wrong with my setup. It seems that the VNC server interferes with the AP somehow.

whiskeytangofoxtrot
Posts: 11
Joined: Sat Mar 11, 2017 7:06 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 8:54 am

I believe there is a conflict between the VNC and the iptable rules.

I've limited myself to SSH access in local network. That works at least.

MZGSZM
Posts: 26
Joined: Sun Mar 05, 2017 12:55 am

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 2:53 pm

whiskeytangofoxtrot wrote:I believe there is a conflict between the VNC and the iptable rules.

I've limited myself to SSH access in local network. That works at least.
I figured it was something along those lines. I'm hoping I can find something to get them working together, as I was going to use VNC to deal with the authentication pages required on some WiFi networks.

FireDragon
Posts: 4
Joined: Sat Mar 25, 2017 11:25 pm

Re: Sharing Hotel Wifi (Browser Login) with VPN/Tor

Sun Mar 26, 2017 3:13 pm

I got VNC working fine by following the instructions here:

https://www.raspberrypi.org/documentati ... /README.md

I also included a script to load VNC at boot (found it a while ago online and haven't changed it since it's working fine).

Hope that helps.

Return to “Networking and servers”