My lxd setup is such that each container gets its own dynamic ip. Let us say, and so on.

If I have some service running on the host, say on port 8080, how can code in the container access this service on the host?

What is the IP of the host from the container's perspective?


Stephane Graber announced LXD "news" today that is going to be great for LXD container networking:


But for your question... if the LXDBR0 bridge is say

Then your "host" address is also

Make sure your firewall (if you are using it) in the host or the container permits that port.

sudo ufw permit 8080

the host service should then be


It depends on your network configuration... if you are using bridging then the host IP address should be in the same subnet as the containers' and so the host should be directly accessible. If you are using a NAT network then you will need to 'route' to the host IP. This is likely via the default gateway should should 'just work'. If you are using a private network then you can't access the host's network interface.

You need to provide more detail about your network configuration if the above doesn't help.

  • ok thanks. I was able to 'ping' the subnet IP (gateway) of lxdbr0 from inside the container. So I assume I will be able to access the service from inside the container. However, rather than getting it work this once, I would like to get the fundamentals of whatever options you've written nailed down. Is there any reference that explains all of the above in layman and practical terms? I will appreciate if you can share it.
    – deepakkt
    Sep 28 '16 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.