diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/index.html | 34 | ||||
-rw-r--r-- | tools/qemu.html | 83 |
2 files changed, 70 insertions, 47 deletions
diff --git a/tools/index.html b/tools/index.html index c30c85e..b721f73 100644 --- a/tools/index.html +++ b/tools/index.html @@ -76,14 +76,6 @@ <li><a href="nmap.html">Nmap</a></li> </ul> </li> - <li><a href="qemu.html">Qemu</a> - <ul> - <li><a href="qemu.html#kern">1. Host System</a></li> - <li><a href="qemu.html#disk">2. Disk images</a></li> - <li><a href="qemu.html#net">3, Network</a></li> - </ul> - </li> - <li><a href="storage.html">Storage</a> <ul> <li><a href="storage.html#mv">Moving partitions</a></li> @@ -97,19 +89,17 @@ <li><a href="syslog-ng.html#install">Install syslog-ng</a></li> <li><a href="syslog-ng.html#syslogrc">Syslog-ng RC</a></li> <li><a href="syslog-ng.html#syslog-conf">Syslog-ng configuration</a></li> - </ul> - </li> + <li><a href="logrotate.html">Logrotate</a></li> + <li><a href="logwatch.html">Logwatch</a> + <ul> + <li><a href="logwatch.html#conf">Configure Logwatch</a></li> + <li><a href="logwatch.html#cron">Set cron task</a></li> + </ul> + </li> - <li><a href="logrotate.html">Logrotate</a></li> - <li> - <a href="logwatch.html">Logwatch</a> - <ul> - <li><a href="logwatch.html#conf">Configure Logwatch</a></li> - <li><a href="logwatch.html#cron">Set cron task</a></li> </ul> </li> - <li> - <a href="fail2ban.html">Fail2Ban</a> + <li><a href="fail2ban.html">Fail2Ban</a> <ul> <li><a href="fail2ban.html#conf">Configure Fail2ban</a></li> </ul> @@ -119,6 +109,14 @@ <h2>Network Services</h2> <ul> + <li><a href="qemu.html">Qemu</a> + <ul> + <li><a href="qemu.html#kern">1. Host System</a></li> + <li><a href="qemu.html#disk">2. Disk images</a></li> + <li><a href="qemu.html#net">3. Network</a></li> + <li><a href="qemu.html#guest">4. Guest System</a></li> + </ul> + </li> <li> <a href="openssh.html">OpenSSH</a> <ul> diff --git a/tools/qemu.html b/tools/qemu.html index 68850e7..ce1b66d 100644 --- a/tools/qemu.html +++ b/tools/qemu.html @@ -12,6 +12,14 @@ <h2 id="kern">1. Host System</h2> + <p>Load modules, in this case kvm of intel cpu;</p> + + <pre> + # modprobe -a kvm-intel tun virtio + </pre> + + <p>Add users to kvm group;</p> + <pre> # usermod -a -G kvm c9admin # usermod -a -G kvm username @@ -42,40 +50,51 @@ $ sudo qemu-nbd -c /dev/nbd0 /crux-img.qcow2 </pre> - <p>To disconnect image disk (ndb);</a> + <p>To disconnect image disk (ndb);</p> <pre> $ sudo qemu-nbd -d /dev/nbd0 </pre> - <p>You can use image as a normal disk, example how + <p>Information about preparing + <a href="../core/install.html#step2">partitions</a> + and <a href="storage.html">storage</a> administration. + You can use image as a normal disk, example how to use parted to create a gpt system table;</p> <pre> # parted /dev/nbd0 (parted) mklabel gpt + (parted) mkpart ext4 0% 100% + (parted) set 1 boot on </pre> - <p>More information about - <a href="http://devil-detail.blogspot.pt/2013/07/install-grub2-on-gpt-disk-dedicated-partition.html">gpt partition table</a>. - </p> + <pre> + # kpartx -a -s -l -u /dev/nbd0 + </pre> - <p>If partitions are on qcow2 image then setup partitions;</p> + <pre> + # mkfs.ext4 /dev/mapper/nbd0p1 + </pre> + + <p>Mount partition;</p> <pre> - # kpartx -a -s -l /dev/nbd0 + # mount /dev/mapper/nbd0p1 </pre> <h2 id="net">2. Network</h2> <p>Network configuration;</p> + <dl> <dt>slirp</dt> - <dd>network slirp</dd> + <dd>Default virtual NAT'd network.</dd> <dt>tun/tap</dt> - <dd>network tap</dd> - <dt>...</dt> - <dd>... ...</dd> + <dd>Good performance to create virtually any type of network + topology.</dd> + <dt>vde</dt> + <dd>The VDE networking backend.</dd> </dl> @@ -90,7 +109,7 @@ you can set only user or group;</p> <pre> - # tunctl -u username -g kvm + # tunctl -u username -g kvm -t tap0 </pre> <p>Set permissions to existing tap interface;</p> @@ -102,12 +121,24 @@ <p>Manual creation of tap interface;</p> - <pre> - # ip tuntap add name tap0 mode tap + <pre> + # ip tuntap add name tap0 mode tap # chmod 0666 /dev/tap0 # chown root:username /dev/tap0 - # ip link show - </pre> + </pre> + + <pre> + # ip addr add 10.0.2.1/24 dev tap0 + # ip link set dev tap0 up + # ip link show + </pre> + + <pre> + # sysctl -w net.ipv4.ip_forward=1 + # iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE + </pre> + + <h2 id="guest">Guest System</h2> <p>Start qemu with 512 of ram, mydisk.img as disk and boot from iso</p> @@ -117,25 +148,19 @@ -m 512 \ -boot d -cdrom image.iso \ -hda mydisk.img - </pre> + </pre> <p>Start qemu with 1024 of ram, network configured using tap0 interface device no host and boot from crux.qcow2;</p> - <pre> - $ qemu-system-x86_64 \ - -enable-kvm \ - -m 1024 \ - -hda c9/local/crux.qcow2 \ - -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no + <pre> + $ qemu-system-x86_64 \ + -enable-kvm \ + -m 1024 \ + -hda c9/local/crux.qcow2 \ + -net nic,model=virtio -net tap,ifname=tap0,script=no,downscript=no </pre> - <p>On host machine test network;</p> - - <pre> - # tcpdump tap0 - </pre> - <a href="index.html">Tools Index</a> <p>This is part of the c9 Manual. Copyright (C) 2016 |