Score:5

Setting up an Access Point, Raspberry Pi, and Laptop to serve a website in a classroom. "The internet in a suitcase"

cn flag

Our trainers experience bad internet connections at some schools. I would like to provide them with a "mobile" (as in take it on the train) version of our platform running on a laptop, which the students can connect to directly via a private WiFi network. "The internet in a suitcase".

Equipment:

Past Progress:

As a proof of concept, I was able to serve the platform on ubuntu with the wifi set to AP mode - this would not be sufficient in a real-world setting because of the range, and simultaneous connections limitations.

Help:

I am generally looking to be pointed in the right direction with some keywords I might be missing, or told "no, none of this will work" - the crux of it is:

What do I need to do with the Raspberry Pi / Laptop / Access Point to allow users connected to the access point to access the website via their browser i.e type in portable.xyz.com in the address bar of their smartphone, get served a website running on the laptop?

My Guesstimate:

  • On the Raspberry Pi

    • set up a DHCP server because the AP doesn't have one.
    • set up a DNS server so that portable.xyz.com would point somewhere.
    • set up the controller software for the Access Point.
  • On the laptop

    • Set up the server and make sure it's serving on port:443/80 (there are other services on other ports so set them up too).
    • ? I am not sure how the Raspberry Pi knows that there is a server on the laptop.
      • Is it the relationship between the DHCP IP address configuration and the laptop's IP address (which I would have to configure as fixed)? The DNS setting for portable.xyz.com would then have A records pointing to the laptop's fixed IP?

Other info:

We expect the typical load to be 15 - 100 simultaneous connections, on a range of hardware (tablets, cellphones, laptops).

The platform is not incredibly data-intensive (mostly text and images), but there is a lot of traffic flying around i.e. collaborative text editors, notifications ...etc

Dismissing the "No internet connection available on this wireless network" notification on smartphones is not a problem.

ChrisG avatar
tk flag
It's way less complicated: as long as the access point supports DHCP, just set that up, then have the Pi connect to the Wifi (or wired) and set it up to serve the website. Done. To see the website, connect the laptop (or any other device) to the Wifi as well and enter the Pi's IP address in the browser: you'll get served the website. Or enter the Pi's hostname instead. If you want to serve the website from the laptop instead, you don't need the Pi at all. On Windows 10 you can also use Mobile Hotspot, so you don't even need an access point for this: the laptop will act as AP and web server.
cn flag
Thanks, Chris! I tried the mobile hotspot route on ubuntu, and it worked, but the connection and range limitations of the laptop's wireless were too limiting. The AP doesn't support DHCP unfortunately. And the Pi is not powerful enough to run the website.
Score:6
us flag

That all sounds like a perfectly sensible solution to your problem, and you've more or less answered your own questions correctly already.

Specifically:

I am not sure how the Raspberry Pi knows that there is a server on the laptop.

The raspberry pi doesn't need to "know" anything about the laptop. Clients accessing the website will do so in a browser, by putting in the hostname portable.xyz.com which you will resolve using the DNS server running on the pi in your solution to the IP address of the laptop, which will then serve the content based on its web server configuration. This leads to your next question:

Is it the relationship between the DHCP IP address configuration and the laptop's IP address (which I would have to configure as fixed)? The DNS setting for portable.xyz.com would then have A records pointing to the laptop's fixed IP?

Yes, the easiest thing to do in this scenario would be to configure the laptop with a fixed IP (which you can do either via a DHCP reservation or by configuring a fixed IP manually on the laptop), and adding a DNS record on the pi for the laptop. One solution to this might be to just use the laptop's hostname to connect to the website, as some dhcp/dns servers will automatically register reserved hosts in DNS (e.g. dnsmasq)

As an aside, two points:

  1. What we've described above is basically a build-your-own-WiFi-router setup but using a separate access point and router (the router in this case is the raspberry pi). You might consider simplifying the setup to just purchasing an inexpensive WiFi-enabled router to handle all of the above instead.
  2. You may have a reason for using a separate laptop to host the web content, but an alternative would be to serve it also from the raspberry pi (if you do end up using one).
cn flag
Wonderful - Thank you! To clarify the last two points: 1. There isn't much budget available, and l think!? in terms of the most simultaneous connections, and the best range, an access point + the pi in my desk draw was the best value. Are inexpensive routers configurable enough to alter DNS settings in a similar manner to dnsmasq? 2. Performance, while there isn't all that much data being transferred, we do some pretty demanding work behind the scenes. And I like the idea/flexibility of being able to stick a network cable between anything with a fixed IP, and a DNS entry on the Pi!
2e0byo avatar
ec flag
@Allansideas any cheapy modern router running OpenWRT would be able to do the dns for you. If you need more than one of these systems you might want to look at building it that way, particularly given the current inability to get hold of Pis...
cn flag
Do you even need the raspi? It sounds like all the things it would do you could also directly run on the Ubuntu laptop.
us flag
@Bergi that's true, good point! To be honest given the description, actually the simplest solution is probably just to run dnsmasq (or similar) on the Ubuntu laptop and also set it up as a WiFi hotspot. Job done!
us flag
@Allansideas yes, inexpensive routers often have the configurability to do what you need (although the recommendation in another comment to flash a cheap router with OpenWRT is a good one as that gives a lot of flexibility in configuration). However I do think that just configuring the laptop to do all of the above is a very good option given budget concerns.
cn flag
@BE77Y - "run dnsmasq (or similar) on the Ubuntu laptop and also set it up as a WiFi hotspot" - That's exactly what I did for the proof of concept, but the limitations of the WiFi card in the laptop were why I started looking into Access Points, and Raspberry Pi's, One of the scenarios where we would test/use the setup would be two adjacent classrooms, each with 30 odd students. Perhaps setting up DHCP and DNS on the Laptop, and plugging in the AP directly would work, but easier would be to get the cheap router, then plug the access point in there?
us flag
@Allansideas OK fair enough - in which case yes, IMO the simplest solution (which I would personally pick) would be to purchase an inexpensive router, flash it with OpenWRT (if possible) and do it that way. You could plug the AP into the laptop as you say but it may make more sense just to get a router to do all of the router-like jobs really.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.