Rancher LB port range mapping

So I found this question: Rancher LB port range

One of the comment replies reads “You can do --net=host and then the server container can listen on whatever it wants… But not with a load balancer container.”

My setup is. I have a Host which consists of multiple stacks that runs a loadbalancer.

Capture

So requests get into my VM (where the host is running) via their networking, I accept connects through a port, direct them to a port on my app. The LB then listens to that port and directs to the correct container. Works fine.

Now, I’m trying to add a new container, that can handle multiple ssh sessions across a range of ports.

Locally in the docker-compose file I can do

ports:
    - 4000-4050:4000-4050

which will open up a range of 50 ports and map them from my host to my container and works fine.

I’m unsure how I can achieve this in Rancher. I’ve read you can achieve it by using the network_mode: host in the docker-compose file.

However, i’m unsure how this actually works and even though i can open up those ports/port-ranges on the networking side of my VM. The container that I want to direct to is still within the host/stack that the LB sits in.

Does anyone have any experience/knowledge that could point me in the right direction?