Mapping ports on the host to a guest


is there any trick available to map a host’s port to a container’s port? I don’t want to NAT it with iptables as that would eventually require masquerading and you lose the source ip info. As it stands the best I can come up with is using something like ldirectord, putting the controller on the host and mapping the containers as real servers, but it’d be neat if there was some magic to do this seamlessly in LXD that I missed. An alternative would be to use something like stunnel or ssh port forward, but again it’d be clunky to maintain.



I think that is being developed at

If you just want to get the source IP for http/https, this can be done through the protocol and it is quite neat.

ah yes, that looks like it, great to know it’s being worked on and for the meantime I guess it’ll have to be ldirectd.