I'm usung the lxc-start-ephemeral utility in Ubuntu 12.10. I've noticed that the ephemeral container starts up pretty quickly, but that it takes a long time (~20s) before ifconfig shows an ip address for its eth0 interface. I'd like to reduce this delay by as much as I can.
According to this post, the delay is due to dhcp. I followed the suggestion in the post and wrote a script that modifies the container's /etc/network/interfaces file to look like this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.0.3.$LXC_ADDRESS
netmask 255.255.255.0
Now, the container's ip address is ready right away, and ssh ubuntu@10.0.3.$LXC_ADDRESS works fine. However, the container can't connect to the internet, for example ping www.google.com doesn't work.
What additional configuration do I need to do to correct this problem?
In case it helps, here's the container's current eth0 interface from ifconfig (with LXC_ADDRESS=131):
You actually can (I'm assuming) connect to the internet, you just don't have name service, because you're not running dhcp so you didn't get a resolv.conf.
Just put
nameserver 10.0.3.1
into /etc/resolv.conf in the container, (or just copy the resolv.conf from your host).
(If your container is running resolvconf, you might need to also put that line into /etc/resolvconf/resolv.conf.d/head in the container)