Docker Community Forums

Share and learn in the Docker community.

Routing traffic through TUN devices

Hello Docker family,
I’m preparing a small home solution that should connect Raspberry Pi devices located in all my homes to the central server using the OpenVPN server and end clients VPN config.

The OpenVPN server then should be then responsible for routing the traffic between all of them (the reason is that they have no public IP addresses, so the only outgoing VPN connection from them is possible).

The OpenVPN server is to end Raspberry devices assigning IP addresses from network range 192.168.255.0 and traffic is routed via TUN network interface in VPN container running on the central server.

Additionally to the VPN server (kylemanna/openvpn) I would also like to create a small container utilizing the statping (hunterlong/statping) to do simple monitoring of availability end points.

I would like to ask for your kind advice on how to approach this solution, as the monitoring container should be able to reach all the end point Raspberries via VPN network (192.168.255.0) using the TUN device to get their availability.

What is coming to my mind is to do dirty stuff and to statping container and install an open VPN client (it will create a respective TUN device and will configure an IP address from range 192.168.255.0). On the other hand I’m not finding this as a nice solution, because the container will be treated as an additional end point.

The other thing that is coming to my mind is somehow create in statping container TUN device and after configuration of IP address to route somehow traffic between it and between TUN device that is present in VPN container.

Currently I’m using the VPN container in bridge network mode, which I believe is the correct approach, but how to handle communication between TUN devices?

Any other solutions that could be considered?

Many thanks,
Stan