[Lxc-users] retrieve guest container's ip address
Alan McDuff
alan.mcduff at yahoo.com
Sat Jan 5 11:21:21 UTC 2013
Hello,
since Ubuntu 12.04 made it very simple to create a lxc guest, I was able to start experimenting with lxc.
I create and run the container using:
lxc-create -t ubuntu -n guest1
lxc-start -n guest1 -d
But how do I get the ip address of the guest, which I think is assigned by a dhcp server running on the host? I need to automate this to work in a shell script.
Running "lxc-start -n guest1" without daemon mode and then typing "ifconfig" inside the container is no option, because this works only interactively.
Running "lxc-execute -n guest1 ifconfig" doesn't show the address, because the network seems not to be set up with lxc-execute, and lxc-execute can only execute in a stopped container.
Scanning the guest network using nmap for open ssh ports works, but is slow and needs trial and error to find the correct guest if more than one are runnign in the scanned range.
Is there something like an "lxc-ifconfig" command?
Also, instructions would help that explain how to login using the hostname ("ssh ubuntu at guest1"). But I would need instructions that work specifically with ubuntu 12.04. I found numerous tips for lxc under debian, but I can't figure out how to make them work for ubuntu.
Thanks
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130105/7692505f/attachment.html>
More information about the lxc-users
mailing list