diff --git a/README.md b/README.md index f6e381f..73dd4fb 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ guest_os="linux" iso="/media/$USER/Quickemu/ubuntu/focal-desktop-amd64.iso" disk_img="/media/$USER/Quickemu/ubuntu/focal-desktop-amd64.qcow2" disk=128G +port_forwards=("8123:8123" "8888:80") usb_devices=("046d:082d" "046d:085e") ``` @@ -84,6 +85,9 @@ Starting /media/martin/Quickemu/ubuntu-focal-desktop.conf - Display: SDL - smbd: /home/martin will be exported to the guest via smb://10.0.2.4/qemu - ssh: 22221/tcp is connected. Login via 'ssh user@localhost -p 22221' + - PORTS: Port forwards requested: + - 8123 => 8123 + - 8888 => 80 - USB: Device pass-through requested: - Logitech, Inc. HD Pro Webcam C920 - Logitech, Inc. Logitech BRIO @@ -114,6 +118,7 @@ iso="/media/$USER/Quickemu/windows10/Win10_1909_English_x64.iso" driver_iso="/media/$USER/Quickemu/windows10/virtio-win-0.1.173.iso" disk_img="/media/$USER/Quickemu/windows10/windows10.qcow2" disk=128G +port_forwards=("8123:8123" "8888:80") usb_devices=("046d:082d" "046d:085e") ``` @@ -143,6 +148,9 @@ Starting /media/martin/Quickemu/windows10.conf - Display: SDL - smbd: /home/martin will be exported to the guest via smb://10.0.2.4/qemu - ssh: 22221/tcp is connected. Login via 'ssh user@localhost -p 22221' + - PORTS: Port forwards requested: + - 8123 => 8123 + - 8888 => 80 - USB: Device pass-through requested: - Logitech, Inc. HD Pro Webcam C920 - Logitech, Inc. Logitech BRIO @@ -199,6 +207,7 @@ guest_os="macos" img="/media/$USER/Quickemu/macos/BaseSystem.img" disk_img="/media/$USER/Quickemu/macos/macos.qcow2" disk=128G +port_forwards=("8123:8123" "8888:80") usb_devices=("046d:082d" "046d:085e") ``` @@ -226,6 +235,9 @@ Starting macos.conf - Display: SDL - smbd: /home/martin will be exported to the guest via smb://10.0.2.4/qemu - ssh: 22223/tcp is connected. Login via 'ssh user@localhost -p 22223' + - PORTS: Port forwards requested: + - 8123 => 8123 + - 8888 => 80 ``` * Boot from the BaseSystem diff --git a/quickemu b/quickemu index f81fc6d..646ea1e 100755 --- a/quickemu +++ b/quickemu @@ -370,6 +370,17 @@ function vm_boot() { echo " - ssh: All ports for exposing ssh have been exhausted." fi + # Have any port forwards been requested? + if (( ${#port_forwards[@]} )); then + echo " - PORTS: Port forwards requested:" + for FORWARD in "${port_forwards[@]}"; do + HOST_PORT=$(echo ${FORWARD} | cut -d':' -f1) + GUEST_PORT=$(echo ${FORWARD} | cut -d':' -f2) + echo " - ${HOST_PORT} => ${GUEST_PORT}" + NET="${NET},hostfwd=tcp::${HOST_PORT}-:${GUEST_PORT}" + done + fi + # Find a free port for spice local SPICE_PORT=$(get_port 5930 9) if [ ! -n "${SPICE_PORT}" ]; then