[lxc-users] DHCP or static ip address?
Yuri Kanivetsky
yuri.kanivetsky at gmail.com
Sat Mar 4 04:47:35 UTC 2017
Sorry for being too succinct. Let me give you more details.
I'm now talking about my developer machine. Where I test
provisioning/deployment, or just run sites in environment similar to
that of production servers.
Now than, what led me to the question? I tried to run Ubuntu and
CentOS recently.
With Ubuntu, Raise network interfaces job sends DHCPDISCOVERs until it
timeouts after 5 min:
[** ] A start job is running for Raise network interfaces (1min 42s / 5min)
Since lxc configures guest OS' NIC to obtain IP via DHCP
https://github.com/lxc/lxc/blob/lxc-2.0.7/templates/lxc-ubuntu.in#L104
After that, pinging IP addresses works, but DNS doesn't. Since
/etc/resolv.conf becomes empty. Before starting container it was a
copy of host OS' /etc/resolv.conf.
When I change `inet dhcp` to `inet static` and add `address` option,
it fails fast with (actually, this is result of `systemctl restart
networking`)
Mar 04 04:40:57 cont1 systemd[1]: Stopped Raise network interfaces.
Mar 04 04:40:57 cont1 systemd[1]: Failed to reset devices.list on
/system.slice/networking.service: Operation not permitted
Mar 04 04:40:57 cont1 systemd[1]: Starting Raise network interfaces...
Mar 04 04:40:57 cont1 systemd[1]: Failed to reset devices.list on
/system.slice/ondemand.service: Operation not permitted
Mar 04 04:40:58 cont1 ifup[158]: RTNETLINK answers: File exists
Mar 04 04:40:58 cont1 ifup[158]: Failed to bring up eth0.
Mar 04 04:40:58 cont1 systemd[1]: networking.service: Main process
exited, code=exited, status=1/FAILURE
Mar 04 04:40:58 cont1 systemd[1]: Failed to start Raise network interfaces.
Mar 04 04:40:58 cont1 systemd[1]: networking.service: Unit entered failed state.
Mar 04 04:40:58 cont1 systemd[1]: networking.service: Failed with
result 'exit-code'.
And again, everything seems to work except name resolution. What do I
do? Thanks in advance.
Regards,
Yuri
More information about the lxc-users
mailing list