Skip to content

Instantly share code, notes, and snippets.

@noelbk
Created September 23, 2014 21:06
Show Gist options
  • Save noelbk/67cd694515b3ec799afb to your computer and use it in GitHub Desktop.
Save noelbk/67cd694515b3ec799afb to your computer and use it in GitHub Desktop.
ip link add lxcveth0 type veth peer name lxcveth1
ip link set lxcveth0 up
ip addr add 10.27.6.101/32 peer 10.27.6.102/32 dev lxcveth0
tee /etc/lxc/u1.conf <<EOF
lxc.network.type = phys
lxc.network.link = lxcveth1
lxc.network.name = eth0
lxc.hook.start = /eth0-up
EOF
lxc-create -n u1 -f /etc/lxc/u1.conf
tee /etc/lxc/u1/rootfs/eth0-up <<EOF
#! /bin/sh
ip link set eth0 up
ip addr add 10.27.6.102/32 peer 10.27.6.101/32 dev eth0
ip route add default via 10.27.6.101 dev eth0
EOF
chmod a+x /etc/lxc/u1/rootfs/eth0-up
lxc-start -n u1 -d --logfile /tmp/lxc.log --logpriority DEBUG
lxc-attach -n u1 -s NETWORK -- /usr/sbin/bird -c /etc/bird/bird-lxc.conf -u bird -g bird -P /var/run/bird/bird-lxc.pid -s /var/run/bird-lxc.ctl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment