Static IP for CentOS LXC container

LXC containers get dynamic IP from DHCP. When you stop and start a container, its IP gets changed. If you hosting some web application on this container, you need to point the application to new IP. To avoid this, you can configure static IP on the container.

LXC containers get IP in the range To make CentOS container IP static, edit file


Replace with

Add below = replace with any unused IP in the range your LXC container assign using DHCP.

Create a static route file


After restarting the LXC container, you will have a fixed IP.

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *