Portál AbcLinuxu, 8. května 2025 00:49
qemu-system-x86_64 -enable-kvm -m 1G -smp 2 -nographic -serial none -monitor none -hda alpine.qcow2 -netdev user,id=net0,hostfwd=tcp::10022-:22 -device e1000,netdev=net0 > /dev/null 2>&1 &
Tj. kvm, 1G RAM, 2 jádra, bez grafického výstupu, bez konzole, jeden disk, NAT a TCP port 22 (ssh) uvnitř přesměrován na 10022 venku. Část " > /dev/null 2>&1 &" je spustit "na pozadí" v neblokujícím režimu. Nicméně s tím bude víc starostí než užitku.
This is the default networking backend and generally is the easiest to use. It does not require root / Administrator privileges. It has the following limitations: ... * the guest is not directly accessible from the host or the external networkhttps://wiki.qemu.org/Documentation/Networking#Network_HOWTOs
How to get SSH access to a guest A simplest way is to forward a specific host port to guest port 22. It can be done via: -device e1000,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22 The first line creates a virtual e1000 network device, while the second line created one user typed backend, forwarding local port 5555 to guest port 22. Then we can do: ssh localhost -p 5555 to have SSH access to guest after its network setup (don't forget to turn off firewalls if there is any in the guest or host).
qemu-system-x86_64 -enable-kvm -m 1G -smp 2 -nographic -serial stdio -monitor none -hda alpine.qcow2 -netdev user,id=net0,hostfwd=tcp::10022-:22 -device e1000,netdev=net0
Tím pádem by jsi měl vidět normálně v konzoli vstup/výstup, přihlásit a debugovat. Síť máš nastavenou jak? Pokud je zaplé DHCP, tak by si to mělo vše nastavit samo na 10.0.2.15/24, GW 10.0.2.2 a DNS 10.0.2.3 viz dokumentace. Pak by ti měl fungovat ping na bránu. Ping ven nefunguje viz dokumentace. Můžeš zkusit třeba apk udpate
zda internet funguje. Pokud všechno jede a máš nainstalovaný a běžící SSH server, tak by z venku mělo jít ssh user@localhost -p 10022
.
nechceš "klikačku" .. https://cockpit-project.org/ ?
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.