07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

oot@scouzmir:~#<br />

Note that the filesystem is initially created in /var/cache/lxc, then moved to its destination<br />

directory. This allows creating identical containers much more quickly, since only copying is<br />

then required.<br />

Note also that the lxc-debian command as shipped in Squeeze unfortunately creates a Lenny<br />

system, and not a Squeeze system as one could expect. This problem can be worked around by<br />

simply installing a newer version of the package (starting from 0.7.3-1).<br />

The newly-created filesystem now contains a minimal Debian system, adapted to the aforementioned<br />

“simple” network configuration. In the “rich” configuration, the /var/lib/lxc/<br />

testlxc/rootfs/etc/network/interfaces file will need some modifications; more important,<br />

though, is that the network interface that the container sees must not be the host's physical<br />

interface. This can be configured by adding a few lxc.network.* entries to the container's<br />

configuration file, /var/lib/lxc/testlxc/config:<br />

lxc.network.type = veth<br />

lxc.network.flags = up<br />

lxc.network.link = br0<br />

lxc.network.hwaddr = 4a:49:43:49:79:20<br />

These entries mean, respectively, that a virtual interface will be created in the container; that<br />

it will automatically be brought up when said container is started; that it will automatically be<br />

connected to the br0 bridge on the host; and that its MAC address will be as specified. Should<br />

this last entry be missing or disabled, a random MAC address will be generated.<br />

12.2.2.4. Starting the Container<br />

Now that our virtual machine image is ready, let's start the container:<br />

root@scouzmir:~# lxc-start --name=testlxc<br />

INIT: version 2.86 booting<br />

Activating swap...done.<br />

Cleaning up ifupdown....<br />

Checking file systems...fsck 1.41.3 (12-Oct-2008)<br />

done.<br />

Setting kernel variables (/etc/sysctl.conf)...done.<br />

Mounting local filesystems...done.<br />

Activating swapfile swap...done.<br />

Setting up networking....<br />

Configuring network interfaces...Internet Systems Consortium DHCP Client V3.1.1<br />

Copyright 2004-2008 Internet Systems Consortium.<br />

All rights reserved.<br />

For info, please visit http://www.isc.org/sw/dhcp/<br />

Listening on LPF/eth0/52:54:00:99:01:01<br />

Sending on LPF/eth0/52:54:00:99:01:01<br />

Sending on Socket/fallback<br />

DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4<br />

DHCPOFFER from 192.168.1.2<br />

DHCPREQUEST on eth0 to 255.255.255.255 port 67<br />

DHCPACK from 192.168.1.2<br />

bound to 192.168.1.243 -- renewal in 1392 seconds.<br />

330 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!