<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić's random unstructured stuff: LXC</title>
  <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/</id>
  <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?lxc"/>
  <link xmlns="http://www.w3.org/2005/Atom" type="application/atom+xml" rel="self" href="https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443/feed/workspace/rot13?page=lxc;type=Atom"/>
  <updated xmlns="http://www.w3.org/2005/Atom">2011-05-18T07:12:31Z</updated>
  <entry xmlns="http://www.w3.org/2005/Atom">
    <title xmlns="http://www.w3.org/2005/Atom">LXC</title>
    <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?lxc"/>
    <content xmlns="http://www.w3.org/2005/Atom" type="html">&lt;div&gt;Creator: Dobrica Pavlinušić&lt;/div&gt;&lt;hr/&gt;&lt;div class="wiki"&gt;
&lt;span class="nlw_phrase"&gt;&lt;img alt="linux-containers.png" src="https://saturn.ffzg.hr/rot13/index.cgi/linux-containers.png?action=attachments_download;page_name=lxc;id=20110518071231-0-24684" /&gt;&lt;!-- wiki: {image: linux-=containers.png} --&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;
This are notes for my LXC workshop, in state of flux&lt;/p&gt;
&lt;div class="nlw_phrase"&gt;&lt;table class="wafl_container"&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;div class="wafl_box"&gt;
        
          &lt;div class="wafl_titlebox"&gt;
            &lt;div class="wafl_title"&gt;
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="wafl_items"&gt;
            
              &lt;div class="wiki"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#cgroups"&gt;Dobrica Pavlinušić's random unstructured stuff (Cgroups)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Cgroups} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#systemd"&gt;Dobrica Pavlinušić's random unstructured stuff (Systemd)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Systemd} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc"&gt;Dobrica Pavlinušić's random unstructured stuff (LXC)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] LXC} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc_inside_kvm_for_testing"&gt;Dobrica Pavlinušić's random unstructured stuff (LXC inside KVM for testing)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] LXC inside KVM for testing} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#setup_kvm_lxc_test_machine"&gt;Dobrica Pavlinušić's random unstructured stuff (setup KVM LXC test machine)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] setup KVM LXC test machine} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_1_create_a_root_filesystem_for_the_kvm_system"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 1: Create a root filesystem for the KVM system.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 1: Create a root filesystem for the KVM system.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_2_build_a_kernel_for_kvm_with_container_support"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 2: Build a kernel for KVM, with container support.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 2: Build a kernel for KVM, with container support.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_3_boot_the_result_under_qemu_or_kvm"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 3: Boot the result under QEMU or KVM)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 3: Boot the result under QEMU or KVM} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_4_ssh_into_the_kvm_instance"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 4: ssh into the KVM instance.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 4: ssh into the KVM instance.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_5_set_up_a_simple_busybox_based_container_under_the_kvm_system"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 5: Set up a simple busybox-based container under the KVM system.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 5: Set up a simple busybox-=based container under the KVM system.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_6_launch_the_container"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 6: Launch the container)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 6: Launch the container} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_7_stop_the_container_and_the_kvm_system"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 7: Stop the container, and the KVM system.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 7: Stop the container, and the KVM system.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#setup_networking"&gt;Dobrica Pavlinušić's random unstructured stuff (Setup networking)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Setup networking} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_1_add_a_tap_interface_to_the_laptop"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 1: Add a TAP interface to the Laptop.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 1: Add a TAP interface to the Laptop.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_2_launch_kvm_with_two_ethernet_interfaces"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 2: Launch KVM with two ethernet interfaces.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 2: Launch KVM with two ethernet interfaces.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_3_set_up_a_new_container_in_the_kvm_system"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 3: Set up a new container in the KVM system.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 3: Set up a new container in the KVM system.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#step_4_fun_with_routing"&gt;Dobrica Pavlinušić's random unstructured stuff (Step 4: Fun with routing.)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Step 4: Fun with routing.} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#network_hints"&gt;Dobrica Pavlinušić's random unstructured stuff (network hints)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] network hints} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#prepare_host_machine"&gt;Dobrica Pavlinušić's random unstructured stuff (prepare host machine)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] prepare host machine} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#macvlan"&gt;Dobrica Pavlinušić's random unstructured stuff (macvlan)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] macvlan} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#veth"&gt;Dobrica Pavlinušić's random unstructured stuff (veth)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] veth} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#host_only_bridge"&gt;Dobrica Pavlinušić's random unstructured stuff (host-only bridge)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] host-=only bridge} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#pseudo_random_mac"&gt;Dobrica Pavlinušić's random unstructured stuff (pseudo-random mac?)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] pseudo-=random mac?} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#slow_network"&gt;Dobrica Pavlinušić's random unstructured stuff (slow network?)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] slow network?} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#phys"&gt;Dobrica Pavlinušić's random unstructured stuff (phys)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] phys} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#limit_container_resources"&gt;Dobrica Pavlinušić's random unstructured stuff (limit container resources)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] limit container resources} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#cpuset_cpus"&gt;Dobrica Pavlinušić's random unstructured stuff (cpuset.cpus)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] cpuset.cpus} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#cpu_shares"&gt;Dobrica Pavlinušić's random unstructured stuff (cpu.shares)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] cpu.shares} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#memory"&gt;Dobrica Pavlinušić's random unstructured stuff (memory)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] memory} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#disk"&gt;Dobrica Pavlinušić's random unstructured stuff (disk)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] disk} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#usage"&gt;Dobrica Pavlinušić's random unstructured stuff (usage)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] usage} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#limit_disk_bandwith_using_cgroup_blkio"&gt;Dobrica Pavlinušić's random unstructured stuff (limit disk bandwith using cgroup blkio)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] limit disk bandwith using cgroup blkio} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#network"&gt;Dobrica Pavlinušić's random unstructured stuff (network)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] network} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc_commands"&gt;Dobrica Pavlinušić's random unstructured stuff (LXC commands)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] LXC commands} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc_create"&gt;Dobrica Pavlinušić's random unstructured stuff (lxc-create)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] lxc-=create} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc_execute"&gt;Dobrica Pavlinušić's random unstructured stuff (lxc-execute)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] lxc-=execute} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#lxc_attach"&gt;Dobrica Pavlinušić's random unstructured stuff (lxc-attach)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] lxc-=attach} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#devices"&gt;Dobrica Pavlinušić's random unstructured stuff (devices)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] devices} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#monitoring"&gt;Dobrica Pavlinušić's random unstructured stuff (monitoring)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] monitoring} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#htop"&gt;Dobrica Pavlinušić's random unstructured stuff (htop)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] htop} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#procfs"&gt;Dobrica Pavlinušić's random unstructured stuff (procfs)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] procfs} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#debugging"&gt;Dobrica Pavlinušić's random unstructured stuff (debugging)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] debugging} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#kernel_patches"&gt;Dobrica Pavlinušić's random unstructured stuff (kernel patches)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] kernel patches} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#are_we_in_container"&gt;Dobrica Pavlinušić's random unstructured stuff (Are we in container?)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Are we in container?} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#32_bit_guest_on_64_bit_kernel"&gt;Dobrica Pavlinušić's random unstructured stuff (32-bit guest on 64-bit kernel)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] 32-=bit guest on 64-=bit kernel} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#container_tweaks"&gt;Dobrica Pavlinušić's random unstructured stuff (Container tweaks)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Container tweaks} --&gt;&lt;/span&gt;&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#udev"&gt;Dobrica Pavlinušić's random unstructured stuff (udev)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] udev} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#nfs"&gt;Dobrica Pavlinušić's random unstructured stuff (nfs)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] nfs} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#chromium"&gt;Dobrica Pavlinušić's random unstructured stuff (chromium)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] chromium} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#pam"&gt;Dobrica Pavlinušić's random unstructured stuff (pam)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] pam} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#x_server"&gt;Dobrica Pavlinušić's random unstructured stuff (X-server)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] X-=server} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#virtual_pci_network_cards"&gt;Dobrica Pavlinušić's random unstructured stuff (Virtual PCI network cards)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Virtual PCI network cards} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="nlw_phrase"&gt;&lt;a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#don_t_delete_files"&gt;Dobrica Pavlinušić's random unstructured stuff (don't delete files)&lt;/a&gt;&lt;!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] don't delete files} --&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;
&lt;/div&gt;

            
            
          &lt;/div&gt;
        
      &lt;/div&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;!-- wiki: {toc: }
--&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1 id="cgroups"&gt;Cgroups&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt"&gt;http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html"&gt;http://www.webupd8.org/2010/11/alternative-to-200-lines-kernel-patch.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch01.html"&gt;http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch01.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Resource allocation using cgroups &lt;a target="_blank" title="(external link)" href="http://blip.tv/file/4773168"&gt;http://blip.tv/file/4773168&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="systemd"&gt;Systemd&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;systemd, beyond init &lt;a target="_blank" title="(external link)" href="http://www.youtube.com/watch?v=TyMLi8QF6sw"&gt;http://www.youtube.com/watch?v=TyMLi8QF6sw&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
launchd alterntive, somilar to inetd, but for unix sockets (mostly)&lt;/p&gt;
&lt;h1 id="lxc"&gt;LXC&lt;/h1&gt;
&lt;p&gt;
Virtual Servers and Checkpoint/Restart in Mainstream Linux &lt;a target="_blank" title="(external link)" href="http://lxc.sourceforge.net/doc/sigops/appcr.pdf"&gt;http://lxc.sourceforge.net/doc/sigops/appcr.pdf&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;you don't have hardware virtualization (netbooks, anyone?)&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://lxc.teegra.net/"&gt;http://lxc.teegra.net/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://en.gentoo-wiki.com/wiki/LXC"&gt;http://en.gentoo-wiki.com/wiki/LXC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sysadvent.blogspot.com/2010/12/day-1-linux-containers-lxc.html"&gt;http://sysadvent.blogspot.com/2010/12/day-1-linux-containers-lxc.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Amazon EC2&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.phenona.com/blog/using-lxc-linux-containers-in-amazon-ec2/"&gt;http://www.phenona.com/blog/using-lxc-linux-containers-in-amazon-ec2/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Running X&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://blog.ikibiki.org/2011/04/05/Running_X_from_LXC/"&gt;http://blog.ikibiki.org/2011/04/05/Running_X_from_LXC/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;LVM integration&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://s3hh.wordpress.com/2011/03/30/one-more-lxc-clone-update/"&gt;http://s3hh.wordpress.com/2011/03/30/one-more-lxc-clone-update/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;
&lt;h1 id="lxc_inside_kvm_for_testing"&gt;LXC inside KVM for testing&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sysadmin-cookbook.rot13.org/#lxc_kvm"&gt;http://sysadmin-cookbook.rot13.org/#lxc_kvm&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="setup_kvm_lxc_test_machine"&gt;setup KVM LXC test machine&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.landley.net/lxc/01-setup.html"&gt;http://www.landley.net/lxc/01-setup.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="step_1_create_a_root_filesystem_for_the_kvm_system"&gt;Step 1: Create a root filesystem for the KVM system.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sysadmin-cookbook.rot13.org/#01_create_kvm_root_sh"&gt;http://sysadmin-cookbook.rot13.org/#01_create_kvm_root_sh&lt;/a&gt; 3m12.426s&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="step_2_build_a_kernel_for_kvm_with_container_support"&gt;Step 2: Build a kernel for KVM, with container support.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sysadmin-cookbook.rot13.org/#02_build_kvm_kernel_sh"&gt;http://sysadmin-cookbook.rot13.org/#02_build_kvm_kernel_sh&lt;/a&gt; 8m22.248s&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="step_3_boot_the_result_under_qemu_or_kvm"&gt;Step 3: Boot the result under QEMU or KVM&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sysadmin-cookbook.rot13.org/#03_boot_kvm_sh"&gt;http://sysadmin-cookbook.rot13.org/#03_boot_kvm_sh&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="step_4_ssh_into_the_kvm_instance"&gt;Step 4: ssh into the KVM instance.&lt;/h3&gt;
&lt;pre&gt;
ssh root@127.0.0.1 -p 9876
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_5_set_up_a_simple_busybox_based_container_under_the_kvm_system"&gt;Step 5: Set up a simple busybox-based container under the KVM system.&lt;/h3&gt;
&lt;pre&gt;
wget http://busybox.net/downloads/binaries/latest/busybox-i686 -O busybox
chmod +x busybox
echo -e &amp;quot;lxc.utsname = container\nlxc.network.type = empty&amp;quot; &amp;gt; container.conf
PATH=$(pwd):$PATH lxc-create -f container.conf -t busybox -n container
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_6_launch_the_container"&gt;Step 6: Launch the container&lt;/h3&gt;
&lt;pre&gt;
lxc-start -n container

# console is broken, so start another

lxc-console -n container
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_7_stop_the_container_and_the_kvm_system"&gt;Step 7: Stop the container, and the KVM system.&lt;/h3&gt;
&lt;pre&gt;
lxc-stop -n container

# remove container
lxc-destroy -n container
&lt;/pre&gt;
&lt;br /&gt;&lt;h2 id="setup_networking"&gt;Setup networking&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.landley.net/lxc/02-networking.html"&gt;http://www.landley.net/lxc/02-networking.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="step_1_add_a_tap_interface_to_the_laptop"&gt;Step 1: Add a TAP interface to the Laptop.&lt;/h3&gt;
&lt;pre&gt;
# FIXME change username
tunctl -u dpavlin -t kvm0
ifconfig kvm0 192.168.254.1 netmask 255.255.255.0
echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_2_launch_kvm_with_two_ethernet_interfaces"&gt;Step 2: Launch KVM with two ethernet interfaces.&lt;/h3&gt;
&lt;pre&gt;
kvm -m 1024 -kernel ../01-setup/linux-2.6.*/arch/x86/boot/bzImage -no-reboot \
    -hda ../01-setup/squeeze.ext3 -append &amp;quot;root=/dev/hda rw panic=1&amp;quot; \
    -net nic,model=e1000 -net user -redir tcp:9876::22 \
    -net nic,model=e1000 -net tap,ifname=kvm0,script=no
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_3_set_up_a_new_container_in_the_kvm_system"&gt;Step 3: Set up a new container in the KVM system.&lt;/h3&gt;
&lt;pre&gt;
root@kvm:~# cat &amp;gt; busybox.conf &amp;lt;&amp;lt; EOF
lxc.utsname = busybox
lxc.network.type = phys
lxc.network.flags = up
lxc.network.link = eth1
#lxc.network.name = eth0
EOF

PATH=$(pwd):$PATH lxc-create -f busybox.conf -t busybox -n busybox
lxc-start -n busybox
&lt;/pre&gt;
&lt;br /&gt;&lt;pre&gt;
root@kvm:~# lxc-console -n busybox

ifconfig eth1 192.168.254.2 netmask 255.255.255.0
route add default gw 192.168.254.1
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="step_4_fun_with_routing"&gt;Step 4: Fun with routing.&lt;/h3&gt;
&lt;p&gt;
On host, bring up loopback alias in KVM network:&lt;/p&gt;
&lt;pre&gt;
dpavlin@x200:~$ sudo ifconfig lo:1 10.0.2.200 netmask 255.255.255.0
&lt;/pre&gt;
&lt;br /&gt;&lt;p&gt;
busybox container can reach it, while KVM can't !&lt;/p&gt;
&lt;h1 id="network_hints"&gt;network hints&lt;/h1&gt;
&lt;h2 id="prepare_host_machine"&gt;prepare host machine&lt;/h2&gt;
&lt;h2 id="macvlan"&gt;macvlan&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;aliased IP at eth devel&lt;/li&gt;
&lt;li&gt;new device with own mac &lt;strong&gt;with&lt;/strong&gt; offloading&lt;/li&gt;
&lt;li&gt;can't communicate with other containers or host (&amp;lt; 2.6.33)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
lxc.network.type=macvlan&lt;br /&gt;
lxc.network.link=eth0&lt;br /&gt;
lxc.network.flags=up&lt;/p&gt;
&lt;p&gt;
ip link add link &amp;lt;phys&amp;gt; name &amp;lt;vif&amp;gt; address &amp;lt;mac address&amp;gt; type macvlan mode (bridge|vepa|private)&lt;/p&gt;
&lt;p&gt;
ip link add link bond200 name bond200:0 address 00:aa:bb:cc:dd:ee type macvlan mode bridge&lt;/p&gt;
&lt;p&gt;
ip -d show link bond200:0&lt;/p&gt;
&lt;p&gt;
lxc.network.type = macvlan&lt;br /&gt;
lxc.network.macvlan.mode = bridge&lt;br /&gt;
lxc.network.flags = up&lt;br /&gt;
lxc.network.link = bond200&lt;br /&gt;
lxc.network.name = eth7&lt;br /&gt;
lxc.network.mtu = 1500&lt;br /&gt;
lxc.network.ipv4 = 192.168.90.11/24&lt;br /&gt;
lxc.network.hwaddr = 4a:49:43:49:79:0B&lt;/p&gt;
&lt;h2 id="veth"&gt;veth&lt;/h2&gt;
&lt;pre&gt;
sudo apt-get install bridge-utils dnsmasq


# setup hints

sysctl -w net.ipv4.ip_forward=1

ptables -t nat -A POSTROUTING -o wlan0 -j SNAT --to-source=WLAN0_IP

# or for nat
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
&lt;/pre&gt;
&lt;br /&gt;&lt;p&gt;
lxc.network.type=veth&lt;br /&gt;
lxc.network.link=br0&lt;br /&gt;
lxc.network.flags=up&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;name inside container&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
lxc.network.name = eth0.12&lt;br /&gt;
lxc.network.mtu = 1500&lt;br /&gt;
lxc.network.ipv4 = 10.60.0.12/23&lt;br /&gt;
lxc.network.hwaddr = AC:DE:48:00:00:0C&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;name host interface for bridge&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
lxc.network.veth.pair = veth12&lt;/p&gt;
&lt;h3 id="host_only_bridge"&gt;host-only bridge&lt;/h3&gt;
&lt;pre&gt;
$ cat /etc/network/interfaces

auto br0
iface br0 inet static
        bridge_ports dummy0
        bridge_maxwait 0
        address 172.16.16.1
        netmask 255.255.255.0
&lt;/pre&gt;
&lt;br /&gt;&lt;h3 id="pseudo_random_mac"&gt;pseudo-random mac?&lt;/h3&gt;
&lt;p&gt;
&lt;a target="_blank" title="(external link)" href="http://en.wikipedia.org/wiki/Mac_address"&gt;http://en.wikipedia.org/wiki/Mac_address&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x2:xx:xx:xx:xx:xx&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x6:xx:xx:xx:xx:xx&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xA:xx:xx:xx:xx:xx&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xE:xx:xx:xx:xx:xx&lt;/p&gt;
&lt;p&gt;
IP=192.168.0.50 # container nic IP&lt;br /&gt;
HA=&lt;tt&gt;printf &amp;quot;02:00:%x:%x:%x:%x&amp;quot; ${IP//./ }&lt;/tt&gt; # generate a MAC from the IP&lt;/p&gt;
&lt;h3 id="slow_network"&gt;slow network?&lt;/h3&gt;
&lt;p&gt;
/usr/sbin/ethtool -K br0 sg off&lt;br /&gt;
/usr/sbin/ethtool -K br0 tso off&lt;/p&gt;
&lt;h2 id="phys"&gt;phys&lt;/h2&gt;
&lt;p&gt;
kernel &amp;gt; 2.6.35&lt;/p&gt;
&lt;p&gt;
lxc.network.type=phys&lt;br /&gt;
lxc.network.link=eth1&lt;br /&gt;
lxc.network.name=eth1&lt;/p&gt;
&lt;h1 id="limit_container_resources"&gt;limit container resources&lt;/h1&gt;
&lt;h2 id="cpuset_cpus"&gt;cpuset.cpus&lt;/h2&gt;
&lt;p&gt;
echo 1 &amp;gt; /cgroup/&amp;lt;name&amp;gt;/cpuset.cpus	# 2nd CPU!&lt;/p&gt;
&lt;p&gt;
echo 1,2,3 &amp;gt; /cgroup/&amp;lt;name&amp;gt;/cpuset.cpus&lt;/p&gt;
&lt;p&gt;
echo 0-7 &amp;gt; /cgroup/&amp;lt;name&amp;gt;/cpuset.cpus&lt;/p&gt;
&lt;p&gt;
lxc-execute -n foo -s lxc.cgroup.cpuset.cpus=&amp;quot;1,2,3&amp;quot; myforks&lt;/p&gt;
&lt;h2 id="cpu_shares"&gt;cpu.shares&lt;/h2&gt;
&lt;p&gt;
lxc-execute -n foo -s lxc.cgroup.cpu.shares=1 /bin/bash&lt;/p&gt;
&lt;p&gt;
lxc-execute -n bar -s /bin/bash&lt;/p&gt;
&lt;p&gt;
while $(true); do echo -n . ; done&lt;/p&gt;
&lt;p&gt;
lxc-cgroup -n foo cpu.shares=1024&lt;/p&gt;
&lt;h2 id="memory"&gt;memory&lt;/h2&gt;
&lt;p&gt;
lxc.cgroup.memory.limit_in_bytes = 256M&lt;br /&gt;
lxc.cgroup.memory.memsw.limit_in_bytes = 1G&lt;/p&gt;
&lt;h2 id="disk"&gt;disk&lt;/h2&gt;
&lt;h3 id="usage"&gt;usage&lt;/h3&gt;
&lt;p&gt;
standard Linux tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;LVM&lt;/li&gt;
&lt;li&gt;quota (it can be bypassed if the container runs with CAP_SYS_ADMIN and/or CAP_SYS_RESOURCE capabilities)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="limit_disk_bandwith_using_cgroup_blkio"&gt;limit disk bandwith using cgroup blkio&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.mjmwired.net/kernel/Documentation/cgroups/blkio-controller.txt"&gt;http://www.mjmwired.net/kernel/Documentation/cgroups/blkio-controller.txt&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Required kernel configuration&lt;/p&gt;
&lt;p&gt;
CONFIG_BLK_CGROUP=y&lt;br /&gt;
CONFIG_CFQ_GROUP_IOSCHED=y&lt;br /&gt;
CONFIG_BLK_DEV_THROTTLING=y&lt;/p&gt;
&lt;p&gt;
create containers for test&lt;/p&gt;
&lt;pre&gt;
#!/bin/sh -xe

lxc-ls | xargs -i sh -c &amp;quot;lxc-stop -n {} ; lxc-destroy -n {}&amp;quot;

echo &amp;quot;lxc.network.type = empty&amp;quot; &amp;gt; blkio.conf

PATH=$(pwd):$PATH lxc-create -f blkio.conf -t busybox -n disk1
PATH=$(pwd):$PATH lxc-create -f blkio.conf -t busybox -n disk2
PATH=$(pwd):$PATH lxc-create -f blkio.conf -t busybox -n disk3

lxc-ls | xargs -i dd if=/dev/zero of=/var/lib/lxc/{}/rootfs/tmp/zero bs=1M count=100

cat &amp;gt; /tmp/speed.sh &amp;lt;&amp;lt;EOF
#!/bin/sh
while true ; do
        sync ; echo 3 &amp;gt; /proc/sys/vm/drop_caches
        dd if=/tmp/zero of=/dev/null 2&amp;gt;&amp;amp;1
done | grep MB
EOF

chmod +x /tmp/speed.sh

lxc-ls | xargs -i cp /tmp/speed.sh /var/lib/lxc/{}/rootfs/tmp/speed.sh

lxc-ls | xargs -i lxc-start -d -n {}
&lt;/pre&gt;
&lt;br /&gt;&lt;p&gt;
login into each container and run test&lt;/p&gt;
&lt;pre&gt;
root@kvm:~# lxc-console -n disk1

Type &amp;lt;Ctrl+a q&amp;gt; to exit the console

disk1 login: root
~ # /tmp/speed.sh 
104857600 bytes (100.0MB) copied, 0.958453 seconds, 104.3MB/s
&lt;/pre&gt;
&lt;br /&gt;&lt;p&gt;
Test limits (be careful not to enter 1000, you might oops kernel!)&lt;/p&gt;
&lt;pre&gt;
root@kvm:~# echo 100 &amp;gt; /mnt/cgroup/disk1/blkio.weight
root@kvm:~# echo 200 &amp;gt; /mnt/cgroup/disk2/blkio.weight
root@kvm:~# echo 500 &amp;gt; /mnt/cgroup/disk3/blkio.weight

root@kvm:~# cat /mnt/cgroup/disk?/blkio.weight
100
200
500
&lt;/pre&gt;
&lt;br /&gt;&lt;p&gt;
Limit /dev/hda to 1Mb/s read&lt;/p&gt;
&lt;pre&gt;
root@kvm:~# ls -al /dev/hda
brw-rw---- 1 root disk 3, 0 May 15 00:10 /dev/hda

root@kvm:~# echo &amp;quot;3:0 1048576&amp;quot; &amp;gt; /mnt/cgroup/disk1/blkio.throttle.read_bps_device
&lt;/pre&gt;
&lt;br /&gt;&lt;h2 id="network"&gt;network&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://vger.kernel.org/netconf2009_slides/Network%20Control%20Group%20Whitepaper.odt"&gt;http://vger.kernel.org/netconf2009_slides/Network%20Control%20Group%20Whitepaper.odt&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;
# mkdir -p /dev/cgroup
# mount -t cgroup net_cls -o net_cls /dev/cgroup
# mkdir /dev/cgroup/A
# mkdir /dev/cgroup/B

# cd /dev/cgroup
# echo 0x1001 &amp;gt; A/net_cls.classid # 10:1
# echo 0x1002 &amp;gt; B/net_cls.classid # 10:2

# tc qdisc add dev eth0 root handle 10: htb

# tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit
# tc class add dev eth0 parent 10: classid 10:2 htb rate 30mbit

# tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup

&lt;/pre&gt;
&lt;br /&gt;&lt;h1 id="lxc_commands"&gt;LXC commands&lt;/h1&gt;
&lt;h2 id="lxc_create"&gt;lxc-create&lt;/h2&gt;
&lt;p&gt;
/usr/lib/lxc/templates/&lt;/p&gt;
&lt;p&gt;
export MIRROR=&lt;a target="_blank" title="(external link)" href="http://192.168.1.20:3142/ftp.debian.org"&gt;http://192.168.1.20:3142/ftp.debian.org&lt;/a&gt;&lt;br /&gt;
export SUITE=lenny&lt;/p&gt;
&lt;p&gt;
cat &amp;gt; /tmp/lenny.conf&lt;br /&gt;
lxc.network.type=veth&lt;br /&gt;
lxc.network.link=br0&lt;br /&gt;
lxc.network.flags=up&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&amp;lt;ctrl+d&amp;gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
t61p:~# lxc-create -n lenny -t debian -f /tmp/lenny.conf&lt;/p&gt;
&lt;h2 id="lxc_execute"&gt;lxc-execute&lt;/h2&gt;
&lt;p&gt;
application container (shares filesystem!)&lt;/p&gt;
&lt;p&gt;
lxc-ssh&lt;/p&gt;
&lt;p&gt;
lxc-execute -n foo -s lxc.utsname=foo /bin/bash&lt;br /&gt;
lxc-execute -n bar -s lxc.utsname=bar /bin/bash&lt;/p&gt;
&lt;h2 id="lxc_attach"&gt;lxc-attach&lt;/h2&gt;
&lt;p&gt;
Needs kernel patch&lt;/p&gt;
&lt;p&gt;
lxc-attach &lt;del&gt;n n0 -&lt;/del&gt; /usr/sbin/tcpdump -i eth0&lt;/p&gt;
&lt;h1 id="devices"&gt;devices&lt;/h1&gt;
&lt;p&gt;
&lt;a target="_blank" title="(external link)" href="http://lwn.net/Articles/273208/"&gt;http://lwn.net/Articles/273208/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
lxc.cgroup.devices.allow = &amp;lt;type&amp;gt; &amp;lt;major&amp;gt;:&amp;lt;minor&amp;gt; &amp;lt;perm&amp;gt;&lt;/p&gt;
&lt;p&gt;
&amp;lt;type&amp;gt; : b (block), c (char), etc ...&lt;br /&gt;
&amp;lt;major&amp;gt; : major number&lt;br /&gt;
&amp;lt;minor&amp;gt; : minor number (wildcard is accepted)&lt;br /&gt;
&amp;lt;perms&amp;gt; : r (read), w (write), m (mapping)&lt;/p&gt;
&lt;h1 id="monitoring"&gt;monitoring&lt;/h1&gt;
&lt;h2 id="htop"&gt;htop&lt;/h2&gt;
&lt;p&gt;
htop - cgroups &amp;gt; r192&lt;/p&gt;
&lt;p&gt;
t61p:/tmp# apt-get source htop&lt;br /&gt;
t61p:/tmp# apt-get build-dep htop&lt;br /&gt;
t61p:/tmp# dpkg-source -x htop_0.9-2.dsc&lt;br /&gt;
t61p:/tmp# cd htop-0.9/&lt;/p&gt;
&lt;p&gt;
t61p:/tmp/htop-0.9# DEB_BUILD_OPTIONS=&amp;quot;--enable-cgroup&amp;quot; fakeroot debian/rules binary&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;sigh, no work, patch debian/rules to add --enable-cgroup&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
t61p:/tmp/htop-0.9# fakeroot debian/rules binary&lt;br /&gt;
t61p:/tmp/htop-0.9# dpkg -i ../htop_0.9-2_i386.deb&lt;/p&gt;
&lt;h2 id="procfs"&gt;procfs&lt;/h2&gt;
&lt;p&gt;
&lt;a target="_blank" title="(external link)" href="http://lxc.sourceforge.net/download/procfs/procfs.tar.gz"&gt;http://lxc.sourceforge.net/download/procfs/procfs.tar.gz&lt;/a&gt; (fuse, defunct)&lt;br /&gt;
&lt;a target="_blank" title="(external link)" href="http://www.tinola.com/lxc/"&gt;http://www.tinola.com/lxc/&lt;/a&gt; (somewhat newer)&lt;/p&gt;
&lt;h2 id="debugging"&gt;debugging&lt;/h2&gt;
&lt;p&gt;
lxc-start --logpriority=TRACE -o /tmp/trace.log --name my_container&lt;/p&gt;
&lt;p&gt;
(must have redirect to file!)&lt;/p&gt;
&lt;h1 id="kernel_patches"&gt;kernel patches&lt;/h1&gt;
&lt;p&gt;
&lt;a target="_blank" title="(external link)" href="http://lxc.sourceforge.net/patches/linux/"&gt;http://lxc.sourceforge.net/patches/linux/&lt;/a&gt;&lt;/p&gt;
&lt;h1 id="are_we_in_container"&gt;Are we in container?&lt;/h1&gt;
&lt;p&gt;
on host:&lt;/p&gt;
&lt;p&gt;
dpavlin@stage:~$ cat /proc/$$/cgroup&lt;br /&gt;
1:net_cls,freezer,devices,cpuacct,cpu,ns,cpuset:/&lt;/p&gt;
&lt;p&gt;
inside container:&lt;/p&gt;
&lt;p&gt;
dpavlin@narada:~$ cat /proc/$$/cgroup&lt;br /&gt;
1:net_cls,freezer,devices,cpuacct,cpu,ns,cpuset:/narada&lt;/p&gt;
&lt;h1 id="32_bit_guest_on_64_bit_kernel"&gt;32-bit guest on 64-bit kernel&lt;/h1&gt;
&lt;p&gt;
(lxc &amp;gt;= 0.7.3)&lt;/p&gt;
&lt;p&gt;
lxc.arch=x86&lt;/p&gt;
&lt;h1 id="container_tweaks"&gt;Container tweaks&lt;/h1&gt;
&lt;h2 id="udev"&gt;udev&lt;/h2&gt;
&lt;p&gt;
echo udev hold | dpkg --set-selections&lt;/p&gt;
&lt;h2 id="nfs"&gt;nfs&lt;/h2&gt;
&lt;p&gt;
kernel doesn't have nfs namespaces yet, use user-space nfs servers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://unfs3.sourceforge.net"&gt;http://unfs3.sourceforge.net&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://sourceforge.net/apps/trac/nfs-ganesha"&gt;http://sourceforge.net/apps/trac/nfs-ganesha&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="chromium"&gt;chromium&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://www.chromium.org/chromium-os/chromiumos-design-docs/system-hardening"&gt;http://www.chromium.org/chromium-os/chromiumos-design-docs/system-hardening&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://git.chromium.org/gitweb/?p=chromiumos/platform/minijail.git;a=summary"&gt;http://git.chromium.org/gitweb/?p=chromiumos/platform/minijail.git;a=summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="pam"&gt;pam&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://pam-netns.sourceforge.net/"&gt;http://pam-netns.sourceforge.net/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
pam_netns allows to setup a private network namespace for every user&lt;br /&gt;
session (comparable with pam_namespace for filesystem namespaces). This&lt;br /&gt;
is especially useful on multiseat environments.&lt;/p&gt;
&lt;h2 id="x_server"&gt;X-server&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://box.matto.nl/lxcxserver.html"&gt;http://box.matto.nl/lxcxserver.html&lt;/a&gt; (Xnest example)&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="https://launchpad.net/arkose"&gt;https://launchpad.net/arkose&lt;/a&gt; - Arkose - Desktop Application Sandboxing (using aufs2)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="virtual_pci_network_cards"&gt;Virtual PCI network cards&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" title="(external link)" href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/sect-Para-virtualized_Windows_Drivers_Guide-How_SR_IOV_Libvirt_Works.html"&gt;http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization/sect-Para-virtualized_Windows_Drivers_Guide-How_SR_IOV_Libvirt_Works.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="don_t_delete_files"&gt;don't delete files&lt;/h2&gt;
&lt;p&gt;
dpkg-divert --rename /etc/init/theinitfile.conf&lt;/p&gt;
.pre
&lt;/div&gt;
&lt;hr/&gt;&lt;div&gt;Attachments: linux-containers.png&lt;/div&gt;</content>
    <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/index.cgi?lxc</id>
    <author xmlns="http://www.w3.org/2005/Atom">
      <name xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić</name>
    </author>
    <updated xmlns="http://www.w3.org/2005/Atom">2011-05-18T07:12:31Z</updated>
  </entry>
</feed>
