mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Enable arbitrary port forwarding via config file (#40)
* Add the possibility to forward ports from host to guest * Reorganized code, fixed a bug, updated the README * Updated the README * Forgot to remove 'exit' ....
This commit is contained in:
parent
76670511dd
commit
63f5c11a8e
2 changed files with 23 additions and 0 deletions
12
README.md
12
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
|
||||
|
|
11
quickemu
11
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
|
||||
|
|
Loading…
Reference in a new issue