0

I got a Flask Server I run in localhost and I want for devices to access it without the need for internet. I read that it may be possible by setting up a LAN network and I wonder if its possible to create one with Ubuntu and use it for devices to connect to that network wirelessly and access the services provided by my Flask application.

  • Do I need a router to achieve this?
  • How can I configure my Ubuntu 21 machine to be accessed by other devices such as Android or Raspberry without the need for an internet connection?

I've been looking for ways to do it and all I see are tutorials that assume one has an internet connection.

1 Answers1

0

What you actually need is a Wireless Access Point (AP), often built-in in wireless internet routers. You may turn your machine into an AP by using the WiFi-HotSpot-Feature from Ubuntu (more Details), so you dont need an extra hardware.

That way your clients should be able to connect wirelessly to your machine and then, all devices are in (W)LAN. You need to specify the same subnetmask on all clients and every client needs a unique IP-Adress from the same subnet, for example:

  • IP: 192.168.1.x (replace x by any number between 1 and 254)
  • Subnetmask: 255.255.255.0

Finally you need to setup your Flask-Server to listen on your machines IP-Address instead of localhost or 127.0.0.1. I don't know Flask, maybee use the --host flag ?

If you use the flask executable to start your server, use flask run --host=0.0.0.0 to change the default from 127.0.0.1 and open it up to non-local connections. (more Details)