...
Also, change the default DHCP range,
Code Block | ||
---|---|---|
| ||
# NOTE you can't use these commands as is... because "lxd init" randomly picks the ip subnet.
# When time permits can create scripts on top to compensate.
sudo sed -i 's/LXD_IPV4_DHCP_RANGE="10.232.27.2,10.232.27.254"/LXD_IPV4_DHCP_RANGE="10.232.27.100,10.232.27.254"' /etc/default/lxd-bridge
sudo sed -i 's/LXD_IPV4_DHCP_MAX="252"/LXD_IPV4_DHCP_MAX="154"' /etc/default/lxd-bridge |
...
Create a dnsmasq.conf file where you may reserve IP Addresses based on server names,
... refer to the LXC instructions until incorporated here...
Modify /etc/default/lxd-bridge to reference an external dnsmasq.conf file,
Code Block | ||
---|---|---|
| ||
sudo cp /etc/default/lxd-bridge /etc/default/lxd-bridge.ori # This line does not work yet, I need lookup how to escape the /. # EDIT: should work now - samir sudo sed -i 's/LXD_CONFILE=""/LXD_CONFILE="\/opt\/lxd\/dnsmasq.conf"/' /etc/default/lxd-bridge |
Restart the services to make sure things went well,
Code Block | ||
---|---|---|
| ||
sudo service lxd-bridge stop
sudo service lxd-bridge start |
Reference
http://jason.trickett.us/2016/08/lxd-containers-static-ip-addresses-heres/ - Source article for this but missing some details on changing the default range otherwise you'll end up with collisions.