How to set static ip in lxd containers

Hi everyone,
I would like to set static ip address to containers.
For eg: my system ip 192.168.1.18
container ip address 10.1.2.25
i need to change the container ip to 192 series is it possible.

Then you would probably use your routers dhcp for the containers.

simos described two possible solutions for this:


@toby63’s answer should cover you.

You are not asking specifically how to set static IP addresses, it appears you are asking how to get a container to get an IP address from the LAN, and be accessible directly on the LAN.

There are at least four ways to do this, bridged, macvlan, ipvlan, iprouted`.

The easiest of all is macvlan, but the downside is that the container and the host cannot communicate with each other over the network.