1

I would like to create a wifi network which does not have access to the Internet - that should not be a problem as there are plenty of posts already on Stack Exchange covering this topic.

However, what I didn't find on Stack Exchange is how to perform a "switch" - so that the local network gets shutdown and the pi uses a plugged in mobile antenna with a sim card in it to get access to the internet and send data.

Is that even possible? If so, how can I achieve something like that?

Any help would be appreciated :)

  • 1
    It should be possible having two systemd services and start/stop them independently. How do you want to switch? By hand calling a script? – Ingo Jul 15 at 15:12
  • @Ingo the idea would be that the whole thing will be called by an application or something. I am a total newbie and don't even know where to start... Can you give me any advice where I can get started with scripts, how to run them & in general how to get started correctly? – linus_hologram Jul 15 at 21:29
  • Maybe it's better don't to ask how to do things, instead to ask how to achieve best what you want. Perhaps it isn't necessary to switch interfaces? What's your goal? To make an access point only when you do not connect by ppp0? Maybe you can have the access point always running but only switch ppp0. This would things simplify much. – Ingo Jul 15 at 23:22
  • @Ingo thanks for your reply. Unfortunately, I don't know what you mean by ppp0 or "switch interfaces". The reason I have to ask "how to do things" is because I don't know where to start. I can do a basic tutorial specified in the first answer on this post but after that I still don't know how I move on from there. So, do you have any good resource or topic I should check out in order to get started? – linus_hologram Jul 16 at 16:05
1

I use the following with success: Raspberry Pi - Auto WiFi Hotspot Switch Internet. It is interesting because it:

  • either connects to a know WiFi router
  • or automatically generate a Hotspot Access Point if no network is found. In Hotspot mode the RPi gives internet access to WiFi clients if the ethernet cable is plugged to your internet router.

Also, you can read the official doc : Setting up a Raspberry Pi as an access point in a standalone network (NAT). But there is no automatic switch between Hostspot and available known WiFi router.

  • 1
    This is essentially a "link-only" answer, which is discouraged. Answers should contain the essential elements in the body, although links as further references are ok. – Brick Jul 15 at 17:02
1

As seen from your comments it seems that you don't know where to start in general with an access point in conjunction with an USB 4G modem to get connection to the internet. So I will give some general steps to start and to narrow down your requirements.

First you should make your USB 4G modem connect to the internet. I cannot help much about this because there any many models out there and it is off topic on Raspberry Pi. A simple modem with a SIM card usually does not have an antenna so maybe you have a wifi internet router? If you have a modem then if connected to the RasPi it mostly create an interface named ppp0 or sometimes usb0. Doesn't matter about the name. The interfaces can be handled like any other interface e.g. eth0 (built-in wired interface) or wlan0 (built-in wifi interface). If you have a router and connected with an ethernet cable it will create an interface eth1. If connected by wifi it will use wlan1.

If you have made the internet connection running then you can setup a stand alone access point. How to do it you can look at Setting up a Raspberry Pi as an access point - the easy way section ♦ Setting up a stand alone access point.

If you have finished it then please give me feedback in a comment to this answer so we can see how it could go on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.