Docker Community Forums

Share and learn in the Docker community.

Docker-compose split routing with physical interfaces


My homelab server has two physical interfaces. I’ve named them vpn and wan respectively within the host OS. My router is setup as such that packets with a source address of the IP assigned to wan go out through my ISP gateway, whereas packets with a source destination of the IP assigned to vpn go out through my openvpn gateway.

I have multiple docker containers on my homelab server and I wished to send traffic from some (namely game servers) through my wan connection and other containers out through the vpn connection.

HOWEVER, I’ve continuously had troubles getting this to work. It seems like it would be an easy thing to do. I’ve attached an illustration of my setup and the test I put together to show my bad results. The host results are also within the image showing that routing does work properly outside of the containers.

Ultimately the questions are
is my docker-compose test file right?
does even work?
is docker somehow not correctly NAT’ing the given networks with the actual correct IP?

Does anyone have any ideas?