How do I configure a container to forward specific port


(Gordon MacPherson) #1

I'm using Debian 9 Stretch and using LXD "edge".

I've got a few servers I run for a video game, but I'm wanting to move all the servers into their own container for maintainability and so i can do easy host copying using some scripts.

I need to forward the container port for TCP and UDP connections on 27014.

I would like the port on the host to be opened and all traffic be routed to the container, even if the port shares the same IP address as the host, I don't mind. Provided the data is not modified and is bidirectional.

Does anyone know how I can achieve this; I've checked the documentation and noticed that this is a thing you're working towards having support for in an easier capacity, but do you have anything for the short term that I can use while you're working on this?


You can set up iptables rules to forward both TCP and TCP connections to their respective LXD container.
Obviously, each container/gameserver will have a different port.

Here are some instructions on how to do this,