<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://hive.awired.net/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://hive.awired.net/feed.php">
        <title>Hive Awired wiki hive:system:home-network</title>
        <description></description>
        <link>http://hive.awired.net/</link>
        <image rdf:resource="http://hive.awired.net/lib/images/favicon.ico" />
       <dc:date>2010-09-01T00:57:09+02:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/ad-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/ctrl-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/ex-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/fw-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/gate-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/hardware-selection"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/htpc-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/mng-prs"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/network-map"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/server-installation-xen"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/server-installation"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/system-configuration"/>
                <rdf:li rdf:resource="http://hive.awired.net/hive/system/home-network/xen-guest-installation"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://hive.awired.net/lib/images/favicon.ico">
        <title>Hive Awired wiki</title>
        <link>http://hive.awired.net/</link>
        <url>http://hive.awired.net/lib/images/favicon.ico</url>
    </image>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/ad-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2010-02-28T12:23:28+02:00</dc:date>
        <title>G- Ad-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/ad-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;G- Ad-prs&quot; [1-25] --&gt;
&lt;h2&gt;&lt;a name=&quot;auto start vm&quot; id=&quot;auto start vm&quot;&gt;Auto start VM&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /etc/xen/auto/
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s /var/xen/ad-prs/fw-prs.conf 2-ad-prs.conf&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Auto start VM&quot; [26-146] --&gt;
&lt;h2&gt;&lt;a name=&quot;vm configuration&quot; id=&quot;vm configuration&quot;&gt;Vm configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;varxenad-prsad-prs.conf&quot;&gt;/var/xen/ad-prs/ad-prs.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
name=&quot;ad-prs&quot;
builder='hvm'
kernel=&quot;/usr/lib/xen/boot/hvmloader&quot;
memory=500
maxmem=600
vcpus=1
on_poweroff='destroy'
on_reboot='restart'
on_crash='restart'
#acpi=1
#apic=1
localtime=1
device_model='/usr/lib64/xen/bin/qemu-dm'
vif=[ 'type=ioemu,bridge=xengreen' ]
disk=[ 'file:/var/xen/ad-prs/ad-prs.img,hda,w', 'file:/usr/src/FR_WS03VL.iso,hdb:cdrom,r' ]
boot=&quot;d&quot;
vnc=1
keymap='fr'&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; windows 2003 is working very well as a xen vm (my 2008 crash about once per month).&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; use a 7G image disk to allow updates&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Vm configuration&quot; [147-752] --&gt;
&lt;h2&gt;&lt;a name=&quot;nameserver&quot; id=&quot;nameserver&quot;&gt;Nameserver&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

We are going to install a replicated nameserver on 2 green networks with a persistence in mysql
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -a mysql&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcportagepackage.use&quot;&gt;/etc/portage/package.use&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;hr /&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
sources :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Bind_with_DLZ,_MySQL_and_replication&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Bind_with_DLZ,_MySQL_and_replication&quot;  rel=&quot;nofollow&quot;&gt;http://en.gentoo-wiki.com/wiki/Bind_with_DLZ,_MySQL_and_replication&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;

&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Nameserver&quot; [753-] --&gt;</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/ctrl-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-12T18:23:28+02:00</dc:date>
        <title>K- Ctrl-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/ctrl-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/ex-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2010-06-01T02:11:24+02:00</dc:date>
        <title>H- Ex-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/ex-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;H- Ex-prs&quot; [1-25] --&gt;
&lt;h2&gt;&lt;a name=&quot;services&quot; id=&quot;services&quot;&gt;Services&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;acronym title=&quot;Domain Name System&quot;&gt;DNS&lt;/acronym&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; SAMBA (PDC)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; NFS&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;acronym title=&quot;Lightweight Directory Access Protocol&quot;&gt;LDAP&lt;/acronym&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;acronym title=&quot;Dynamic Host Configuration Protocol&quot;&gt;DHCP&lt;/acronym&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; kerberos&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; apache?&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; php&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; mysql&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;code&quot;&gt;
kernel = &quot;/usr/src/vmlinuz&quot;
memory = 500
maxmem= 600
name = &quot;ex-prs&quot;
vcpus = 1
vif = [ 'bridge=xengreen' ]
disk = [ 'file:/var/xen/ex-prs/ex-prs.img,hda1,w', 'file:/var/xen/ex-prs/ex-prs.swap,hda2,w', 'phy:/dev/mapper/md3,hdb1,w' ]
root = &quot;/dev/hda1 ro&quot;
extra = &quot;xencons=tty&quot;&lt;/pre&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /mnt/raid&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcfstab&quot;&gt;/etc/fstab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
/dev/hda1               /               ext3            noatime         0 1
/dev/hda2               none            swap            sw              0 0

/dev/hdb1               /mnt/raid       ext3            noatime         0 1&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -a
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount
...
/dev/hdb1 on /mnt/raid type ext3 (rw,noatime)
...&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Services&quot; [26-911] --&gt;
&lt;h2&gt;&lt;a name=&quot;bind&quot; id=&quot;bind&quot;&gt;bind&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;bind&quot; [912-928] --&gt;
&lt;h2&gt;&lt;a name=&quot;dhcp&quot; id=&quot;dhcp&quot;&gt;dhcp&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;dhcp&quot; [929-945] --&gt;
&lt;h2&gt;&lt;a name=&quot;mysql&quot; id=&quot;mysql&quot;&gt;mysql&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;mysql&quot; [946-963] --&gt;
&lt;h2&gt;&lt;a name=&quot;php&quot; id=&quot;php&quot;&gt;php&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;php&quot; [964-979] --&gt;
&lt;h2&gt;&lt;a name=&quot;apache&quot; id=&quot;apache&quot;&gt;apache&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;apache&quot; [980-998] --&gt;
&lt;h2&gt;&lt;a name=&quot;samba&quot; id=&quot;samba&quot;&gt;samba&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;samba&quot; [999-] --&gt;</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/fw-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2010-04-19T11:21:31+02:00</dc:date>
        <title>F- Fw-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/fw-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;F- Fw-prs&quot; [1-25] --&gt;
&lt;h2&gt;&lt;a name=&quot;auto start vm&quot; id=&quot;auto start vm&quot;&gt;Auto start VM&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /etc/xen/auto/
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s /var/xen/fw-prs/fw-prs.conf 1-fw-prs.conf&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
The number at the beginning of the file is used to ordered vm starts

&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;
How to wait between starts
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;varxenfw-prsfw-prs.conf&quot;&gt;/var/xen/fw-prs/fw-prs.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
kernel = &quot;/usr/src/vmlinuz&quot;
memory = 200
maxmem = 350
name = &quot;fw-prs&quot;
vcpus = 1
vif = [ 'bridge=xendmz', 'bridge=xenred', 'bridge=xengreen' ]
disk = [ 'file:/var/xen/fw-prs/fw-prs.img,hda1,w', 'file:/var/xen/fw-prs/fw-prs.swap,hda2,w' ]
root = &quot;/dev/hda1 ro&quot;
extra = &quot;xencons=tty&quot;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Auto start VM&quot; [26-613] --&gt;
&lt;h2&gt;&lt;a name=&quot;network&quot; id=&quot;network&quot;&gt;Network&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Configure networks :
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_eth0=(&quot;192.168.1.2&quot;)
config_eth1=(&quot;192.168.0.2&quot;)
config_eth2=(&quot;192.168.2.2&quot;)
routes_eth1=(&quot;default via 192.168.0.1&quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
Auto start networks :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /etc/init.d/
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.eth1
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.eth2
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.eth0 default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.eth1 default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.eth2 default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Network&quot; [614-1027] --&gt;
&lt;h2&gt;&lt;a name=&quot;install iptables&quot; id=&quot;install iptables&quot;&gt;install Iptables&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;fw-prs&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -vp iptables&lt;/pre&gt;
&lt;p&gt;
configure iptable : 

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;rootfw.sh&quot;&gt;/root/fw.sh&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
#!/bin/sh -x

INET_IP=&quot;192.168.0.2&quot;
INET_IFACE=&quot;eth1&quot;
LAN_IP=&quot;192.168.2.2&quot;
LAN_IFACE=&quot;eth2&quot;
DMZ_IP=&quot;192.168.1.2&quot;
DMZ_IFACE=&quot;eth0&quot;
LO_IFACE=&quot;lo&quot;
LO_IP=&quot;127.0.0.1&quot;

#SERVERS
DMZ_GATE=&quot;192.168.1.4&quot;
DMZ_AWIRED=&quot;192.168.1.6&quot;
LAN_EX=&quot;192.168.2.4&quot;
LAN_MNG=&quot;192.168.2.6&quot;

IPTABLES=&quot;/sbin/iptables&quot;

###########################################################################

#clean
iptables -F
iptables -t nat -F
iptables -X

# start drop all
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

# Create chain for bad tcp packets
$IPTABLES -N bad_tcp_packets
$IPTABLES -N allowed
$IPTABLES -N icmp_packets

# bad_tcp_packets chain
$IPTABLES -A bad_tcp_packets -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j REJECT --reject-with tcp-reset
$IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG --log-prefix &quot;New not syn:&quot;
$IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP
# allowed chain
$IPTABLES -A allowed -p TCP --syn -j ACCEPT
$IPTABLES -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A allowed -p TCP -j DROP
# Changed rules totally
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT

##################################################################

# Bad TCP packets we don't want
$IPTABLES -A INPUT -p tcp -j bad_tcp_packets
# Packets from the Internet to this box
$IPTABLES -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
# From DMZ Interface to DMZ firewall IP
$IPTABLES -A INPUT -p ALL -i $DMZ_IFACE -d $DMZ_IP -j ACCEPT
# From LAN Interface to LAN firewall IP
$IPTABLES -A INPUT -p ALL -i $LAN_IFACE -d $LAN_IP -j ACCEPT

# From Localhost interface to Localhost IP's
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LO_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LAN_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $INET_IP -j ACCEPT

# Special rule for DHCP requests from LAN, which are not caught properly otherwise.
$IPTABLES -A INPUT -p UDP -i $LAN_IFACE --dport 67 --sport 68 -j ACCEPT
# All established and related packets incoming from the internet to the firewall
$IPTABLES -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED -j ACCEPT
# In Microsoft Networks you will be swamped by broadcasts. These lines will prevent them from showing up in the logs.
#$IPTABLES -A INPUT -p UDP -i $INET_IFACE -d $INET_BROADCAST --destination-port 135:139 -j DROP
# If we get DHCP requests from the Outside of our network, our logs will be swamped as well. This rule will block them from getting logged.
#$IPTABLES -A INPUT -p UDP -i $INET_IFACE -d 255.255.255.255 --destination-port 67:68 -j DROP
# If you have a Microsoft Network on the outside of your firewall, you may also get flooded by Multicasts. We drop them so we do not get flooded by logs
#$IPTABLES -A INPUT -i $INET_IFACE -d 224.0.0.0/8 -j DROP
# Log weird packets that don't match the above.
$IPTABLES -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix &quot;IPT INPUT packet died: &quot;

# Bad TCP packets we don't want
$IPTABLES -A FORWARD -p tcp -j bad_tcp_packets

# DMZ General rules
$IPTABLES -A FORWARD -i $DMZ_IFACE -o $INET_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $LAN_IFACE -o $DMZ_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $DMZ_IFACE -o $LAN_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT

###############################################################################################
###############################################################################################
# LAN section
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# Log weird packets that don't match the above.
$IPTABLES -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix &quot;IPT FORWARD packet died: &quot;
# Bad TCP packets we don't want.
$IPTABLES -A OUTPUT -p tcp -j bad_tcp_packets
# Special OUTPUT rules to decide which IP's to allow.
$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
# Log weird packets that don't match the above.
$IPTABLES -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix &quot;IPT OUTPUT packet died: &quot;

###############################################################################
## PREROUTING chain and FORWARD
###############################################################################
#$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
#$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
#$IPTABLES -t nat -A PREROUTING -p UDP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP

#dns
$IPTABLES -t nat -A PREROUTING -p tcp --dport 53 -i $INET_IFACE -j DNAT --to $DMZ_GATE
$IPTABLES -t nat -A PREROUTING -p udp --dport 53 -i $INET_IFACE -j DNAT --to $DMZ_GATE
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_GATE --dport 53 -j allowed
$IPTABLES -A FORWARD -p UDP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_GATE --dport 53 -j ACCEPT
#www
$IPTABLES -t nat -A PREROUTING -p tcp --dport 80 -i $INET_IFACE -j DNAT --to $DMZ_GATE
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_GATE --dport 80 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $LAN_IFACE -d $LAN_EX --dport 80 -j allowed
#www ssl
$IPTABLES -t nat -A PREROUTING -p tcp --dport 443 -i $INET_IFACE -j DNAT --to $DMZ_GATE
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_GATE --dport 443 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $LAN_IFACE -d $LAN_EX --dport 443 -j allowed
#mail
$IPTABLES -t nat -A PREROUTING -p tcp --dport 25 -i $INET_IFACE -j DNAT --to $DMZ_GATE
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_GATE --dport 25 -j allowed

#################################################################################

# Enable simple IP Forwarding and Network Address Translation
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;
use SNAT instead of MASQUARADE
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
run iptable configuration and save it as init.d
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x ~/fw.sh
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ~/fw.sh
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/iptables save
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/iptables start
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add iptables default&lt;/pre&gt;
&lt;p&gt;
allow routing :
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
# echo 1 &amp;#62; /proc/sys/net/ipv4/ip_forward
#&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcsysctl.conf&quot;&gt;/etc/sysctl.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
net.ipv4.ip_forward = 1
# Enables source route verification
net.ipv4.conf.default.rp_filter = 1
# Enable reverse path
net.ipv4.conf.all.rp_filter = 1&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;install Iptables&quot; [1028-] --&gt;</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/gate-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-12T18:20:23+02:00</dc:date>
        <title>J- Gate-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/gate-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/hardware-selection">
        <dc:format>text/html</dc:format>
        <dc:date>2010-03-30T16:47:07+02:00</dc:date>
        <title>B- Hardware</title>
        <link>http://hive.awired.net/hive/system/home-network/hardware-selection</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; processor (crypto)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; uninterrupted power supply&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; md1:50M md2:2G md3:120G md4:&lt;acronym title=&quot;Redundant Array of Inexpensive Disks&quot;&gt;RAID&lt;/acronym&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; core2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 4G ram&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 2 or more network cards&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
&lt;img src=&quot;http://hive.awired.net/lib/images/smileys/fixme.gif&quot; class=&quot;middle&quot; alt=&quot;FIXME&quot; /&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;B- Hardware&quot; [1-179] --&gt;
&lt;h2&gt;&lt;a name=&quot;how my server will do raid &quot; id=&quot;how my server will do raid &quot;&gt;How my server will do RAID ?&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

You can do raid by a software or directly by an hardware device.
&lt;/p&gt;

&lt;p&gt;
Hardware raid devices are very expensive, have compatibility probleme with drives, and is not usefull because you can do it easily by the motherboard processor.
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
motherboard raid &lt;strong&gt;is not&lt;/strong&gt; hardware raid and is useless for a linux server so disable it in the bios.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
So you do not need to buy anything special to do your raid, linux will do it for you :)
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;How my server will do RAID ?&quot; [180-665] --&gt;
&lt;h2&gt;&lt;a name=&quot;which raid will i use &quot; id=&quot;which raid will i use &quot;&gt;Which RAID will I use ?&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

this is simple :

&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; if you already have 4 to 6 small drives (~200G) with about the same size, you should use raid6&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; if you have big drives or if you do not by them yet, you should use raid1 with 2 drives&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; why RAID6 and not RAID5 ?&lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt;nowerdays hard drives are too big, and a block failure could happen on a second drive while reconstruction&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; why RAID1 ? : &lt;/div&gt;
&lt;ul&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; if you have a problem with your raid you can take only one drive and plug it in another computer and take your data back.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; RAID1 will be faster than raid6&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level2&quot;&gt;&lt;div class=&quot;li&quot;&gt; you have to do backup so keep you money to buy backup drives&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
&lt;acronym title=&quot;Redundant Array of Inexpensive Disks&quot;&gt;RAID&lt;/acronym&gt; &lt;strong&gt;is not&lt;/strong&gt; backup, you also have to backup your data ! this is why you do not have to build a very big &lt;acronym title=&quot;Redundant Array of Inexpensive Disks&quot;&gt;RAID&lt;/acronym&gt;.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Which RAID will I use ?&quot; [666-1465] --&gt;
&lt;h2&gt;&lt;a name=&quot;i have to buy drives to build my raid&quot; id=&quot;i have to buy drives to build my raid&quot;&gt;I have to buy drives to build my RAID&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

if you readed well :), you are going to buy 2 drives to create a RAID1.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Do not buy same drive model (and better: not the same brand)&lt;/strong&gt;, with same drives you have a big chance to have a failure at the same time on both drives.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;I have to buy drives to build my RAID&quot; [1466-] --&gt;</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/htpc-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-09T02:10:22+02:00</dc:date>
        <title>L- Htpc-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/htpc-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

&lt;a href=&quot;http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
after that :
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.gentoo.org/doc/en/nvidia-guide.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/nvidia-guide.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/nvidia-guide.xml&lt;/a&gt; part 2 !
&lt;/p&gt;

&lt;p&gt;
install xorg :
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.gentoo.org/doc/en/xorg-config.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/xorg-config.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/xorg-config.xml&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
emerge xterm
&lt;/p&gt;

&lt;p&gt;
nvidia-configure

&lt;/p&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/mng-prs">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-12T18:19:33+02:00</dc:date>
        <title>I- Mng-prs</title>
        <link>http://hive.awired.net/hive/system/home-network/mng-prs</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/network-map">
        <dc:format>text/html</dc:format>
        <dc:date>2009-12-06T13:05:47+02:00</dc:date>
        <title>A- Network map</title>
        <link>http://hive.awired.net/hive/system/home-network/network-map</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

home.loc
&lt;/p&gt;

&lt;p&gt;
srv-prs
&lt;/p&gt;

&lt;/div&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/server-installation-xen">
        <dc:format>text/html</dc:format>
        <dc:date>2010-07-19T12:01:34+02:00</dc:date>
        <title>Z- Server installation-xen</title>
        <link>http://hive.awired.net/hive/system/home-network/server-installation-xen</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Using Xen is deprecated and not modified anymore (too many problems)

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
Here we are going to install a linux server composed of :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; A gentoo 64 Bit&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Xen for paravirualisation and virtualisation&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 5 hard drives as raid6 for / and datas&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Full encrypted partitions on different drives with AES&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; An initramfs to boot on and asking for decryption passwords&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Z- Server installation-xen&quot; [1-444] --&gt;
&lt;h2&gt;&lt;a name=&quot;bios configuration&quot; id=&quot;bios configuration&quot;&gt;Bios configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Do not overclock your server, with a full time running overclocked computer you have good chance to have crash after few days running.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Configure your ATA with &lt;strong&gt;AHCI&lt;/strong&gt;, you should have better performance.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Enable Intel Virtualization technology (for xen)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Set restore on power loss to &lt;strong&gt;Power On&lt;/strong&gt; to reboot automaticaly&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Set all your raid drives as boot sequence even if you boot on cdrom first (needed for grub configuration)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
On my I7 the computer crash on xen kernel boot, I had to disable USB legacy in the bios to be able to use xen (but USB legacy is needed to boot on USB during installation if you have a USB CD drive)

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Bios configuration&quot; [445-1141] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation&quot; id=&quot;installation&quot;&gt;Installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Download an iso of the latest version of gentoo  (&lt;a href=&quot;http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/&quot; class=&quot;urlextern&quot; title=&quot;http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/&quot;  rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;). Burn it and boot on it.
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
For this exemple I&amp;#039;will use 5 drives of about 200G for RAID6
the target partition sizes :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md1 :&lt;/strong&gt; 50M as RAID1 for /boot (we don&amp;#039;t need raid6 for 50M)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md2 :&lt;/strong&gt; 150G as RAID6 for / and XEN drives&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md3 :&lt;/strong&gt; to the end of drives as RAID6 for data&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
If you have more than 1 controller for your drives spread your drive on different controller, like that if a controller become crazy it will not destroy all drives.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
My / takes about 8G.
&lt;/p&gt;

&lt;p&gt;
My VMs are composed of (with swap files and data) :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;ad :&lt;/strong&gt; 10G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;ex :&lt;/strong&gt; 7G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;fw :&lt;/strong&gt;  5G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;gate :&lt;/strong&gt; 6G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;mng :&lt;/strong&gt; 20G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;websrv1 :&lt;/strong&gt; 11G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;websrv2 :&lt;/strong&gt; 27G&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

So we need about 100G for / and VMs (I put 150G to be sur ;))

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
open ssh server to &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;C&lt;/kbd&gt; &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;V&lt;/kbd&gt; commands :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; loadkeys fr
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/sshd start
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ifconfig&lt;/pre&gt;
&lt;p&gt;

now you can connect from an other computer
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Installation&quot; [1142-2303] --&gt;
&lt;h2&gt;&lt;a name=&quot;prepare hard drives&quot; id=&quot;prepare hard drives&quot;&gt;Prepare hard drives&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

A visual representation of hard drives levels :

&lt;/p&gt;
&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Devices &lt;/th&gt;&lt;td class=&quot;col1&quot;&gt; hdX &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; hdY &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; sdZ &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Raid&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     RAID6     &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Crypto&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     AES    &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  File System&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     EXT3      &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Mount Point&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     /   &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;

First you have to find your smallest HDD to create raid based on his size :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; fdisk -l

Disk /dev/hda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdc: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hde: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdf: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System&lt;/pre&gt;
&lt;p&gt;
I will use :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;hda&lt;/strong&gt; : PATA controller 1&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;hde&lt;/strong&gt;, &lt;strong&gt;hdf&lt;/strong&gt; : PATA controller 2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;sda&lt;/strong&gt;, &lt;strong&gt;sdb&lt;/strong&gt; : SATA controller 1&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

For me sda is the smallest drive, so i will start with this one:
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
to calculate raid6 size :
&lt;strong&gt;C = (n - 2) * c&lt;/strong&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
150 = (5 - 2) * c
&lt;/p&gt;

&lt;p&gt;
c = 150 / 3
&lt;/p&gt;

&lt;p&gt;
c = 50G for /dev/sda2
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; fdisk /dev/sda
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-24321, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-24321, default 24321): +50M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (8-24792, default 8):
Using default value 8
Last cylinder, +cylinders or +size{K,M,G} (8-24321, default 24321): +1G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (140-24792, default 140):
Using default value 140
Last cylinder, +cylinders or +size{K,M,G} (140-24321, default 24321): +50G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Selected partition 4
First cylinder (6668-24792, default 6668):
Using default value 6668
Last cylinder, +cylinders or +size{K,M,G} (6668-24321, default 24321):
Using default value 24321
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)


Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): fd
Changed system type of partition 4 to fd (Linux raid autodetect)

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x48ee7660

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1           7       56196   fd  Linux raid autodetect
/dev/sda2               8          72      522112+  fd  Linux raid autodetect
/dev/sda3              73        6600    52436160   fd  Linux raid autodetect
/dev/sda4            6601       24321   142343932+  fd  Linux raid autodetect

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;p&gt;
For other disks you have to do the same thing except for the 3rd partition.
Instead of just press enter for final size set smallest drive 3rd partition size.

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
Partition number (1-4): 3
First cylinder (6536-24321, default 6536):
Using default value 6536
Last cylinder, +cylinders or +size{K,M,G} (6536-24792, default 24792): 24321

Command (m for help):&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Prepare hard drives&quot; [2304-7382] --&gt;
&lt;h2&gt;&lt;a name=&quot;creating raid&quot; id=&quot;creating raid&quot;&gt;Creating raid&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe raid1
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe raid6
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe dm-mod&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
see modules :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; lsmod | grep raid&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md1 b 9 1
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md2 b 9 2
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md3 b 9 3
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md4 b 9 4

&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md1 --level=1 --raid-devices=6 /dev/sda1 /dev/sdb1 /dev/hda1 /dev/hdb1 /dev/hde1 /dev/hdf1
mdadm: array /dev/md1 started.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md2 --level=1 --raid-devices=6 /dev/sda2 /dev/sdb2 /dev/hda2 /dev/hdb2 /dev/hde2 /dev/hdf2
mdadm: array /dev/md2 started.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md3 --level=6 --raid-devices=5 /dev/sda3 /dev/sdb3 /dev/hda3 /dev/hdb3 /dev/hde3
mdadm: array /dev/md3 started.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md4 --level=6 --raid-devices=5 /dev/sda4 /dev/sdb4 /dev/hda4 /dev/hdb4 /dev/hde4
mdadm: array /dev/md4 started.&lt;/pre&gt;
&lt;p&gt;
add spare :
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
livecd ~ # mdadm --add /dev/md3 /dev/sdf3
livecd ~ # mdadm --add /dev/md4 /dev/sdf4&lt;/pre&gt;
&lt;p&gt;
now wait for raid sync :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; watch cat /proc/mdstat
Every 2.0s: cat /proc/mdstat                                                      Fri Nov 13 21:49:39 2009

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md3 : active raid6 hdf3[4] hde3[3] hda3[2] sdb3[1] sda3[0]
      428597760 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
        resync=DELAYED

md2 : active raid6 hdf2[4] hde2[3] hda2[2] sdb2[1] sda2[0]
      157308288 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
      [==&amp;#62;..................]  resync = 10.4% (5496896/52436096) finish=36.8min speed=21227K/sec

md1 : active raid1 hdf1[4] hde1[3] hda1[2] sdb1[1] sda1[0]
      56128 blocks [5/5] [UUUUU]

unused devices: &amp;#60;none&amp;#62;&lt;/pre&gt;
&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
&lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;C&lt;/kbd&gt; to quit

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Crypt partitions :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksFormat -c aes-xts-plain -h sha512 -s 512 -y /dev/md3

WARNING!
========
This will overwrite data on /dev/md3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksFormat -c aes-xts-plain -s 512 -y /dev/md4

WARNING!
========
This will overwrite data on /dev/md4 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;p&gt;
Open encrypted partitions

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksOpen /dev/md3 md3
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksOpen /dev/md4 md4
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.&lt;/pre&gt;
&lt;p&gt;
Format partitions

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mke2fs -j /dev/md1
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 /dev/mapper/md3
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 /dev/mapper/md4
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
Do not use LVM as it “may” degrade (&lt;a href=&quot;http://mbhtech.blogspot.com/2009/09/software-raid-vs-lvm-quick-speed-test_08.html&quot; class=&quot;urlextern&quot; title=&quot;http://mbhtech.blogspot.com/2009/09/software-raid-vs-lvm-quick-speed-test_08.html&quot;  rel=&quot;nofollow&quot;&gt;see&lt;/a&gt;) performance and is very unnecessary if you create well sized partitions

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
mount drives (md4 will only be used in xen later)

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount /dev/mapper/md3 /mnt/gentoo/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /mnt/gentoo/boot
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount /dev/md1 /mnt/gentoo/boot/&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Creating raid&quot; [7383-11121] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation of &quot; id=&quot;installation of &quot;&gt;Installation of /&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Installation of /&quot; [11122-11152] --&gt;
&lt;h3&gt;&lt;a name=&quot;swap&quot; id=&quot;swap&quot;&gt;swap&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup -d /dev/urandom create swap /dev/md2
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkswap /dev/mapper/swap
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=11c45e43-4a60-43a6-8a99-352b5b1dc939
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; swapon /dev/mapper/swap
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; swapon -s
Filename                                Type            Size    Used    Priority
/mnt/gentoo/swap.img                    file            1023992 0       -1&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;swap&quot; [11153-11601] --&gt;
&lt;h3&gt;&lt;a name=&quot;stage3&quot; id=&quot;stage3&quot;&gt;Stage3&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Download stage3

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; links http://www.gentoo.org/main/en/mirrors.xml&lt;/pre&gt;
&lt;p&gt;

select a mirror and download stage3 tar.gz file for your arch (amd64 for me)
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
direct download:

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/releases/amd64/current-stage3/stage3-amd64-*.tar.bz2&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Extract stage3

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time tar xjpf stage3*

real    1m10.811s
user    0m32.000s
sys     0m3.230s&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Be sur to mount boot partition before extracting stage3 or you will have problems with grub.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Stage3&quot; [11602-12251] --&gt;
&lt;h3&gt;&lt;a name=&quot;portage&quot; id=&quot;portage&quot;&gt;Portage&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo/usr
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; links http://www.gentoo.org/main/en/mirrors.xml&lt;/pre&gt;
&lt;p&gt;

select a mirror and download latest portage
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
direct download :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/snapshots/portage-latest.tar.bz2&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Extract portage

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time tar xjf portage-lat*

real    1m31.991s
user    0m14.500s
sys     0m5.790s&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Portage&quot; [12252-12720] --&gt;
&lt;h3&gt;&lt;a name=&quot;chroot and prepare system&quot; id=&quot;chroot and prepare system&quot;&gt;Chroot and prepare system&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;chroot&quot; id=&quot;chroot&quot;&gt;Chroot&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -t proc proc /mnt/gentoo/proc
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -o bind /dev /mnt/gentoo/dev
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp -L /etc/resolv.conf /mnt/gentoo/etc/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chroot /mnt/gentoo /bin/bash
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; source /etc/profile &amp;#38;&amp;#38; env-update
&amp;#62;&amp;#62;&amp;#62; Regenerating /etc/ld.so.cache...&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;root password&quot; id=&quot;root password&quot;&gt;Root password&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

change root password

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;keyboard map&quot; id=&quot;keyboard map&quot;&gt;Keyboard map&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dkeymaps&quot;&gt;/etc/conf.d/keymaps&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
KEYMAP=&quot;fr&quot;
...&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;fstab&quot; id=&quot;fstab&quot;&gt;fstab&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcfstab&quot;&gt;/etc/fstab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
/dev/md1                /boot           ext3            noauto,noatime  1 2
/dev/mapper/md3         /               ext4            noatime         0 1
/dev/mapper/swap        none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
...&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not forget /boot filesystem as ext3

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /etc/portage&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;compilation optimization&quot; id=&quot;compilation optimization&quot;&gt;Compilation optimization&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

Have a look on &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Safe_Cflags&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Safe_Cflags&quot;  rel=&quot;nofollow&quot;&gt;flags for your processor&lt;/a&gt; and populate your make.conf
&lt;/p&gt;

&lt;p&gt;
exemple for my core2

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcmake.conf&quot;&gt;/etc/make.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
CHOST=&quot;x86_64-pc-linux-gnu&quot;
CFLAGS=&quot;-march=core2 -O2 -pipe&quot;
CXXFLAGS=&quot;${CFLAGS}&quot;

MAKEOPTS=&quot;-j3&quot;

USE=&quot;mmx sse sse2 -X unicode ipv6 -fortran&quot;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
MAKEOPTS should be : number_of_processor_core + 1

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Chroot and prepare system&quot; [12721-14222] --&gt;
&lt;h2&gt;&lt;a name=&quot;xen kernel&quot; id=&quot;xen kernel&quot;&gt;XEN kernel&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

unmask xen packages :
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcportagepackage.keywords&quot;&gt;/etc/portage/package.keywords&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
app-emulation/xen ~amd64
app-emulation/xen-tools ~amd64
sys-kernel/xen-sources ~amd64&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
set flags :

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcportagepackage.use&quot;&gt;/etc/portage/package.use&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
app-emulation/xen-tools hvm&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
install packages :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -a xen-sources xen xen-tools&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;XEN kernel&quot; [14223-14579] --&gt;
&lt;h3&gt;&lt;a name=&quot;kernel configuration&quot; id=&quot;kernel configuration&quot;&gt;Kernel configuration&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /usr/src/linux
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make menuconfig&lt;/pre&gt;&lt;pre class=&quot;code&quot;&gt;
Processor type and features  ---&amp;#62;
  [*] Enable Xen compatible kernel
      Processor family (Core 2/newer Xeon)  ---&amp;#62;
Bus options (PCI etc.)  ---&amp;#62;
  [*] PCI support
  [*]   Xen PCI Frontend
[*] Networking support  ---&amp;#62;
  Networking options  ---&amp;#62;
    &amp;#60;*&amp;#62; 802.1d Ethernet Bridging
Device Drivers  ---&amp;#62;
  [*] Network device support  ---&amp;#62;
    &amp;#60;*&amp;#62; Universal TUN/TAP device driver support
  [*] Block devices ---&amp;#62;
    &amp;#60;M&amp;#62; Loopback device support
  [*] Multiple devices driver support (RAID and LVM)  ---&amp;#62;
    &amp;#60;*&amp;#62;   RAID support
    &amp;#60;*&amp;#62;     RAID-1 (mirroring) mode
    &amp;#60;*&amp;#62;     RAID-4/RAID-5/RAID-6 mode
    &amp;#60;*&amp;#62;   Device mapper support
    &amp;#60;M&amp;#62;     Crypt target support
  XEN  ---&amp;#62;
    [*] Privileged Guest (domain 0)
    &amp;#60;*&amp;#62; Backend driver support
    &amp;#60;*&amp;#62;   Block-device backend driver
    &amp;#60;*&amp;#62;   Network-device backend driver
    &amp;#60;*&amp;#62;   PCI-device backend driver
             PCI Backend Mode (Virtual PCI) ---&amp;#62;
    [*] Scrub memory before freeing it to Xen
    [*] Disable serial port drivers
        Xen version compatibility (3.3.0 and later)
File systems  ---&amp;#62;
    &amp;#60;*&amp;#62; The Extended 4 (ext4) filesystem
    [*]   Ext4 extended attributes
    [*]     Ext4 POSIX Access Control Lists
    [ ]     Ext4 Security Labels
-*- Cryptographic API  ---&amp;#62;
&amp;#60;M&amp;#62;   XTS support (EXPERIMENTAL)
&amp;#60;M&amp;#62;   SHA224 and SHA256 digest algorithm
&amp;#60;M&amp;#62;   SHA384 and SHA512 digest algorithms
{M}   AES cipher algorithms (x86_64)
&amp;#60;M&amp;#62;   AES cipher algorithms (AES-NI)&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not forget to set your devices drivers !
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; network devices&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; HDD controller&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

# lspci in livecd will tell you

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make -j3
...
Kernel: arch/x86/boot/vmlinuz is ready  (#1)
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make modules_install
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp arch/x86/boot/vmlinuz /boot/&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Kernel configuration&quot; [14580-16466] --&gt;
&lt;h2&gt;&lt;a name=&quot;initramfs&quot; id=&quot;initramfs&quot;&gt;InitRamFs&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Follow this link to build your initramfs :
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://hive.awired.net/hive/system/gentoo/initramfs&quot; class=&quot;wikilink1&quot; title=&quot;hive:system:gentoo:initramfs&quot;&gt;Initramfs&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;InitRamFs&quot; [16467-16568] --&gt;
&lt;h2&gt;&lt;a name=&quot;install grub&quot; id=&quot;install grub&quot;&gt;Install grub&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge grub
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; grub
grub&amp;#62; root (hd0,0)
grub&amp;#62; setup (hd0)
grub&amp;#62; root (hd1,0)
grub&amp;#62; setup (hd1)
grub&amp;#62; root (hd2,0)
grub&amp;#62; setup (hd2)
grub&amp;#62; root (hd3,0)
grub&amp;#62; setup (hd3)
grub&amp;#62; root (hd4,0)
grub&amp;#62; setup (hd4)
grub&amp;#62; root (hd5,0)
grub&amp;#62; setup (hd5)
grub&amp;#62; quit&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
hdX in grub corresponds to bios hard drive boot sequences, drives have to be set in bios

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;bootgrubgrub.conf&quot;&gt;/boot/grub/grub.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
title GLX
root (hd0,0)
kernel /boot/xen.gz dom0_mem=300M
module /boot/vmlinuz root=/dev/mapper/md3 netloop.nloopbacks=32
module /boot/initramfs.gz&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Install grub&quot; [16569-17202] --&gt;
&lt;h2&gt;&lt;a name=&quot;finished&quot; id=&quot;finished&quot;&gt;Finished!&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; exit
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; umount /mnt/gentoo/proc/ /mnt/gentoo/dev /mnt/gentoo/boot /mnt/gentoo&lt;/pre&gt;&lt;hr /&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;strong&gt;sources:&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
for installation:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

for xen: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.gentoo.org/doc/en/xen-guide.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/xen-guide.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/xen-guide.xml&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Xen&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Xen&quot;  rel=&quot;nofollow&quot;&gt;http://en.gentoo-wiki.com/wiki/Xen&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

for initramfs:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Initramfs&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Initramfs&quot;  rel=&quot;nofollow&quot;&gt;http://en.gentoo-wiki.com/wiki/Initramfs&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&quot; class=&quot;urlextern&quot; title=&quot;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&quot;  rel=&quot;nofollow&quot;&gt;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; lots of internet search ;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Finished!&quot; [17203-17779] --&gt;
&lt;h1&gt;&lt;a name=&quot;d- system config&quot; id=&quot;d- system config&quot;&gt;D- System config&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;D- System config&quot; [17780-17812] --&gt;
&lt;h2&gt;&lt;a name=&quot;network configuration&quot; id=&quot;network configuration&quot;&gt;Network Configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
For the moment we don&amp;#039;t have router vm so we will be connected directly to the internet box.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_eth0=(&quot;192.168.0.3/24&quot;)
routes_eth0=(&quot;default via 192.168.0.1&quot;)&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.eth0 restart
 * Caching service dependencies ...
 * Starting eth0
 *   Bringing up eth0
 *     192.168.0.3/24
 *   Adding routes
 *     default via 192.168.0.1
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;p&gt;
Now add ssh deamon to runlevels
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sshd default
 * sshd added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/sshd start
Generating public/private rsa1 key pair.
...
 * Starting sshd ...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Network Configuration&quot; [17813-18553] --&gt;
&lt;h2&gt;&lt;a name=&quot;hostname configuration&quot; id=&quot;hostname configuration&quot;&gt;Hostname configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etchosts&quot;&gt;/etc/hosts&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
127.0.0.1       srv-prs.home.loc srv-prs localhost
...&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhostname&quot;&gt;/etc/conf.d/hostname&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;srv-prs&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname srv-prs
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname -f
srv-prs.home.loc
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Hostname configuration&quot; [18554-18849] --&gt;
&lt;h2&gt;&lt;a name=&quot;timezone&quot; id=&quot;timezone&quot;&gt;Timezone&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp /usr/share/zoneinfo/Europe/Paris /etc/localtime&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dclock&quot;&gt;/etc/conf.d/clock&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
TIMEZONE=&quot;Europe/Paris&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge ntp
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add ntp-client default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ntp-client start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Timezone&quot; [18850-19172] --&gt;
&lt;h2&gt;&lt;a name=&quot;rebuild for optimisation&quot; id=&quot;rebuild for optimisation&quot;&gt;Rebuild for optimisation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time emerge -vae world
...

real    183m54.743s
user    155m45.326s
sys     86m24.708s&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Rebuild for optimisation&quot; [19173-19336] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation of basic softwares&quot; id=&quot;installation of basic softwares&quot;&gt;Installation of basic softwares&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge syslog-ng vixie-cron sendmail logrotate cryptsetup mdadm htop
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add syslog-ng default
 * syslog-ng added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add vixie-cron default
 * vixie-cron added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sendmail default
 * sendmail added to runlevel default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Installation of basic softwares&quot; [19337-19749] --&gt;
&lt;h2&gt;&lt;a name=&quot;hdparm&quot; id=&quot;hdparm&quot;&gt;Hdparm&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

To save power and hard drive life you can configure your hard drive to Spindown after a time without using it :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -v hdparm&lt;/pre&gt;
&lt;p&gt;
The Time (in seconds) after which the Drive spins down is the value of your x multiplied with 5 From the manpage:
&lt;/p&gt;

&lt;p&gt;
A value of zero means “timeouts are disabled”: the device will not automatically enter standby mode.
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.
Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours.
A value of 252 signifies a  timeout  of  21  minutes.
A value of 253 sets a vendor-defined timeout period between 8 and 12 hours.
A value of 255 is interpreted as 21 minutes plus 15 seconds.
The value 254 is reserved.
Note that some older drives may have very different interpretations of these values.
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhdparm&quot;&gt;/etc/conf.d/hdparm&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
sda_args=&quot;-S241&quot;
sdd_args=&quot;-S241&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/hdparm start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add hdparm default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Hdparm&quot; [19750-20856] --&gt;
&lt;h2&gt;&lt;a name=&quot;xen network configuration&quot; id=&quot;xen network configuration&quot;&gt;Xen network configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

We are going to configure 3 networks :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; eth0 →  xen-red → red network (will be removed when we will install router)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; eth1 → xen-green → green network&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; br0 → xen-dmz → dmz network&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Xen network configuration&quot; [20857-21091] --&gt;
&lt;h3&gt;&lt;a name=&quot;removing eth0 from auto plug&quot; id=&quot;removing eth0 from auto plug&quot;&gt;Removing eth0 from auto plug&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Remove eth0 from auto plug
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.drc&quot;&gt;/etc/conf.d/rc&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
RC_PLUG_SERVICES=&quot;!net.*&quot;
...&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Removing eth0 from auto plug&quot; [21092-21229] --&gt;
&lt;h3&gt;&lt;a name=&quot;network configuration1&quot; id=&quot;network configuration1&quot;&gt;Network configuration&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_xendmz=(&quot;192.168.1.3/24&quot;)
brctl_xendmz=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)

config_xenred=(&quot;192.168.0.3/24&quot;)
bridge_xenred=(&quot;peth0&quot;)
brctl_xenred=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)
routes_xenred=(&quot;default via 192.168.0.1&quot;)


config_xengreen=(&quot;192.168.2.3/24&quot;)
bridge_xengreen=(&quot;peth1&quot;)
brctl_xengreen=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)
routes_xengreen=(&quot;default via 192.168.2.2&quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
Creation of network scripts and adding dmz to runlevels

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /etc/init.d/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.xenred
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.xengreen
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.xendmz
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.xendmz default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Network configuration&quot; [21230-21971] --&gt;
&lt;h3&gt;&lt;a name=&quot;home server script&quot; id=&quot;home server script&quot;&gt;Home server script&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

We need peth0 that is the virtual version of eth0 to mount xenred network bridge. This bridge will be created by xen but peth0 too. A problem in the sequence cause that the first time we start xen it will fail to create bridges.
This is why i created a runlevel script that restart xen sequence a second time.
I actually don&amp;#039;t know how to solve this problem.
&lt;/p&gt;

&lt;p&gt;
Add a runlevel script to reload networks

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcinit.dhomesrv&quot;&gt;/etc/init.d/homesrv&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
#!/sbin/runscript

depend() {
        need net
        after xend
}


start() {
        ebegin &quot;Starting home server :)&quot;
        /etc/init.d/xend restart
        /etc/init.d/net.xenred restart
        /etc/init.d/net.xengreen restart
        /etc/init.d/xendomains restart
}&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x /etc/init.d/homesrv
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add homesrv default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Home server script&quot; [21972-22827] --&gt;
&lt;h3&gt;&lt;a name=&quot;xen network scripts&quot; id=&quot;xen network scripts&quot;&gt;Xen network scripts&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

We are going to create script that mount red and green network at same times by xen :
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;code&quot;&gt;
#!/bin/sh

XENDIR=&quot;/etc/xen/scripts&quot;

$XENDIR/network-bridge &quot;$@&quot; netdev=eth0 bridge=xenred vifnum=1
$XENDIR/network-bridge &quot;$@&quot; netdev=eth1 bridge=xengreen vifnum=2&lt;/pre&gt;&lt;p class=&quot;codefoot&quot;&gt;&lt;a name=&quot;h etcxenscriptsmy-network-bridge&quot;&gt;h /etc/xen/scripts/my-network-bridge&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x /etc/xen/scripts/my-network-bridge&lt;/pre&gt;
&lt;p&gt;
Now tell xen configuration use this script instead of default one
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcxenxend-config.sxp&quot;&gt;/etc/xen/xend-config.sxp&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
(network-script my-network-bridge)
...&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
tell gentoo to load loop modules on start

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;nano etcmodules.autoload.dkernel-2.6&quot;&gt;nano /etc/modules.autoload.d/kernel-2.6&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
loop
...&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Xen network scripts&quot; [22828-23517] --&gt;
&lt;h3&gt;&lt;a name=&quot;xen daemon&quot; id=&quot;xen daemon&quot;&gt;Xen daemon&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

Add xend to runlevels
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add xend default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/xend start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Xen daemon&quot; [23518-23664] --&gt;
&lt;h2&gt;&lt;a name=&quot;guest paravirtualization kernel compilation&quot; id=&quot;guest paravirtualization kernel compilation&quot;&gt;Guest paravirtualization Kernel compilation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Guest paravirtualization Kernel compilation&quot; [23665-23721] --&gt;
&lt;h3&gt;&lt;a name=&quot;separation of dom0 and domu kernels&quot; id=&quot;separation of dom0 and domu kernels&quot;&gt;Separation of dom0 and domU kernels&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

We are going to create 2 scripts to compile the domU and dom0.
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /usr/src/linux/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; echo &quot;mkdir -p _dom0 &amp;#38;&amp;#38; make O=_dom0 \$@&quot; &amp;#62; make0.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; echo &quot;mkdir -p _domU &amp;#38;&amp;#38; make O=_domU \$@&quot; &amp;#62; makeU.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x make?.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./make0.sh menuconfig&lt;/pre&gt;
&lt;p&gt;
Just Exit and Save.
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./makeU.sh menuconfig
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp .config _dom0/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp .config _domU/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make mrproper&lt;/pre&gt;
&lt;p&gt;
Same thing, Exit and save.
&lt;/p&gt;

&lt;p&gt;
now you can compile :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; your dom0 kernel by doing &lt;strong&gt;./make0.sh …&lt;/strong&gt; in &lt;strong&gt;/usr/src/linux&lt;/strong&gt; and take the kernel in &lt;strong&gt;/usr/src/linux/_dom0&lt;/strong&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; your domU kernel by doing &lt;strong&gt;./makeU.sh …&lt;/strong&gt; in &lt;strong&gt;/usr/src/linux&lt;/strong&gt; and take the kernel in &lt;strong&gt;/usr/src/linux/_domU&lt;/strong&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Separation of dom0 and domU kernels&quot; [23722-24585] --&gt;
&lt;h3&gt;&lt;a name=&quot;domu compilation&quot; id=&quot;domu compilation&quot;&gt;domU compilation&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;
Device Drivers  ---&amp;#62;
  XEN  ---&amp;#62;
[ ] Privileged Guest (domain 0)
&amp;#60; &amp;#62; Backend driver support
&amp;#60;*&amp;#62; Block-device frontend driver
&amp;#60;*&amp;#62; Network-device frontend driver
&amp;#60;M&amp;#62;   Network-device frontend driver acceleration for Solarflare
&amp;#60;M&amp;#62; SCSI frontend driver
&amp;#60;M&amp;#62; USB frontend driver
[*]   Taking the HCD statistics (for debug)
&amp;#60;*&amp;#62; User-space granted page access driver
&amp;#60;*&amp;#62; Framebuffer-device frontend driver
&amp;#60;*&amp;#62;   Keyboard-device frontend driver
[*] Disable serial port drivers
&amp;#60;*&amp;#62; Export Xen attributes in sysfs
(256) Number of guest devices
    Xen version compatibility (no compatibility code)  ---&amp;#62;
[*] Place shared vCPU info in per-CPU storage&lt;/pre&gt;
&lt;p&gt;
Now compile :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./makeU.sh -j3
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp _domU/arch/x86/boot/vmlinuz ../&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;domU compilation&quot; [24586-25405] --&gt;
&lt;h1&gt;&lt;a name=&quot;e- guest installation&quot; id=&quot;e- guest installation&quot;&gt;E- Guest installation&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;E- Guest installation&quot; [25406-25442] --&gt;
&lt;h2&gt;&lt;a name=&quot;paravirtualization installation&quot; id=&quot;paravirtualization installation&quot;&gt;Paravirtualization installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Creation of vm directory :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /var/xen/def-gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/var/xen/def-gentoo/def-gentoo.img bs=1M count=3500
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/var/xen/def-gentoo/def-gentoo.swap bs=1M count=1000
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 -N 600000 /var/xen/def-gentoo/def-gentoo.img
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkswap /var/xen/def-gentoo/def-gentoo.swap&lt;/pre&gt;
&lt;p&gt;
This will create a disk image of 3G and a swap of 1G.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Paravirtualization installation&quot; [25443-25931] --&gt;
&lt;h3&gt;&lt;a name=&quot;configuration file&quot; id=&quot;configuration file&quot;&gt;Configuration file&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;varxendef-gentoodef-gentoo.conf&quot;&gt;/var/xen/def-gentoo/def-gentoo.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
kernel = &quot;/usr/src/vmlinuz&quot;
memory = 500
maxmem = 650
name = &quot;def-gentoo&quot;
vcpus = 2
vif = [ 'bridge=xenred' ]
disk = [ 'file:/var/xen/def-gentoo/def-gentoo.img,hda1,w', 'file:/var/xen/def-gentoo/def-gentoo.swap,hda2,w' ]
root = &quot;/dev/hda1 ro&quot;
extra = &quot;xencons=tty&quot;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Configuration file&quot; [25932-26281] --&gt;
&lt;h3&gt;&lt;a name=&quot;install &quot; id=&quot;install &quot;&gt;install /&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -o loop /var/xen/def-gentoo/def-gentoo.img /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/releases/amd64/current-stage3/stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; tar xjpf stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd usr/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/snapshots/portage-latest.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; tar xjf portage-latest.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm portage-latest.tar.bz2&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;mntgentooetcfstab&quot;&gt;/mnt/gentoo/etc/fstab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
/dev/hda1               /               ext4            noatime         0 1
/dev/hda2               none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
#/dev/fd0               /mnt/floppy     auto            noauto          0 0
...&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;

Now we are going to copy the kernel to the vm.

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm -Rf /mnt/gentoo/usr/src/*
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp -R /usr/src/linux-2.6.31-xen-r7/ /mnt/gentoo/usr/src/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo/usr/src
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s linux-2.6.31-xen-r7 linux
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chroot /mnt/gentoo /bin/bash
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; env-update &amp;#38;&amp;#38; source /etc/profile
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
New password:
Retype new password:
passwd: password updated successfully
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /usr/src/linux
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./makeU.sh modules_install
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; exit
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; umount /mnt/gentoo&lt;/pre&gt;
&lt;p&gt;
boot the kernel
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; xm create -c /var/xen/def-gentoo/def-gentoo.conf
...
This is localhost.unknown_domain (Linux x86_64 2.6.31-xen-r7) 17:24:49

localhost login: root
Password:&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
To detach the vm screen : 
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; ctrl + ] (on english keyboard)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; ctrl + $ (on french keyboard)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

To be attached back to the screen : 

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; xm console def-gentoo&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not use &lt;strong&gt;less&lt;/strong&gt; on vm console it will crash return lines in your current shell, use an ssh connection instread.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;install /&quot; [26282-28492] --&gt;
&lt;h3&gt;&lt;a name=&quot;set network&quot; id=&quot;set network&quot;&gt;Set network&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_eth0=(&quot;192.168.0.254/24&quot;)
routes_eth0=(&quot;default via 192.168.0.1&quot;)&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcresolv.conf&quot;&gt;/etc/resolv.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
nameserver 212.27.40.240
nameserver 212.27.40.241&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
use your provider dns servers

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.eth0 start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Set network&quot; [28493-28828] --&gt;
&lt;h3&gt;&lt;a name=&quot;rebuild&quot; id=&quot;rebuild&quot;&gt;rebuild&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

configure make.conf

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcmake.conf&quot;&gt;/etc/make.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
CFLAGS=&quot;-march=core2 -O2 -pipe&quot;
CXXFLAGS=&quot;${CFLAGS}&quot;
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST=&quot;x86_64-pc-linux-gnu&quot;

MAKEOPTS=&quot;-j3&quot;

# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE=&quot;mmx sse sse2 -X unicode ipv6 -fortran&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -vae world&lt;/pre&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm -Rf /usr/portage/distfiles/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sshd default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge syslog-ng vixie-cron logrotate
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add syslog-ng default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add vixie-cron default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;rebuild&quot; [28829-29621] --&gt;
&lt;h3&gt;&lt;a name=&quot;timezone1&quot; id=&quot;timezone1&quot;&gt;Timezone&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp /usr/share/zoneinfo/Europe/Paris /etc/localtime&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dclock&quot;&gt;/etc/conf.d/clock&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
TIMEZONE=&quot;Europe/Paris&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge ntp
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add ntp-client default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ntp-client start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Timezone&quot; [29622-29943] --&gt;
&lt;h3&gt;&lt;a name=&quot;set hostname&quot; id=&quot;set hostname&quot;&gt;Set hostname&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etchosts&quot;&gt;/etc/hosts&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
127.0.0.1 VMNAME.home.loc VMNAME localhost
...&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhostname&quot;&gt;/etc/conf.d/hostname&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;VMNAME&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname VMNAME&lt;/pre&gt;
&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
fw-prs.img 4000
fw-prs.swap 1024
&lt;/p&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Set hostname&quot; [29944-30213] --&gt;
&lt;h2&gt;&lt;a name=&quot;virtualization installation&quot; id=&quot;virtualization installation&quot;&gt;Virtualization installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Virtualisation is for unmodified guest like windows :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;srv-mvl&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /var/xen/def-2003/
&lt;span class=&quot;consoleName&quot;&gt;srv-mvl&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/var/xen/def-2003/def-2003.img bs=1M count=15000&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
I dit not found a solution to resize virtual drive after installation, so you need to give a good size to your img file

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Copy an iso of 2003 from an other computer to your host using scp:

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; scp FR_WS03VL.iso 192.168.0.3:/usr/src/&lt;/pre&gt;
&lt;p&gt;
Configure your VM
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;varxendef-2003def-2003.conf&quot;&gt;/var/xen/def-2003/def-2003.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
kernel = &quot;/usr/lib/xen/boot/hvmloader&quot;
builder='hvm'
memory = 512
#maxmem=600
vcpus=1
on_poweroff='destroy'
on_reboot='restart'
on_crash='restart'
##acpi=1
##apic=1
name = &quot;mng-mvl&quot;
vif = [ 'type=ioemu, mac=aa:00:b0:00:00:11, bridge=xenred' ]
disk = [ 'file:/var/xen/def-2003/def-2003.img,hda,w', 'file:/usr/src/FR_WS03VL.iso,hdb:cdrom,r'  ]
device_model = '/usr/lib64/xen/bin/qemu-dm'
cdrom=&quot;file:/usr/src/FR_WS03VL.iso,hdb:cdrom,r&quot;
boot=&quot;d&quot;
sdl=0
vnc=1
vncviewer=0
ne2000=0
keymap='fr'
usbdevice='tablet'&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
Configure your xen vnc password :
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcxenxend-config.sxp&quot;&gt;/etc/xen/xend-config.sxp&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
(vnc-listen '0.0.0.0')

(vncpasswd 'yourpassword')
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;srv-mvl&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/xend restart
&lt;span class=&quot;consoleName&quot;&gt;srv-mvl&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; xm create /var/xen/def-2003/def-2003.conf&lt;/pre&gt;
&lt;p&gt;
now use a vnc client to connect to your vm on 192.168.0.3:5900
and follow installation of windows
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Virtualization installation&quot; [30214-] --&gt;&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://hive.awired.net/hive/system/home-network/server-installation-xen#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/server-installation">
        <dc:format>text/html</dc:format>
        <dc:date>2010-07-28T12:03:05+02:00</dc:date>
        <title>C- Server installation</title>
        <link>http://hive.awired.net/hive/system/home-network/server-installation</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
Here we are going to install a linux server composed of :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; A gentoo 64 Bit&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; KVM for paravirualisation and virtualisation&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; 5 hard drives as raid6 for / and datas&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Full encrypted partitions on different drives with AES&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; An initramfs to boot on and asking for decryption passwords&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;C- Server installation&quot; [1-347] --&gt;
&lt;h2&gt;&lt;a name=&quot;bios configuration&quot; id=&quot;bios configuration&quot;&gt;Bios configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Do not overclock your server, with a full time running overclocked computer you have good chance to have crash after few days running.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Configure your ATA with &lt;strong&gt;AHCI&lt;/strong&gt;, you should have better performance.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Enable Intel Virtualization technology (for kvm)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Set restore on power loss to &lt;strong&gt;Power On&lt;/strong&gt; to reboot automaticaly&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Set all your raid drives as boot sequence even if you boot on cdrom first (needed for grub configuration)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Bios configuration&quot; [348-825] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation&quot; id=&quot;installation&quot;&gt;Installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Download an iso of the latest version of gentoo  (&lt;a href=&quot;http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/&quot; class=&quot;urlextern&quot; title=&quot;http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/&quot;  rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;). Burn it and boot on it.
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
For this exemple I&amp;#039;will use 5 drives of about 200G for RAID6
the target partition sizes :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md1 :&lt;/strong&gt; 50M as RAID1 for /boot (we don&amp;#039;t need raid6 for 50M)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md2 :&lt;/strong&gt; 150G as RAID6 for / and KVM drives&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;md3 :&lt;/strong&gt; to the end of drives as RAID6 for data&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
If you have more than 1 controller for your drives spread your drive on different controller, like that if a controller become crazy it will not destroy all drives.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
My / takes about 8G.
&lt;/p&gt;

&lt;p&gt;
My VMs are composed of (with swap files and data) :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;ad :&lt;/strong&gt; 10G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;ex :&lt;/strong&gt; 7G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;fw :&lt;/strong&gt;  5G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;gate :&lt;/strong&gt; 6G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;mng :&lt;/strong&gt; 20G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;websrv1 :&lt;/strong&gt; 11G&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;websrv2 :&lt;/strong&gt; 27G&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

So we need about 100G for / and VMs (I set 150G to be sur ;))

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
open ssh server to &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;C&lt;/kbd&gt; &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;V&lt;/kbd&gt; commands :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; loadkeys fr
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/sshd start
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ifconfig&lt;/pre&gt;
&lt;p&gt;

now you can connect from an other computer
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Installation&quot; [826-1987] --&gt;
&lt;h2&gt;&lt;a name=&quot;prepare hard drives&quot; id=&quot;prepare hard drives&quot;&gt;Prepare hard drives&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

A visual representation of hard drives levels :

&lt;/p&gt;
&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Devices &lt;/th&gt;&lt;td class=&quot;col1&quot;&gt; hdX &lt;/td&gt;&lt;td class=&quot;col2&quot;&gt; hdY &lt;/td&gt;&lt;td class=&quot;col3&quot;&gt; sdZ &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Raid&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     RAID6     &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Crypto&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     AES    &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  File System&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     EXT3      &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;th class=&quot;col0 rightalign&quot;&gt;  Mount Point&lt;/th&gt;&lt;td class=&quot;col1 centeralign&quot; colspan=&quot;3&quot;&gt;     /   &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;

First you have to find your smallest HDD to create raid based on his size :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; fdisk -l

Disk /dev/hda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdc: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hde: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/hdf: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/sdb: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System&lt;/pre&gt;
&lt;p&gt;
I will use :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;hda&lt;/strong&gt; : PATA controller 1&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;hde&lt;/strong&gt;, &lt;strong&gt;hdf&lt;/strong&gt; : PATA controller 2&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;sda&lt;/strong&gt;, &lt;strong&gt;sdb&lt;/strong&gt; : SATA controller 1&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

For me sda is the smallest drive, so i will start with this one:
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
to calculate raid6 size :
&lt;strong&gt;C = (n - 2) * c&lt;/strong&gt;

&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;C&lt;/strong&gt; : total capacity of your raid&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;n&lt;/strong&gt; : number of disks&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;c&lt;/strong&gt; : single disk partition capacity&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
150 = (5 - 2) * c
&lt;/p&gt;

&lt;p&gt;
c = 150 / 3
&lt;/p&gt;

&lt;p&gt;
c = 50G for /dev/sda2
&lt;/p&gt;

&lt;p&gt;
So we have to create partitions of 50G on each drives to have a raid6 of 150G
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; fdisk /dev/sda
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-24321, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-24321, default 24321): +50M

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (8-24792, default 8):
Using default value 8
Last cylinder, +cylinders or +size{K,M,G} (8-24321, default 24321): +50G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (140-24792, default 140):
Using default value 140
Last cylinder, +cylinders or +size{K,M,G} (140-24321, default 24321):
Using default value 24321
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): fd
Changed system type of partition 2 to fd (Linux raid autodetect)

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x48ee7660

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1           7       56196   fd  Linux raid autodetect
/dev/sda2               8        6600    52958272   fd  Linux raid autodetect
/dev/sda3            6601       24321   142343932+  fd  Linux raid autodetect

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;p&gt;
For other disks you have to do the same thing except for the 3rd partition.
Instead of just press enter for final size set smallest drive 3rd partition size.

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
Partition number (1-4): 3
First cylinder (6536-24321, default 6536):
Using default value 6536
Last cylinder, +cylinders or +size{K,M,G} (6536-24792, default 24792): 24321

Command (m for help):&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Prepare hard drives&quot; [1988-6774] --&gt;
&lt;h2&gt;&lt;a name=&quot;creating raid&quot; id=&quot;creating raid&quot;&gt;Creating raid&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe raid1
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe raid6
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; modprobe dm-mod&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
see modules :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; lsmod | grep raid&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md1 b 9 1
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md2 b 9 2
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mknod /dev/md3 b 9 3

&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md1 --level=1 --raid-devices=6 /dev/sda1 /dev/sdb1 /dev/hda1 /dev/hdb1 /dev/hde1 /dev/hdf1
mdadm: array /dev/md1 started.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md2 --level=6 --raid-devices=5 /dev/sda2 /dev/sdb2 /dev/hda2 /dev/hdb2 /dev/hde2
mdadm: array /dev/md2 started.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --create /dev/md3 --level=6 --raid-devices=5 /dev/sda3 /dev/sdb3 /dev/hda3 /dev/hdb3 /dev/hde3
mdadm: array /dev/md3 started.&lt;/pre&gt;
&lt;p&gt;
add spare :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --add /dev/md2 /dev/sdf2
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mdadm --add /dev/md3 /dev/sdf3&lt;/pre&gt;
&lt;p&gt;
now wait for raid sync :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; watch cat /proc/mdstat
Every 2.0s: cat /proc/mdstat                                                      Fri Nov 13 21:49:39 2009

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md3 : active raid6 hdf3[4] hde3[3] hda3[2] sdb3[1] sda3[0]
      428597760 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
        resync=DELAYED

md2 : active raid6 hdf2[4] hde2[3] hda2[2] sdb2[1] sda2[0]
      157308288 blocks level 6, 64k chunk, algorithm 2 [5/5] [UUUUU]
      [==&amp;#62;..................]  resync = 10.4% (5496896/52436096) finish=36.8min speed=21227K/sec

md1 : active raid1 hdf1[4] hde1[3] hda1[2] sdb1[1] sda1[0]
      56128 blocks [5/5] [UUUUU]

unused devices: &amp;#60;none&amp;#62;&lt;/pre&gt;
&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
&lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;C&lt;/kbd&gt; to quit

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Crypt partitions :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup -y -v -c aes-xts-benbi:sha512 -h sha512 -s 512 luksFormat /dev/md2

WARNING!
========
This will overwrite data on /dev/md2 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup -y -v -c aes-xts-benbi:sha512 -h sha512 -s 512 luksFormat /dev/md3

WARNING!
========
This will overwrite data on /dev/md3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;p&gt;
Open encrypted partitions

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksOpen /dev/md2 md2
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cryptsetup luksOpen /dev/md3 md3
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.&lt;/pre&gt;
&lt;p&gt;
Format partitions

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mke2fs -j /dev/md1
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 /dev/mapper/md2
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 /dev/mapper/md3
mke2fs 1.41.3 (12-Oct-2008)
...
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
Do not use LVM as it “may” degrade (&lt;a href=&quot;http://mbhtech.blogspot.com/2009/09/software-raid-vs-lvm-quick-speed-test_08.html&quot; class=&quot;urlextern&quot; title=&quot;http://mbhtech.blogspot.com/2009/09/software-raid-vs-lvm-quick-speed-test_08.html&quot;  rel=&quot;nofollow&quot;&gt;see&lt;/a&gt;) performance and is very unnecessary if you create well sized partitions

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
mount drives (md3 will only be used in xen later)

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount /dev/mapper/md2 /mnt/gentoo/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /mnt/gentoo/boot
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount /dev/md1 /mnt/gentoo/boot/&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Creating raid&quot; [6775-10366] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation of &quot; id=&quot;installation of &quot;&gt;Installation of /&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Installation of /&quot; [10367-10397] --&gt;
&lt;h3&gt;&lt;a name=&quot;swap&quot; id=&quot;swap&quot;&gt;swap&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/mnt/gentoo/swap.img bs=1M count=1000
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkswap /mnt/gentoo/swap.img
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=11c45e43-4a60-43a6-8a99-352b5b1dc939
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; swapon /mnt/gentoo/swap.img
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; swapon -s
Filename                                Type            Size    Used    Priority
/mnt/gentoo/swap.img                    file            1023992 0       -1&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;swap&quot; [10398-10863] --&gt;
&lt;h3&gt;&lt;a name=&quot;stage3&quot; id=&quot;stage3&quot;&gt;Stage3&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
Download stage3

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; links http://www.gentoo.org/main/en/mirrors.xml&lt;/pre&gt;
&lt;p&gt;

select a mirror and download stage3 tar.gz file for your arch (amd64 for me)
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
direct download:

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/releases/amd64/current-stage3/stage3-amd64-*.tar.bz2&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Extract stage3

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time tar xjpf stage3*

real    1m10.811s
user    0m32.000s
sys     0m3.230s&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Be sur to mount boot partition before extracting stage3 or you will have problems with grub.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Stage3&quot; [10864-11513] --&gt;
&lt;h3&gt;&lt;a name=&quot;portage&quot; id=&quot;portage&quot;&gt;Portage&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo/usr
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; links http://www.gentoo.org/main/en/mirrors.xml&lt;/pre&gt;
&lt;p&gt;

select a mirror and download latest portage
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
direct download :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/snapshots/portage-latest.tar.bz2&lt;/pre&gt;
&lt;p&gt;


&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
Extract portage

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time tar xjf portage-lat*

real    1m31.991s
user    0m14.500s
sys     0m5.790s&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Portage&quot; [11514-11982] --&gt;
&lt;h3&gt;&lt;a name=&quot;chroot and prepare system&quot; id=&quot;chroot and prepare system&quot;&gt;Chroot and prepare system&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;chroot&quot; id=&quot;chroot&quot;&gt;Chroot&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -t proc proc /mnt/gentoo/proc
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -o bind /dev /mnt/gentoo/dev
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp -L /etc/resolv.conf /mnt/gentoo/etc/
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chroot /mnt/gentoo /bin/bash
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; source /etc/profile &amp;#38;&amp;#38; env-update
&amp;#62;&amp;#62;&amp;#62; Regenerating /etc/ld.so.cache...&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;root password&quot; id=&quot;root password&quot;&gt;Root password&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

change root password

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;keyboard map&quot; id=&quot;keyboard map&quot;&gt;Keyboard map&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dkeymaps&quot;&gt;/etc/conf.d/keymaps&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
KEYMAP=&quot;fr&quot;
...&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;fstab&quot; id=&quot;fstab&quot;&gt;fstab&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcfstab&quot;&gt;/etc/fstab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
/dev/md1                /boot           ext3            noauto,noatime  1 2
/dev/mapper/md2         /               ext4            noatime         0 1
/swap.img               none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
...&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not forget /boot filesystem as ext3 and / as ext4

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /etc/portage&lt;/pre&gt;
&lt;/div&gt;

&lt;h4&gt;&lt;a name=&quot;compilation optimization&quot; id=&quot;compilation optimization&quot;&gt;Compilation optimization&lt;/a&gt;&lt;/h4&gt;
&lt;div class=&quot;level4&quot;&gt;

&lt;p&gt;

Have a look on &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Safe_Cflags&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Safe_Cflags&quot;  rel=&quot;nofollow&quot;&gt;flags for your processor&lt;/a&gt; and populate your make.conf
&lt;/p&gt;

&lt;p&gt;
exemple for my core2

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcmake.conf&quot;&gt;/etc/make.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
CHOST=&quot;x86_64-pc-linux-gnu&quot;
CFLAGS=&quot;-march=core2 -O2 -pipe&quot;
CXXFLAGS=&quot;${CFLAGS}&quot;

MAKEOPTS=&quot;-j3&quot;

USE=&quot;mmx sse sse2 -X unicode ipv6 -fortran&quot;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
MAKEOPTS should be : number_of_processor_core + 1

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Chroot and prepare system&quot; [11983-13498] --&gt;
&lt;h2&gt;&lt;a name=&quot;kernel&quot; id=&quot;kernel&quot;&gt;Kernel&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Install package :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -a gentoo-sources&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Kernel&quot; [13499-13598] --&gt;
&lt;h3&gt;&lt;a name=&quot;kernel configuration&quot; id=&quot;kernel configuration&quot;&gt;Kernel configuration&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /usr/src/linux
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make menuconfig&lt;/pre&gt;&lt;pre class=&quot;code&quot;&gt;
Processor type and features  ---&amp;#62;
  [*] Paravirtualized guest support  ---&amp;#62;
    [ ]   Xen guest support
    [*]   KVM paravirtualized clock
    [*]   KVM Guest support
    -*-   Enable paravirtualization code
    [*]     Paravirtualization layer for spinlocks
      Processor family (Core 2/newer Xeon)  ---&amp;#62;
[*] Networking support  ---&amp;#62;
  Networking options  ---&amp;#62;
    &amp;#60;*&amp;#62; 802.1d Ethernet Bridging
Device Drivers  ---&amp;#62;
  [*] Network device support  ---&amp;#62;
    &amp;#60;*&amp;#62; Universal TUN/TAP device driver support
    &amp;#60;*&amp;#62;   Virtio network driver (EXPERIMENTAL)
  [*] Block devices ---&amp;#62;
    &amp;#60;*&amp;#62; Loopback device support
    &amp;#60;*&amp;#62;   Virtio block driver (EXPERIMENTAL)
      Character devices  ---&amp;#62;
    &amp;#60;*&amp;#62; Virtio console
    &amp;#60;*&amp;#62;   VirtIO Random Number Generator support
  [*] Multiple devices driver support (RAID and LVM)  ---&amp;#62;
    &amp;#60;*&amp;#62;   RAID support
    &amp;#60;*&amp;#62;     RAID-1 (mirroring) mode
    &amp;#60;*&amp;#62;     RAID-4/RAID-5/RAID-6 mode
    &amp;#60;*&amp;#62;   Device mapper support
    &amp;#60;*&amp;#62;     Crypt target support

    &amp;#60;M&amp;#62; I2C support  ---&amp;#62;
        &amp;#60;M&amp;#62; I2C device interface
            I2C Hardware Bus support ---&amp;#62;
            # Activate everything
    &amp;#60;M&amp;#62; Hardware Monitoring Support ---&amp;#62;
        # Activate everything

File systems  ---&amp;#62;
    &amp;#60;*&amp;#62; The Extended 4 (ext4) filesystem
    [*]   Ext4 extended attributes
    [*]     Ext4 POSIX Access Control Lists
    [*]     Ext4 Security Labels
    &amp;#60;*&amp;#62; FUSE (Filesystem in Userspace) support
-*- Cryptographic API  ---&amp;#62;
  &amp;#60;*&amp;#62;   XTS support (EXPERIMENTAL)
  &amp;#60;*&amp;#62;   SHA224 and SHA256 digest algorithm
  &amp;#60;*&amp;#62;   SHA384 and SHA512 digest algorithms
  -*-   AES cipher algorithms (x86_64)
  &amp;#60;*&amp;#62;   AES cipher algorithms (AES-NI)
[*] Virtualization ---&amp;#62;
    --- Virtualization
    &amp;#60;*&amp;#62;   Kernel-based Virtual Machine (KVM) support
    &amp;#60;*&amp;#62;     KVM for Intel processors support
    &amp;#60; &amp;#62;     KVM for AMD processors support
    &amp;#60;*&amp;#62;   Host kernel accelerator for virtio net (EXPERIMENTAL)
    &amp;#60;*&amp;#62;   PCI driver for virtio devices (EXPERIMENTAL)
    &amp;#60;*&amp;#62;   Virtio balloon driver (EXPERIMENTAL)&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not forget to set your devices drivers !
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; network devices&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; HDD controller&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

# lspci in livecd will tell you

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make -j3
...
Kernel: arch/x86/boot/vmlinuz is ready  (#1)
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make modules_install
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp arch/x86/boot/bzImage /boot/kernel&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Kernel configuration&quot; [13599-16048] --&gt;
&lt;h2&gt;&lt;a name=&quot;initramfs&quot; id=&quot;initramfs&quot;&gt;InitRamFs&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

&lt;strong&gt;Follow this link to build your initramfs :&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;&lt;a href=&quot;http://hive.awired.net/hive/system/gentoo/initramfs&quot; class=&quot;wikilink1&quot; title=&quot;hive:system:gentoo:initramfs&quot;&gt;build your initramfs&lt;/a&gt;&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
&lt;strong&gt;we have to use an initramfs to open encrypted drive during boot&lt;/strong&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;InitRamFs&quot; [16049-16273] --&gt;
&lt;h2&gt;&lt;a name=&quot;install grub&quot; id=&quot;install grub&quot;&gt;Install grub&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge grub
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; grub
grub&amp;#62; root (hd0,0)
grub&amp;#62; setup (hd0)
grub&amp;#62; root (hd1,0)
grub&amp;#62; setup (hd1)
grub&amp;#62; root (hd2,0)
grub&amp;#62; setup (hd2)
grub&amp;#62; root (hd3,0)
grub&amp;#62; setup (hd3)
grub&amp;#62; root (hd4,0)
grub&amp;#62; setup (hd4)
grub&amp;#62; root (hd5,0)
grub&amp;#62; setup (hd5)
grub&amp;#62; quit&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notetip&quot;&gt;&lt;span class=&quot;type&quot;&gt;tip: &lt;/span&gt;
hdX in grub corresponds to bios hard drive boot sequences, drives have to be set in bios

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;bootgrubgrub.conf&quot;&gt;/boot/grub/grub.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
title GLK
root (hd0,0)
kernel /boot/kernel root=/dev/mapper/md2
module /boot/initramfs.gz&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Install grub&quot; [16274-16850] --&gt;
&lt;h2&gt;&lt;a name=&quot;finished&quot; id=&quot;finished&quot;&gt;Finished!&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;initramfs&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; exit
&lt;span class=&quot;consoleName&quot;&gt;livecd&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; umount /mnt/gentoo/proc/ /mnt/gentoo/dev /mnt/gentoo/boot /mnt/gentoo&lt;/pre&gt;&lt;hr /&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;strong&gt;sources:&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
for installation:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

for xen: 
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.gentoo.org/doc/en/xen-guide.xml&quot; class=&quot;urlextern&quot; title=&quot;http://www.gentoo.org/doc/en/xen-guide.xml&quot;  rel=&quot;nofollow&quot;&gt;http://www.gentoo.org/doc/en/xen-guide.xml&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Xen&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Xen&quot;  rel=&quot;nofollow&quot;&gt;http://en.gentoo-wiki.com/wiki/Xen&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

for initramfs:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://en.gentoo-wiki.com/wiki/Initramfs&quot; class=&quot;urlextern&quot; title=&quot;http://en.gentoo-wiki.com/wiki/Initramfs&quot;  rel=&quot;nofollow&quot;&gt;http://en.gentoo-wiki.com/wiki/Initramfs&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&quot; class=&quot;urlextern&quot; title=&quot;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&quot;  rel=&quot;nofollow&quot;&gt;http://hive.awired.net/_media/system-administration/gentoo/gentoo-wiki/initramfs.htm&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; lots of internet search ;)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Finished!&quot; [16851-] --&gt;&lt;span class=&quot;plugin_feedmod_comments&quot;&gt;
  &lt;a href=&quot;http://hive.awired.net/hive/system/home-network/server-installation#discussion__section&quot; title=&quot;Read or add comments to this article&quot;&gt;Read or add comments to this article&lt;/a&gt;
&lt;/span&gt;
</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/system-configuration">
        <dc:format>text/html</dc:format>
        <dc:date>2010-07-20T15:08:38+02:00</dc:date>
        <title>D- System config</title>
        <link>http://hive.awired.net/hive/system/home-network/system-configuration</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;D- System config&quot; [1-33] --&gt;
&lt;h2&gt;&lt;a name=&quot;network configuration&quot; id=&quot;network configuration&quot;&gt;Network Configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_eth0=(&quot;null&quot;)
config_eth1=(&quot;null&quot;)

config_red=(&quot;192.168.0.3/24&quot;)
bridge_red=(&quot;eth0&quot;)
rc_need_red=&quot;net.eth0&quot;
brctl_red=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)
routes_red=(&quot;default via 192.168.0.2&quot;)

config_green=(&quot;192.168.2.3/24&quot;)
bridge_green=(&quot;eth1&quot;)
rc_need_green=&quot;net.eth1&quot;
brctl_green=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)

config_dmz=(&quot;null&quot;)
brctl_dmz=(
        &quot;setfd 0&quot;
        &quot;stp off&quot;
)&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /etc/init.d
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.eth1
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.red
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.green
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s net.lo net.dmz
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.eth0 default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.eth1 default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.red default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.green default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add net.dmz default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.eth0 start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.eth1 start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.red start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.green start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;init.d&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.dmz start&lt;/pre&gt;
&lt;p&gt;
Now add ssh deamon to runlevels
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sshd default
 * sshd added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/sshd start
Generating public/private rsa1 key pair.
...
 * Starting sshd ...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Network Configuration&quot; [34-1455] --&gt;
&lt;h2&gt;&lt;a name=&quot;hostname configuration&quot; id=&quot;hostname configuration&quot;&gt;Hostname configuration&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etchosts&quot;&gt;/etc/hosts&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
127.0.0.1       srv-prs.home.loc srv-prs localhost
...&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhostname&quot;&gt;/etc/conf.d/hostname&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;srv-prs&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname srv-prs
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname -f
srv-prs.home.loc
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Hostname configuration&quot; [1456-1751] --&gt;
&lt;h2&gt;&lt;a name=&quot;timezone&quot; id=&quot;timezone&quot;&gt;Timezone&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp /usr/share/zoneinfo/Europe/Paris /etc/localtime&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dclock&quot;&gt;/etc/conf.d/clock&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
TIMEZONE=&quot;Europe/Paris&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge ntp
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add ntp-client default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ntp-client start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Timezone&quot; [1752-2074] --&gt;
&lt;h2&gt;&lt;a name=&quot;rebuild for optimisation&quot; id=&quot;rebuild for optimisation&quot;&gt;Rebuild for optimisation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; time emerge -vae world
...

real    183m54.743s
user    155m45.326s
sys     86m24.708s&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Rebuild for optimisation&quot; [2075-2238] --&gt;
&lt;h2&gt;&lt;a name=&quot;installation of basic softwares&quot; id=&quot;installation of basic softwares&quot;&gt;Installation of basic softwares&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -a syslog-ng vixie-cron sendmail logrotate cryptsetup mdadm bridge-utils usermode-utilities htop pci-utils usbutils
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add syslog-ng default
 * syslog-ng added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add vixie-cron default
 * vixie-cron added to runlevel default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sendmail default
 * sendmail added to runlevel default&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;syslog-ng&lt;/em&gt; log system&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;vixie-cron&lt;/em&gt; cron system&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;sendmail&lt;/em&gt; to send administration mails&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;logrotate&lt;/em&gt; rotate logs to prevend hard drive fill&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;cryptsetup&lt;/em&gt; to manage encrypted drives&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;mdadm&lt;/em&gt; to manage raid&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;htop&lt;/em&gt; a better &lt;em&gt;top&lt;/em&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;pci-utils&lt;/em&gt; to privide lspci&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;usbutils&lt;/em&gt; to provide lsusb&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;bridge-utils&lt;/em&gt; to manage bridge if we have to do things by hand&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;em&gt;usermode-utilities&lt;/em&gt; to manage tun(tunctl) if we have to do things by hand&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Installation of basic softwares&quot; [2239-3208] --&gt;
&lt;h2&gt;&lt;a name=&quot;hdparm&quot; id=&quot;hdparm&quot;&gt;Hdparm&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

To save power and hard drive life you can configure your hard drive to Spindown after a time without using it :

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -v hdparm&lt;/pre&gt;
&lt;p&gt;
The Time (in seconds) after which the Drive spins down is the value of your x multiplied with 5 From the manpage:
&lt;/p&gt;

&lt;p&gt;
A value of zero means “timeouts are disabled”: the device will not automatically enter standby mode.
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.
Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours.
A value of 252 signifies a  timeout  of  21  minutes.
A value of 253 sets a vendor-defined timeout period between 8 and 12 hours.
A value of 255 is interpreted as 21 minutes plus 15 seconds.
The value 254 is reserved.
Note that some older drives may have very different interpretations of these values.
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhdparm&quot;&gt;/etc/conf.d/hdparm&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
sda_args=&quot;-S241&quot;
sdd_args=&quot;-S241&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/hdparm start
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add hdparm default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Hdparm&quot; [3209-4315] --&gt;
&lt;h2&gt;&lt;a name=&quot;iptables&quot; id=&quot;iptables&quot;&gt;Iptables&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

As you can see in network configuration the server has 2 legs in 2 networks : red and green.
&lt;/p&gt;

&lt;p&gt;
the green one will be the default one and the red one is an admin interface to the world(next to red network), where we are going to allow only ssh access :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -va iptables&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;code&quot;&gt;
#!/bin/bash -x

iptables -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -i eth0 -p tcp --destination-port 22 -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --source-port 22 -j ACCEPT

iptables -A INPUT -i eth0 -j REJECT
iptables -A OUTPUT -o eth0 -j REJECT

# IPV6
ip6tables -F INPUT
ip6tables -F OUTPUT
ip6tables -F FORWARD
ip6tables -F

ip6tables -P INPUT DROP
ip6tables -P OUTPUT DROP
ip6tables -P FORWARD DROP

echo &quot;0&quot; &amp;#62;/proc/sys/net/ipv6/conf/all/forwarding&lt;/pre&gt;&lt;p class=&quot;codefoot&quot;&gt;&lt;a name=&quot;rootfw.sh&quot;&gt;/root/fw.sh&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x /root/fw.sh
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add iptables default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add ip6tables default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/iptables start
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ip6tables start
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /root/fw.sh
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/iptables save
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ip6tables save&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Iptables&quot; [4316-5585] --&gt;
&lt;h2&gt;&lt;a name=&quot;kvm&quot; id=&quot;kvm&quot;&gt;KVM&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Layers used by to manage virtualisation :

&lt;/p&gt;
&lt;table class=&quot;inline&quot;&gt;
	&lt;tr class=&quot;row0&quot;&gt;
		&lt;th class=&quot;col0 centeralign&quot; colspan=&quot;3&quot;&gt;  LAYERS        &lt;/th&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row1&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;3&quot;&gt;  Hardware      &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row2&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;3&quot;&gt;  KVM           &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row3&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;3&quot;&gt;  qemu          &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row4&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot; colspan=&quot;3&quot;&gt;  libvirt       &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row5&quot;&gt;
		&lt;td class=&quot;col0 rightalign&quot;&gt;  virsh &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  virt-manager  &lt;/td&gt;&lt;td class=&quot;col2 centeralign&quot;&gt;  archipel?  &lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class=&quot;row6&quot;&gt;
		&lt;td class=&quot;col0 centeralign&quot;&gt;  cli   &lt;/td&gt;&lt;td class=&quot;col1 centeralign&quot;&gt;  client        &lt;/td&gt;&lt;td class=&quot;col2 centeralign&quot;&gt;  web?       &lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
We are currently not going to install the web part of administration

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcportagepackage.use&quot;&gt;/etc/portage/package.use&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
app-emulation/libvirt qemu udev
x11-libs/cairo X&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -va cairo dbus qemu-kvm libvirt virt-manager
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add libvirtd default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add dbus default
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/libvirtd start
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/dbus start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;KVM&quot; [5586-6215] --&gt;
&lt;h2&gt;&lt;a name=&quot;guest kernel compilation&quot; id=&quot;guest kernel compilation&quot;&gt;Guest Kernel compilation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

May not be needed…
&lt;/p&gt;

&lt;p&gt;
&lt;!--
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Guest Kernel compilation&quot; [6216-6294] --&gt;
&lt;h3&gt;&lt;a name=&quot;separation of dom0 and domu kernels&quot; id=&quot;separation of dom0 and domu kernels&quot;&gt;Separation of dom0 and domU kernels&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

We are going to create 2 scripts to compile the domU and dom0.
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /usr/src/linux/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; echo &quot;mkdir -p _dom0 &amp;#38;&amp;#38; make O=_dom0 \$@&quot; &amp;#62; make0.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; echo &quot;mkdir -p _domU &amp;#38;&amp;#38; make O=_domU \$@&quot; &amp;#62; makeU.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chmod +x make?.sh
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./make0.sh menuconfig&lt;/pre&gt;
&lt;p&gt;
Just Exit and Save.
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./makeU.sh menuconfig
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp .config _dom0/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp .config _domU/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; make mrproper&lt;/pre&gt;
&lt;p&gt;
Same thing, Exit and save.
&lt;/p&gt;

&lt;p&gt;
now you can compile :
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; your dom0 kernel by doing &lt;strong&gt;./make0.sh …&lt;/strong&gt; in &lt;strong&gt;/usr/src/linux&lt;/strong&gt; and take the kernel in &lt;strong&gt;/usr/src/linux/_dom0&lt;/strong&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; your domU kernel by doing &lt;strong&gt;./makeU.sh …&lt;/strong&gt; in &lt;strong&gt;/usr/src/linux&lt;/strong&gt; and take the kernel in &lt;strong&gt;/usr/src/linux/_domU&lt;/strong&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Separation of dom0 and domU kernels&quot; [6295-7158] --&gt;
&lt;h3&gt;&lt;a name=&quot;domu compilation&quot; id=&quot;domu compilation&quot;&gt;domU compilation&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;
Processor type and features  ---&amp;#62;
  [*] Paravirtualized guest support  ---&amp;#62;
    [ ]   Xen guest support
    [*]   KVM paravirtualized clock
    [*]   KVM Guest support
    -*-   Enable paravirtualization code
    [*]     Paravirtualization layer for spinlocks
      Processor family (Core 2/newer Xeon)  ---&amp;#62;
[*] Networking support  ---&amp;#62;
  Networking options  ---&amp;#62;
    &amp;#60;*&amp;#62; 802.1d Ethernet Bridging
Device Drivers  ---&amp;#62;
  [*] Network device support  ---&amp;#62;
    &amp;#60;*&amp;#62; Universal TUN/TAP device driver support
    &amp;#60;*&amp;#62;   Virtio network driver (EXPERIMENTAL)
  [*] Block devices ---&amp;#62;
    &amp;#60;*&amp;#62; Loopback device support
    &amp;#60;*&amp;#62;   Virtio block driver (EXPERIMENTAL)
      Character devices  ---&amp;#62;
    &amp;#60;*&amp;#62; Virtio console
    &amp;#60;*&amp;#62;   VirtIO Random Number Generator support
  [*] Multiple devices driver support (RAID and LVM)  ---&amp;#62;
    &amp;#60;*&amp;#62;   RAID support
    &amp;#60;*&amp;#62;     RAID-1 (mirroring) mode
    &amp;#60;*&amp;#62;     RAID-4/RAID-5/RAID-6 mode
    &amp;#60;*&amp;#62;   Device mapper support
    &amp;#60;*&amp;#62;     Crypt target support
File systems  ---&amp;#62;
    &amp;#60;*&amp;#62; The Extended 4 (ext4) filesystem
    [*]   Ext4 extended attributes
    [*]     Ext4 POSIX Access Control Lists
    [*]     Ext4 Security Labels
    &amp;#60;*&amp;#62; FUSE (Filesystem in Userspace) support
-*- Cryptographic API  ---&amp;#62;
  &amp;#60;*&amp;#62;   XTS support (EXPERIMENTAL)
  &amp;#60;*&amp;#62;   SHA224 and SHA256 digest algorithm
  &amp;#60;*&amp;#62;   SHA384 and SHA512 digest algorithms
  -*-   AES cipher algorithms (x86_64)
  &amp;#60;*&amp;#62;   AES cipher algorithms (AES-NI)
[*] Virtualization ---&amp;#62;
    --- Virtualization
    &amp;#60;*&amp;#62;   Kernel-based Virtual Machine (KVM) support
    &amp;#60;*&amp;#62;     KVM for Intel processors support
    &amp;#60; &amp;#62;     KVM for AMD processors support
    &amp;#60;*&amp;#62;   Host kernel accelerator for virtio net (EXPERIMENTAL)
    &amp;#60;*&amp;#62;   PCI driver for virtio devices (EXPERIMENTAL)
    &amp;#60;*&amp;#62;   Virtio balloon driver (EXPERIMENTAL)&lt;/pre&gt;
&lt;p&gt;
Now compile :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ./makeU.sh -j3
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp _domU/arch/x86/boot/bzImage ../&lt;/pre&gt;
&lt;p&gt;

--&gt;

&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;domU compilation&quot; [7159-] --&gt;</description>
    </item>
    <item rdf:about="http://hive.awired.net/hive/system/home-network/xen-guest-installation">
        <dc:format>text/html</dc:format>
        <dc:date>2010-07-20T20:09:06+02:00</dc:date>
        <title>E- Guest installation</title>
        <link>http://hive.awired.net/hive/system/home-network/xen-guest-installation</link>
        <description>


&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;E- Guest installation&quot; [1-37] --&gt;
&lt;h2&gt;&lt;a name=&quot;vm supervision&quot; id=&quot;vm supervision&quot;&gt;VM supervision&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

go to &lt;a href=&quot;http://people.redhat.com/~rjones/virt-top/download.html&quot; class=&quot;urlextern&quot; title=&quot;http://people.redhat.com/~rjones/virt-top/download.html&quot;  rel=&quot;nofollow&quot;&gt; virt-top&lt;/a&gt; and download a binary package of the virt-top
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;VM supervision&quot; [38-188] --&gt;
&lt;h2&gt;&lt;a name=&quot;gentoo installation&quot; id=&quot;gentoo installation&quot;&gt;Gentoo installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;

Creation of vm directory :
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /var/vm/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /var/vm/def-gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/var/vm/def-gentoo/def-gentoo.img bs=1M count=3500
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; dd if=/dev/zero of=/var/vm/def-gentoo/def-gentoo.swap bs=1M count=1000
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkfs.ext4 -N 600000 /var/vm/def-gentoo/def-gentoo.img
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkswap /var/vm/def-gentoo/def-gentoo.swap&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
We provide a huge inode size during ext4 format to be prepare to resize disk

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
This will create a disk image of 3.5G and a swap of 1G.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Gentoo installation&quot; [189-789] --&gt;
&lt;h3&gt;&lt;a name=&quot;configuration file&quot; id=&quot;configuration file&quot;&gt;Configuration file&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;varvmdef-gentoodef-gentoo.xml&quot;&gt;/var/vm/def-gentoo/def-gentoo.xml&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
&amp;#60;domain type='kvm'&amp;#62;
  &amp;#60;name&amp;#62;def-gentoo&amp;#60;/name&amp;#62;
  &amp;#60;memory&amp;#62;1048576&amp;#60;/memory&amp;#62;
  &amp;#60;currentMemory&amp;#62;1048576&amp;#60;/currentMemory&amp;#62;
  &amp;#60;vcpu&amp;#62;2&amp;#60;/vcpu&amp;#62;
  &amp;#60;os&amp;#62;
    &amp;#60;type arch='x86_64'&amp;#62;hvm&amp;#60;/type&amp;#62;
    &amp;#60;boot dev='hd'/&amp;#62;
    &amp;#60;kernel&amp;#62;/usr/src/bzImage&amp;#60;/kernel&amp;#62;
    &amp;#60;!--&amp;#60;initrd&amp;#62;/usr/src/initrd&amp;#60;/initrd&amp;#62;--&amp;#62;
    &amp;#60;cmdline&amp;#62;root=/dev/vda console=ttyS0&amp;#60;/cmdline&amp;#62;
  &amp;#60;/os&amp;#62;
  &amp;#60;features&amp;#62;
    &amp;#60;acpi/&amp;#62;
    &amp;#60;apic/&amp;#62;
  &amp;#60;/features&amp;#62;
  &amp;#60;cpu&amp;#62;
    &amp;#60;topology sockets='1' cores='2' threads='1' /&amp;#62;
  &amp;#60;/cpu&amp;#62;
  &amp;#60;clock offset='localtime' /&amp;#62;
  &amp;#60;on_poweroff&amp;#62;destroy&amp;#60;/on_poweroff&amp;#62;
  &amp;#60;on_reboot&amp;#62;restart&amp;#60;/on_reboot&amp;#62;
  &amp;#60;on_crash&amp;#62;restart&amp;#60;/on_crash&amp;#62;
  &amp;#60;devices&amp;#62;
    &amp;#60;emulator&amp;#62;/usr/bin/kvm&amp;#60;/emulator&amp;#62;

    &amp;#60;!-- DRIVES --&amp;#62;
    &amp;#60;disk type='file' device='disk'&amp;#62;
      &amp;#60;driver name='qemu' type='raw' cache='none' /&amp;#62;
      &amp;#60;source file='/var/vm/def-gentoo/def-gentoo.img'/&amp;#62;
      &amp;#60;!--&amp;#60;shareable/&amp;#62;--&amp;#62;
      &amp;#60;target dev='vda' bus='virtio'/&amp;#62;
    &amp;#60;/disk&amp;#62;
    &amp;#60;disk type='file' device='disk'&amp;#62;
      &amp;#60;driver name='qemu' type='raw' /&amp;#62;
      &amp;#60;source file='/var/vm/def-gentoo/def-gentoo.swap'/&amp;#62;
      &amp;#60;target dev='vdb' bus='virtio'/&amp;#62;
    &amp;#60;/disk&amp;#62;

    &amp;#60;!-- NETWORK --&amp;#62;
    &amp;#60;interface type='bridge'&amp;#62;
      &amp;#60;mac address='52:54:00:2a:00:02' /&amp;#62;
      &amp;#60;source bridge='red'/&amp;#62;
      &amp;#60;model type='virtio' /&amp;#62;
    &amp;#60;/interface&amp;#62;
    &amp;#60;interface type='bridge'&amp;#62;
      &amp;#60;mac address='52:54:00:2a:02:02' /&amp;#62;
      &amp;#60;source bridge='green'/&amp;#62;
      &amp;#60;model type='virtio' /&amp;#62;
    &amp;#60;/interface&amp;#62;

    &amp;#60;serial type='pty'&amp;#62;
      &amp;#60;target port='0'/&amp;#62;
    &amp;#60;/serial&amp;#62;
    &amp;#60;console type='pty'&amp;#62;
      &amp;#60;target port='0'/&amp;#62;
    &amp;#60;/console&amp;#62;
    &amp;#60;graphics type='vnc' port='-1' keymap='fr' listen='127.0.0.1' /&amp;#62;
  &amp;#60;/devices&amp;#62;
&amp;#60;/domain&amp;#62;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not forget to update mac addresses of network interfaces

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Configuration file&quot; [790-2564] --&gt;
&lt;h3&gt;&lt;a name=&quot;install &quot; id=&quot;install &quot;&gt;install /&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mkdir /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; mount -o loop /var/vm/def-gentoo/def-gentoo.img /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd /mnt/gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/releases/amd64/current-stage3/stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; tar xjpf stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm stage3-amd64-*.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;gentoo&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd usr/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; wget ftp://ftp.free.fr/mirrors/ftp.gentoo.org/snapshots/portage-latest.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; tar xjf portage-latest.tar.bz2
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;usr&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm portage-latest.tar.bz2&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;mntgentooetcfstab&quot;&gt;/mnt/gentoo/etc/fstab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
#/dev/BOOT              /boot           ext2            noauto,noatime  1 2
/dev/vda               /               ext4            noatime         0 1
/dev/vdb               none            swap            sw              0 0
/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
#/dev/fd0               /mnt/floppy     auto            noauto          0 0
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; chroot /mnt/gentoo /bin/bash
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; env-update &amp;#38;&amp;#38; source /etc/profile
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; passwd
New password:
Retype new password:
passwd: password updated successfully&lt;/pre&gt;
&lt;p&gt;
Now we are going to add serial output console (uncomment serial console)
&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcinittab&quot;&gt;/etc/inittab&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;linux&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; exit
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cd
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; umount /mnt/gentoo&lt;/pre&gt;
&lt;p&gt;
add vm to libvirt
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s /var/vm/def-gentoo.xml /etc/libvirt/qemu/def-gentoo.xml
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ln -s /etc/libvirt/qemu/def-gentoo.xml /etc/libvirt/qemu/autostart/def-gentoo.xml
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/libvirtd reload
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; virsh list --all
 Id Name                 State
----------------------------------
  - def-gentoo           shut off

&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; virsh create def-gentoo
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;src&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; virsh console def-gentoo
...
This is localhost.unknown_domain (Linux x86_64 2.6.31-xen-r7) 17:24:49

localhost login: root
Password:&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
To detach the vm screen : 
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; ctrl + ] (on english keyboard)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; ctrl + $ (on french keyboard)&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
Do not use &lt;strong&gt;less&lt;/strong&gt; on vm console it will crash return lines in your current shell, use an ssh connection instread.

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;install /&quot; [2565-4932] --&gt;
&lt;h3&gt;&lt;a name=&quot;set network&quot; id=&quot;set network&quot;&gt;Set network&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dnet&quot;&gt;/etc/conf.d/net&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
config_eth0=(&quot;192.168.0.254/24&quot;)
routes_eth0=(&quot;default via 192.168.0.1&quot;)&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcresolv.conf&quot;&gt;/etc/resolv.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
nameserver 212.27.40.240
nameserver 212.27.40.241&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;notewarning&quot;&gt;&lt;span class=&quot;type&quot;&gt;warning: &lt;/span&gt;
use your provider dns servers

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/net.eth0 start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Set network&quot; [4933-5268] --&gt;
&lt;h3&gt;&lt;a name=&quot;rebuild&quot; id=&quot;rebuild&quot;&gt;rebuild&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;

configure make.conf

&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcmake.conf&quot;&gt;/etc/make.conf&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
CFLAGS=&quot;-march=core2 -O2 -pipe&quot;
CXXFLAGS=&quot;${CFLAGS}&quot;
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST=&quot;x86_64-pc-linux-gnu&quot;

MAKEOPTS=&quot;-j3&quot;

# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE=&quot;mmx sse sse2 -X unicode ipv6 -fortran&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge -vae world&lt;/pre&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rm -Rf /usr/portage/distfiles/
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add sshd default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge syslog-ng vixie-cron logrotate
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add syslog-ng default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add vixie-cron default&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;rebuild&quot; [5269-6061] --&gt;
&lt;h3&gt;&lt;a name=&quot;timezone&quot; id=&quot;timezone&quot;&gt;Timezone&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; cp /usr/share/zoneinfo/Europe/Paris /etc/localtime&lt;/pre&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dclock&quot;&gt;/etc/conf.d/clock&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
TIMEZONE=&quot;Europe/Paris&quot;
...&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; emerge ntp
...
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; rc-update add ntp-client default
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; /etc/init.d/ntp-client start&lt;/pre&gt;
&lt;/div&gt;
&lt;!-- SECTION &quot;Timezone&quot; [6062-6383] --&gt;
&lt;h3&gt;&lt;a name=&quot;set hostname&quot; id=&quot;set hostname&quot;&gt;Set hostname&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etchosts&quot;&gt;/etc/hosts&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
...
127.0.0.1 VMNAME.home.loc VMNAME localhost
...&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;p class=&quot;codehead&quot;&gt;&lt;a name=&quot;etcconf.dhostname&quot;&gt;/etc/conf.d/hostname&lt;/a&gt;&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;VMNAME&quot;&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleName&quot;&gt;localhost&lt;/span&gt; &lt;span class=&quot;consolePath&quot;&gt;~&lt;/span&gt; &lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; hostname VMNAME&lt;/pre&gt;
&lt;p&gt;

&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
fw-prs.img 4000
fw-prs.swap 1024
&lt;/p&gt;

&lt;p&gt;

&lt;/div&gt;&lt;/p&gt;
*/
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Set hostname&quot; [6384-6656] --&gt;
&lt;h2&gt;&lt;a name=&quot;virtualization installation&quot; id=&quot;virtualization installation&quot;&gt;Virtualization installation&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;


&lt;pre class=&quot;code&quot;&gt;
&amp;#60;domain type='kvm' id='2'&amp;#62;
  &amp;#60;name&amp;#62;2003-def&amp;#60;/name&amp;#62;
  &amp;#60;memory&amp;#62;262144&amp;#60;/memory&amp;#62;
  &amp;#60;currentMemory&amp;#62;162144&amp;#60;/currentMemory&amp;#62;
  &amp;#60;vcpu&amp;#62;2&amp;#60;/vcpu&amp;#62;
  &amp;#60;os&amp;#62;
    &amp;#60;type arch='x86_64'&amp;#62;hvm&amp;#60;/type&amp;#62;
    &amp;#60;boot dev='hd'/&amp;#62;
  &amp;#60;/os&amp;#62;
  &amp;#60;features&amp;#62;
    &amp;#60;acpi/&amp;#62;
    &amp;#60;apic/&amp;#62;
  &amp;#60;/features&amp;#62;
  &amp;#60;cpu&amp;#62;
    &amp;#60;topology sockets='1' cores='2' threads='1' /&amp;#62;
  &amp;#60;/cpu&amp;#62;
  &amp;#60;clock offset='localtime' /&amp;#62;
  &amp;#60;on_poweroff&amp;#62;destroy&amp;#60;/on_poweroff&amp;#62;
  &amp;#60;on_reboot&amp;#62;destroy&amp;#60;/on_reboot&amp;#62;
  &amp;#60;on_crash&amp;#62;destroy&amp;#60;/on_crash&amp;#62;
  &amp;#60;devices&amp;#62;
    &amp;#60;emulator&amp;#62;/usr/bin/kvm&amp;#60;/emulator&amp;#62;
    &amp;#60;disk type='file' device='disk'&amp;#62;
      &amp;#60;driver name='qemu' type='raw' cache='none' /&amp;#62;
      &amp;#60;source file='/var/vm/2003-def/2003-def.img'/&amp;#62;
      &amp;#60;target dev='hda' bus='virtio'/&amp;#62;
    &amp;#60;/disk&amp;#62;
    &amp;#60;disk type='file' device='disk'&amp;#62;
      &amp;#60;driver name='qemu' type='raw' /&amp;#62;
      &amp;#60;source file='/var/vm/2003-def/d.img'/&amp;#62;
      &amp;#60;target dev='hdb' bus='virtio'/&amp;#62;
    &amp;#60;/disk&amp;#62;
    &amp;#60;disk type='file' device='cdrom'&amp;#62;
      &amp;#60;driver name='qemu' /&amp;#62;
      &amp;#60;source file='/root/FR_WS03VL.iso' /&amp;#62;
      &amp;#60;target dev='hdc' bus='ide' /&amp;#62;
      &amp;#60;readonly/&amp;#62;
    &amp;#60;/disk&amp;#62;
    &amp;#60;interface type='bridge'&amp;#62;
      &amp;#60;!--&amp;#60;mac address='.......' /&amp;#62;--&amp;#62;
      &amp;#60;source bridge='red'/&amp;#62;
      &amp;#60;target dev='tap0'/&amp;#62;
      &amp;#60;model type='virtio' /&amp;#62;
    &amp;#60;/interface&amp;#62;

    &amp;#60;serial type='pty'&amp;#62;
      &amp;#60;source path='/dev/pts/1'/&amp;#62;
      &amp;#60;target port='0'/&amp;#62;
      &amp;#60;alias name='serial0'/&amp;#62;
    &amp;#60;/serial&amp;#62;
    &amp;#60;console type='pty' tty='/dev/pts/1'&amp;#62;
      &amp;#60;source path='/dev/pts/1'/&amp;#62;
      &amp;#60;target port='0'/&amp;#62;
      &amp;#60;alias name='serial0'/&amp;#62;
    &amp;#60;/console&amp;#62;

    &amp;#60;sound model='ac97'&amp;#62;
    &amp;#60;/sound&amp;#62;


    &amp;#60;input type='tablet' bus='usb'/&amp;#62;
    &amp;#60;graphics type='vnc' port='-1' keymap='fr' listen='127.0.0.1'/&amp;#62;
  &amp;#60;/devices&amp;#62;
&amp;#60;/domain&amp;#62;&lt;/pre&gt;
&lt;p&gt;

localhost src # virsh vncdisplay def-gentoo
127.0.0.1:1
&lt;/p&gt;

&lt;p&gt;
Now we are going to connect to vnc display using ssh to redirect ports :
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Virtualization installation&quot; [6657-9921] --&gt;
&lt;h3&gt;&lt;a name=&quot;using putty&quot; id=&quot;using putty&quot;&gt;Using Putty&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;

&lt;p&gt;
In putty configuration settings :
&lt;/p&gt;

&lt;p&gt;
Connection → &lt;acronym title=&quot;Secure Shell&quot;&gt;SSH&lt;/acronym&gt; → tunnels

&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;port :&lt;/strong&gt; 59001&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;destination :&lt;/strong&gt; localhost:5901&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;

Then use vncviewer.exe to connect to 127.0.0.1:59001
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Using Putty&quot; [9922-10121] --&gt;
&lt;h3&gt;&lt;a name=&quot;using linux client&quot; id=&quot;using linux client&quot;&gt;Using Linux client&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; ssh -L59001:192.168.0.3:5901&lt;/pre&gt;
&lt;p&gt;

and in an other term

&lt;/p&gt;
&lt;pre class=&quot;console&quot;&gt;
&lt;span class=&quot;consoleSharp&quot;&gt;#&lt;/span&gt; vinagre 127.0.0.1:59001&lt;/pre&gt;
&lt;p&gt;
&lt;p&gt;&lt;div class=&quot;noteclassic&quot;&gt;
Using vnc this way allow to not care about vnc security (with svn listening only on local) while always have vnc accessible on each vm and give access only to the root user with the security of ssh

&lt;/div&gt;&lt;/p&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- SECTION &quot;Using Linux client&quot; [10122-] --&gt;</description>
    </item>
</rdf:RDF>
