0

is there a possibility to add an additional route to the host table (ubuntu 20.04 LTS) with docker toolset after starting a docker container?

context:

  • Docker version 20.10.12, build e91ed57
  • installed wireguard as container (image: lscr.io/linuxserver/wireguard )
  • wireguard container has IP 172.19.0.2
  • wireguard network is 10.14.14.0
  • wireguard host peer has ip 10.14.14.1
  • wireguard clients peers have 10.14.14.2 3 4 and so on
  • a standard route will be created to route from host network to container network ( 192.168.2.0 → 172.19.0.0)
  • Setup Is Working so far, as long as all connections are built up by wireguard clients (they can connect to NAS in home network etc CIFS, WebDav, Webfrontend)

As soon as I want to use RDP, VoIP-client or other protocols where the server (e.g. rdp server) wants to establish a connection back to the client (e.g. rdp client) the setup isn’t working anymore.

EXCEPT I activate IP forwarding and set a route to 10.14.14.0 via 172.19.0.2 then also RDP and so on is working.

so far so good… but after a reboot the route disappears / is not there anymore of course. I am not able to set the route via netplan or so because the target isn’t available. Container needs to be started first.

Is there an option or possibility with docker toolset to run a script with the routing statement as soon as the wireguard container was started? Maybe I missed something.

This would be an more elegant option then to use standard linux approaches due to it relates to a docker context.

If there is no solution with docker toolset how could I achieve to set a route after the container was started?

best regards and thank you for your support

0 Answers0