diff options
Diffstat (limited to 'tools/qemu.html')
-rw-r--r-- | tools/qemu.html | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/tools/qemu.html b/tools/qemu.html index ce1b66d..8c53ce7 100644 --- a/tools/qemu.html +++ b/tools/qemu.html @@ -97,45 +97,53 @@ <dd>The VDE networking backend.</dd> </dl> - - <h3>2.1. Tap interfaces</h3> - <pre> KERNEL=="tun", GROUP="kvm", MODE="0660", OPTIONS+="static_node=net/tun" </pre> - <p>Automatic creation of tap interface with - correct permissions set for user and group, - you can set only user or group;</p> - <pre> - # tunctl -u username -g kvm -t tap0 - </pre> + <h3>2.1. Public Bridge</h3> - <p>Set permissions to existing tap interface;</p> + <p>Create <a href="network.html#bridge">bridge</a>, create new + tap and add it to bridge;</p> <pre> - # tunctl -u username -t tap0 + # DEV="br0" + # TAP="tap5" </pre> - - <p>Manual creation of tap interface;</p> + <pre> + # ip tuntap add ${TAP} mode tap group kvm + # ip link set ${TAP} up + </pre> <pre> - # ip tuntap add name tap0 mode tap - # chmod 0666 /dev/tap0 - # chown root:username /dev/tap0 + # ip link set ${TAP} master ${DEV} </pre> + <p>See <a href="scripts/system-qemu.sh">scripts/system-qemu.sh</a>, + as template. Run virtual machine that uses above tap device;</p> + <pre> - # ip addr add 10.0.2.1/24 dev tap0 - # ip link set dev tap0 up - # ip link show + $ ISO=~/crux-3.2.iso + $ IMG=~/crux-img.qcow2 + + $ qemu-system-x86_64 \ + -enable-kvm \ + -m 1024 \ + -boot d \ + -cdrom ${ISO} \ + -hda ${IMG} \ + -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no </pre> + <h3>2.2. Routing</h3> + + <p>Create interface with correct permissions set for kvm group.</p> + <pre> # sysctl -w net.ipv4.ip_forward=1 - # iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE + # iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE </pre> <h2 id="guest">Guest System</h2> @@ -143,22 +151,16 @@ <p>Start qemu with 512 of ram, mydisk.img as disk and boot from iso</p> <pre> - $ qemu-system-x86_64 \ - -enable-kvm \ - -m 512 \ - -boot d -cdrom image.iso \ - -hda mydisk.img - </pre> + $ ISO=~/crux-3.2.iso + $ IMG=~/crux-img.qcow2 - <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 + -enable-kvm \ + -m 1024 \ + -boot d \ + -cdrom ${ISO} \ + -hda ${IMG} \ + -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no </pre> <a href="index.html">Tools Index</a> |