Question

How do I use additional addresses within a VPC?

I have an Ubuntu 20.04 droplet running LXC. By default, LXC containers uses a network local to the host/droplet. However, I want to “bridge” the container’s network and assign each container an IP address from the VPC. This way, other droplets on the VPC can access the container directly, without having to port forward through the LXC host droplet.

On my home network, this works fine – when I bridge the container’s network, the container effectively acts as another physical host on my LAN and uses network’s DHCP server to assign itself an IP address.

How does this work in a Digital Ocean VPC? If I tell LXC to bridge on eth1 (the private network adapter), will it use DHCP and get its own address? Will it avoid addressing conflicts with other droplets and containers on the same network? Or do I have to run my own DHCP server or something?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi,

Unfortunately DHCP will not work in VPC, even if you set up your own DHCP server. Due to DO doc, VPCs do not support broadcast. You could assign IP addresses by hand, but even then communication inside your VPC would not work straightaway. Look at this post for more info. My answer is a bit simplified there, however, it outlines the problem.