Qemu-simple: Difference between revisions
 (Qemu simple walk-through)  | 
				m (update section test bed)  | 
				||
| Line 14: | Line 14: | ||
* Describe here the test bed/setup used to run the scripts below.  | * Describe here the test bed/setup used to run the scripts below.  | ||
# MODEL: Dell Laptop.  | # MODEL: Dell Laptop.  | ||
# CPU: Intel i5   | # CPU: Intel i5 3rd/4th generation with virtualization enabled.  | ||
# RAM: 8GB  | # RAM: 8GB  | ||
Revision as of 15:30, 25 August 2025
Setup walkthrough
Basic setup that gets you going, you would still need to read main Qemu documentations for advanced features.
Objective
- Install Alpinelinux.
 - Install Qemu and its dependencies.
 - Download Alpinelinux ISO and required files.
 - Start a Qemu instance of Alpinelinux ISO.
 - Test basic networking.
 
Test bed
WIP
- Describe here the test bed/setup used to run the scripts below.
 
- MODEL: Dell Laptop.
 - CPU: Intel i5 3rd/4th generation with virtualization enabled.
 - RAM: 8GB
 
Install Alpinelinux
- Diskless installs (Ram based)
 - SYS installs
 
 Tip:  - for further setup to work correctly, its assumed that alpinelinux installed in done for version between v3.21.x and v3.22.x
v3.21.x-v3.22.x
Install Qemu and its dependencies
# apk add qemu qemu-img qemu-system-x86_64 qemu-ui-gtk
# modprobe tun
v3.21.x-v3.22.x
Download Alpinelinux ISO and required files
# cd ~ # wget https://cdn.alpinelinux.org/v3.22/releases/x86_64/alpine-extended-3.22.0-x86_64.iso
Start a Qemu instance of Alpinelinux ISO
- Basic setup (with ssh forwarding)
 - Basic tap setup
 
v3.21.x-v3.22.x
Basic setup (with ssh forwarding)
#!/bin/sh
## -------------------------------------------------
## Simple setup (manually)
##  no root privileges needed
## QEMU emulator version 10.0.0 (alpinelinux) ####
## -------------------------------------------------
ISO=alpine-extended-3.22.0-x86_64.iso
qemu-system-x86_64 -enable-kvm -m 2048M -cdrom ${ISO} \
    -device virtio-net,netdev=net0 \
    -netdev user,id=net0,hostfwd=tcp::5555-:22 \
    -nographic -display curses \
    -boot d
## ----
## on GUEST
# ifconfig eth0 10.0.2.15
# route add default gw 10.0.2.2
# busybox ping alpinelinux.org
## -------------------------------------------------
v3.21.x-v3.22.x
Basic tap setup
#!/bin/sh
## -------------------------------------------------
## Manual setup with defaults and no preset scripts
## Works in root
## QEMU emulator version 10.0.0+ (alpinelinux) ####
## modprobe tun # needed if not loaded already
## -------------------------------------------------
ISO=alpine-extended-3.22.0-x86_64.iso
qemu-system-x86_64 -enable-kvm -m 2048M -cdrom ${ISO} \
    -device virtio-net,netdev=nd0 \
    -netdev tap,id=nd0,ifname=tap0,script=no,downscript=no \
    -nographic -display curses \
    -boot d
## ----
## on HOST
# ifconfig tap0 10.0.2.2
## on GUEST
# ifconfig eth0 10.0.2.15
# route add default gw 10.0.2.2
## ----
## TEST (HOST) - IMPORTANT: remove firewall if any
# nc -l 1234 > filename.out
## TEST (GUEST)
# echo -e "aaa\nbbb" > test.txt
# nc 10.0.2.2 1234 < test.txt
## TEST (HOST)
# cat filename.out
## -------------------------------------------------
