soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 08, 2017 9:18 pm

Hey,

my idea is to connect the raspberry with an existing WLAN (e.g. in a hotel) and build a new WLAN for all my devices. The reason for that is that the most hotel only allow one WLAN device and I would like to create my own WLAN AP.

Optional: It would be great when the Raspberry always start a VPN connection to my FritzBox at home for a secure access in a public WLAN.

Currently I have a Raspberry Pi 3 with an included WLAN module, but I am sure, that I need a second WLAN device (USB WLAN stick).

Does anyone know if this would work? I have some concerns about the WLAN landing page in a hotel. Typically I have to enter a username and password.


Feel free to commend, post some links or something else... Thanks!!

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Thu Nov 09, 2017 12:11 am

It should work.

Set the RPi's internal wifi as an AP, and the usb wifi as the client.

Here is the AP part. Get it working first,
https://github.com/SurferTim/documentat ... s-point.md
Use the standalone version.

When you get that working, post here.

Edit: Before you do that, I would highly recommend using raspi-config to select predictable interface names. Start raspi-config, then select 7, then A7.

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Tue Nov 14, 2017 10:15 pm

Thanks a lot! But it still not work. I have tried this https://www.raspberrypi.org/documentati ... s-point.md manual as well, but I can not find my new AP with this SSID.

If i take a look onto my network devices (console ifconfig) I can see that the wlan0 has not a static IP address. So something went wrong, but I don't know what.

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.168.20  netmask 255.255.255.0  broadcast 192.168.168.255
        inet6 fe80::ad36:15e:f683:1397  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:e9:f4:c0  txqueuelen 1000  (Ethernet)
        RX packets 952  bytes 71634 (69.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2127  bytes 2588841 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 29  bytes 1904 (1.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 1904 (1.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c0:25:e9:18:58:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:bc:a1:95  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Do you have an idea what the problem could be? I use a RP 3 with the "Raspbian strech" and a additional WLAN USB stick (wlan1). wlan0 is build in

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Tue Nov 14, 2017 11:34 pm

wlan0 is not getting an ip address.

If you followed the example in the online docs, the dhcpcd service probably failed.

Check the services.

Code: Select all

sudo service hostapd status
sudo service dnsmasq status
Both should show active (running).
If either shows active (exited), you have a problem.

I can tell you there will be problems using the default interface names. You should use the predictable names.

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 6:49 am

That was a really good idea (Raspi-config 7->7)! Now my wlan0 interface has a static IP Adress.

Code: Select all

enxb827ebe9f4c0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.168.20  netmask 255.255.255.0  broadcast 192.168.168.255
        inet6 fe80::ad36:15e:f683:1397  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:e9:f4:c0  txqueuelen 1000  (Ethernet)
        RX packets 876  bytes 77857 (76.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1867  bytes 2322472 (2.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 29  bytes 1904 (1.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 1904 (1.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::615d:9ff8:27bc:5b5b  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:bc:a1:95  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 33  bytes 4980 (4.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlxc025e91858b8: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c0:25:e9:18:58:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Now I have to check my config files again. The Status is active (running) but the interface wlan0 was not found. I thinke there are some problems with my config files. I have tried a lot different configuration in the last days to set the IP address static. Maybe I have done something wrong.
I have to work now and will be back in round about 12h.

Currently it looks like that:

Code: Select all

dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-11-15 06:36:22 UTC; 8min ago
  Process: 508 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 473 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 431 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 505 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
           └─505 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dp

Nov 15 06:36:22 raspberrypi dnsmasq[505]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset 
Nov 15 06:36:22 raspberrypi dnsmasq[505]: warning: interface wlan0 does not currently exist
Nov 15 06:36:22 raspberrypi dnsmasq-dhcp[505]: DHCP, IP range 192.168.1.2 -- 192.168.1.20, lease time 1d
Nov 15 06:36:22 raspberrypi dnsmasq[505]: read /etc/hosts - 5 addresses
Nov 15 06:36:22 raspberrypi dnsmasq[505]: no servers found in /run/dnsmasq/resolv.conf, will retry
Nov 15 06:36:22 raspberrypi dnsmasq[508]: Too few arguments.
Nov 15 06:36:22 raspberrypi dnsmasq[508]: Too few arguments.
Nov 15 06:36:22 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Nov 15 06:36:30 raspberrypi dnsmasq[505]: reading /run/dnsmasq/resolv.conf
Nov 15 06:36:30 raspberrypi dnsmasq[505]: using nameserver 192.168.168.1#53

Code: Select all

● hostapd.service - LSB: Advanced IEEE 802.11 management daemon
   Loaded: loaded (/etc/init.d/hostapd; generated; vendor preset: enabled)
   Active: active (running) since Wed 2017-11-15 06:36:22 UTC; 11min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 427 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/hostapd.service
           └─501 /usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf

Nov 15 06:36:21 raspberrypi systemd[1]: Starting LSB: Advanced IEEE 802.11 management daemon...
Nov 15 06:36:22 raspberrypi hostapd[427]: Starting advanced IEEE 802.11 management: hostapd.
Nov 15 06:36:22 raspberrypi systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.

procount
Posts: 817
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 10:06 am

This has been discussed previously...
viewtopic.php?f=36&t=98782
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 11:55 am

Your wlan0 interface is there. If you try to use ifup or ifdown, they will report "wlan0 not found". They don't work with Stretch. These do:

Code: Select all

sudo ip link set wlan0 up
sudo ip link set wlan0 down

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 3:22 pm

"sudo ip link set wlan0 up" is working but with "sudo service dnsmasq status" I get the message:

Code: Select all

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-11-15 06:36:22 UTC; 8h ago
  Process: 508 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 473 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 431 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 505 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
           └─505 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsm

Nov 15 06:36:22 raspberrypi dnsmasq[505]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua T
Nov 15 06:36:22 raspberrypi dnsmasq[505]: warning: interface wlan0 does not currently exist
Nov 15 06:36:22 raspberrypi dnsmasq-dhcp[505]: DHCP, IP range 192.168.1.2 -- 192.168.1.20, lease time 1d
Nov 15 06:36:22 raspberrypi dnsmasq[505]: read /etc/hosts - 5 addresses
Nov 15 06:36:22 raspberrypi dnsmasq[505]: no servers found in /run/dnsmasq/resolv.conf, will retry
Nov 15 06:36:22 raspberrypi dnsmasq[508]: Too few arguments.
Nov 15 06:36:22 raspberrypi dnsmasq[508]: Too few arguments.
Nov 15 06:36:22 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Nov 15 06:36:30 raspberrypi dnsmasq[505]: reading /run/dnsmasq/resolv.conf
@procount I will read this blog today evening. Thanks for that Link!

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 7:08 pm

Both show active (running).

Do you see the ssid of your ap being broadcast?
If so, can you connect to it?
If so, do you get network settings?

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 8:48 pm

yes, I can see the AP, but I don't get an IP address when I try to connect. The status is this:

Code: Select all

 dnsmasq-dhcp[1467]: no address range available for DHCP request via wlan0
this is my config file: /etc/dnsmasq.conf

i think there must be some adress range availalbe between .50 and .100

Code: Select all

interface=wlan0      # Use the require wireless interface - usually wlan0
  dhcp-range=192.168.6.50,192.168.6.100,255.255.255.0,24h

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Wed Nov 15, 2017 9:00 pm

What IP do you have assigned to wlan0? This IP address must be within the range of the entry in /etc/dnsmasq.conf

If you have 192.168.1.1/24 assigned to wlan0, then the address range must be 192.168.1.50 to 192.168.1.100.

I normally recommend not using a network range that may be on the WAN interface. 192.168.0.x/24 and 192.168.1.x/24 are standard. I normally use 192.168.4.x/24

pihome
Posts: 3
Joined: Tue Aug 09, 2016 1:35 pm
Contact: Website

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Thu Nov 16, 2017 11:34 am

I was thinking same thing while back,
ie. have rpi with me and that connects to hotel public wifi and then dial-in to my home openvpn raspberry pi to have secure connection and then broadcast ssid for connection for all Wi-Fi devices but don't know how to get around to hotel web portal. haven't tested it yet but it could be just simple make pi as access point and when connecting pi access point i will be presented with hotel ap web portal ??? to many possibilities may be some one living near by any hotel can do the testing... :D


soeren89 wrote:
Wed Nov 08, 2017 9:18 pm
Hey,

my idea is to connect the raspberry with an existing WLAN (e.g. in a hotel) and build a new WLAN for all my devices. The reason for that is that the most hotel only allow one WLAN device and I would like to create my own WLAN AP.

Optional: It would be great when the Raspberry always start a VPN connection to my FritzBox at home for a secure access in a public WLAN.

Currently I have a Raspberry Pi 3 with an included WLAN module, but I am sure, that I need a second WLAN device (USB WLAN stick).

Does anyone know if this would work? I have some concerns about the WLAN landing page in a hotel. Typically I have to enter a username and password.


Feel free to commend, post some links or something else... Thanks!!
PiHome Smart Heating Control
http://www.pihome.eu

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Thu Nov 16, 2017 12:01 pm

I've set up and used captive portals for condos. Most captive portals rely on the IP address to determine the different users. If this is the case for the captive portal, and you are using your RPi in standalone (NATed) mode with a masquerade, then when one device on the localnet (or the RPi) logs in, the rest have internet access.

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Mon Nov 20, 2017 7:58 pm

My idea was that I can connect with my laptop / mobile phone to the Raspi (personal access point) and start a VNC session. Than you can connect to a hotel wifi and enter the credentials of your account with a normal GUI. But I don'T know a way around the hotel portal (for faster access without paying). That was not my gain of this topic.



At the moment, i can not work with the raspi. My SD cart is damaged and I need a new one.
pihome wrote:
Thu Nov 16, 2017 11:34 am
I was thinking same thing while back,
ie. have rpi with me and that connects to hotel public wifi and then dial-in to my home openvpn raspberry pi to have secure connection and then broadcast ssid for connection for all Wi-Fi devices but don't know how to get around to hotel web portal. haven't tested it yet but it could be just simple make pi as access point and when connecting pi access point i will be presented with hotel ap web portal ??? to many possibilities may be some one living near by any hotel can do the testing... :D

soeren89
Posts: 7
Joined: Wed Nov 08, 2017 8:56 pm

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Mon Nov 20, 2017 8:08 pm

SurferTim wrote:
Wed Nov 15, 2017 9:00 pm
What IP do you have assigned to wlan0? This IP address must be within the range of the entry in /etc/dnsmasq.conf

If you have 192.168.1.1/24 assigned to wlan0, then the address range must be 192.168.1.50 to 192.168.1.100.

I normally recommend not using a network range that may be on the WAN interface. 192.168.0.x/24 and 192.168.1.x/24 are standard. I normally use 192.168.4.x/24
My normal network is 192.168.168.0
My Wlan router is 192.168.168.1


The eth0 is with a cable connected and has this IP: 192.168.168.20
The new Access Point (wlan0) should be 192.168.1.1

/etc/dnsmasq.conf
interface=enxb827ebe9f4c0 #alternativ wlan0 - depends on the configuration before
dhcp-range=192.168.1.2,192.168.1.20,255.255.255.0,24h

SurferTim
Posts: 1010
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Connect to existing WLAN (hotel) and create a new AP for personal devices

Mon Nov 20, 2017 8:22 pm

Your /etc/dnsmasq.conf should have the interface set to the hostpot (wlan0).

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 13 guests