Use lxcbr0 as bridge

lxcbr
devrandom 12 years ago
parent 93d443077e
commit 684f6c9427

@ -76,10 +76,10 @@ Recent distributions allow lxc-start to be run by non-priviledged users, so you
If you have a runaway `lxc-start` command, just use `kill -9` on it. If you have a runaway `lxc-start` command, just use `kill -9` on it.
The machine configuration requires access to br0 and assumes that the host address is 10.0.2.2: The machine configuration requires access to lxcbr0 and assumes that the host address is 10.0.3.1 . If lxc does not configure lxcbr0 on boot, you can do so manually:
sudo brctl addbr br0 sudo brctl addbr lxcbr0
sudo ifconfig br0 10.0.2.2/24 up sudo ifconfig lxcbr0 10.0.3.1/24 up
## Tests ## Tests

@ -16,12 +16,6 @@ usage() {
--suite U build suite U instead of lucid --suite U build suite U instead of lucid
--arch A build architecture A (e.g. i386) instead of amd64 --arch A build architecture A (e.g. i386) instead of amd64
--lxc use lxc instead of kvm --lxc use lxc instead of kvm
The MIRROR_HOST environment variable can be used to change the
apt-cacher host. It should be something that the target VM can
resolve. It may be set to 127.0.0.1, in which case it will be
changed to 10.0.2.2 on the guest. 10.0.2.2 is the host IP as visible
from the guest under qemu networking.
EOF EOF
} }

@ -23,10 +23,11 @@ lxc.cgroup.devices.allow = c 254:0 rwm
lxc.mount.entry=proc ROOTFS/proc proc nodev,noexec,nosuid 0 0 lxc.mount.entry=proc ROOTFS/proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0 lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0
# Container with network virtualized using a pre-configured bridge named br0 and # Container with network virtualized using a pre-configured bridge named lxcbr0
# veth pair virtual network devices # and veth pair virtual network devices.
# On the host, run: ifconfig br0 up 10.0.2.2 # On the host, run (lxc might already have done this):
# ifconfig lxcbr0 up 10.0.3.1
lxc.network.type = veth lxc.network.type = veth
lxc.network.flags = up lxc.network.flags = up
lxc.network.link = br0 lxc.network.link = lxcbr0
lxc.network.ipv4 = 10.0.2.5/24 lxc.network.ipv4 = 10.0.3.5/24

@ -1,4 +1,13 @@
#!/bin/bash #!/bin/bash
set -e
if ifconfig lxcbr0 > /dev/null 2>&1; then
true
else
echo "Must configure lxcbr0 - check the README"
exit 1
fi
wd=`pwd` wd=`pwd`
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config

@ -48,5 +48,5 @@ if [ -z "$USE_LXC" ]; then
qemu-img create -f qcow2 -o backing_file="$BASE.qcow2" "$OUT.qcow2" qemu-img create -f qcow2 -o backing_file="$BASE.qcow2" "$OUT.qcow2"
else else
cp -a $BASE $OUT cp -a $BASE $OUT
on-target -u root bash < target-bin/bootstrap-fixup on-target -u root /root/firstboot.sh
fi fi

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -e
. gconfig . gconfig
TUSER=ubuntu TUSER=ubuntu

@ -2,5 +2,15 @@
set -e set -e
echo 'deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu lucid main universe' > $1/etc/apt/sources.list ip=`hostname --all-ip-addresses | cut -d ' ' -f1 | cut -d. -f1-3`
echo 'deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu lucid-updates main universe' >> $1/etc/apt/sources.list
if [ $ip = "10.0.3" ]; then
# LXC
MIRROR_HOST_ON_GUEST=${MIRROR_HOST_ON_GUEST:-10.0.3.1}
else
# KVM
MIRROR_HOST_ON_GUEST=${MIRROR_HOST_ON_GUEST:-10.0.2.2}
fi
echo "deb http://$MIRROR_HOST_ON_GUEST:3142/archive.ubuntu.com/ubuntu lucid main universe" > $1/etc/apt/sources.list
echo "deb http://$MIRROR_HOST_ON_GUEST:3142/archive.ubuntu.com/ubuntu lucid-updates main universe" >> $1/etc/apt/sources.list

Loading…
Cancel
Save