• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Wifi in a Container
How can I use Wifi (in client mode) from within a container?

I'm using hilschernetpi/netpi-nodered-fieldbus:latest with Network=host and would like to connect to the cloud using Wifi instead of eth0.
What do I need to do to enable the Wifi within the container?
Hello Iotuser,

this is very easy. If you use the option "network=host" then docker starts the container using the same TCP/IP stacks as the Linux Host system. In this case it is not a matter of the physical interfaces eth0 and wifi any more, but just a matter of the ip addresses that you have configured.

So make a simple test:
If you configure the eth0 IP address of netPI to for example then you can reach the node-red under
If you now configure the wifi address of netPI to for example (in access point mode) and you connect your mobile phone to this wifi network getting then you can reach node-red under also.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Hello Armin
Thanks for the fast response!

Accessing the node-red UI over Wifi works fine.
What I like to do is to connect my node-red to an Azure IoT Hub using the Wifi connection which fails with a "EHOSTUNREACH" error (using https 443 as outgoing port) .
The same scenario using eth0 worked fine. Any additional configuration required for this?

Best Regards
Hello iotuser,

just to understand it right. You have a Wifi network active and a router that is providing an IP address to netPI over Wifi. Is that correct? In this case netPI operates as a "Wifi Client"

Now you have two networks in netPI active. eth0 and wlan0. In both configuration settings you will have next to the ip address, also a subnet mask and also a gateway active, right?

Now if the node-red container wants to "send something" it has two interfaces eth0 and wlan0 where he is able to send it, but now he does not know which interface shall be used for sending out data. Linux in this case does it in a very practical way: it uses the first interface that has a gateway address and sends data across this one found first. In your case it will be eth0.

So in order to get data be sent across wlan0, you have to delete the gateway address of interface eth0. Then linux will use the gateway of wlan0 address instead and will send your data over your Wifi router

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

Hello Armin

Deleting the Gateway address solved the issue.
Thanks a lot! I knew it must be something stupid...

Thank you for your feedback
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)


Possibly Related Threads...
Thread Author Replies Views Last Post
  Exporting and importing container images Armin@netPI 3 46 May-20th-2020, 11:24 AM
Last Post: COswald
Exclamation Creating a container Linnerz 6 40 March-6th-2020, 02:47 PM
Last Post: Armin@netPI
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 97 October-21st-2019, 10:30 AM
Last Post: Armin@netPI
  Cannot start container Magnus 7 43 October-16th-2019, 01:00 PM
Last Post: Armin@netPI
  Generate VLAN interfaces in container FrankJacob 7 46 September-26th-2019, 03:19 PM
Last Post: Armin@netPI
  create container in Portainer v1.12.4 dcatteeu 2 26 September-9th-2019, 12:12 PM
Last Post: dcatteeu
  UMTS/LTE support via USB router/modem sticks in a container Armin@netPI 3 159 September-5th-2019, 02:07 PM
Last Post: Armin@netPI
  Ready-to-deploy: full featured Node-RED container Armin@netPI 5 89 July-25th-2019, 06:16 AM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 25 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  Official Node-RED container Armin@netPI 0 21 April-5th-2019, 10:39 AM
Last Post: Armin@netPI

Forum Jump:

Users browsing this thread: 1 Guest(s)