Sample Header Ad - 728x90

Issue with SSH Port Forwarding in GNOME Boxes Based on Previous Solution

0 votes
0 answers
240 views
I recently followed the steps outlined in [this answer](https://unix.stackexchange.com/a/649326/646494) to enable SSH port forwarding in GNOME Boxes. However, after applying the modifications, I encountered an issue when trying to SSH into the guest. Here's a detailed breakdown of what I did: **Steps I Followed:** 1. I edited the XML configuration of the VM using virsh edit boxes-unknown to modify the networking and add port forwarding for SSH. - I changed the root element of the domain XML to:
- I removed the existing `` section:
- Then, I added the following QEMU command to forward port 2222 on the host to port 22 on the guest:
2. After making these changes, I rebooted the guest using the following command:
virsh reboot boxes-unknown
3. I then attempted to SSH into the guest with:
ssh -vvv -p 2222 user@localhost
**Problem:** When trying to SSH, I receive the following output:
OpenSSH_9.2p1 Debian-2+deb12u3, OpenSSL 3.0.14 4 Jun 2024
debug1: Reading configuration data /home/xxx/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/xxx/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/xxx/.ssh/known_hosts2'
debug2: resolving "localhost" port 2222
debug3: resolve_host: lookup localhost:2222
debug3: ssh_connect_direct: entering
debug1: Connecting to localhost [::1] port 2222.
debug3: set_sock_tos: set socket 3 IPV6_TCLASS 0x10
debug1: connect to address ::1 port 2222: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type 0
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519 type -1
debug1: identity file /home/xxx/.ssh/id_ed25519-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_xmss type -1
debug1: identity file /home/xxx/.ssh/id_xmss-cert type -1
debug1: identity file /home/xxx/.ssh/id_dsa type -1
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u3
kex_exchange_identification: read: Connection reset by peer
Connection reset by 127.0.0.1 port 2222
The guest is no longer accessible through GNOME Boxes, and SSH fails with the "Connection reset by peer" error. **Additional Information:** - Port 2222 is not in use by any other service on the host (I verified this with sudo lsof -i:2222). - The guest's SSH service is running, and it's configured to listen on port 22. - I've reviewed the "Troubleshooting Log" under the "System" tab in the guest "Properties" in GNOME Boxes. Following is the last line on the log:
2024-09-16T08:56:02.478433Z qemu-system-x86_64: Slirp: Failed to send packet, ret: -1
**Question:** Has anyone encountered similar issues with SSH port forwarding in GNOME Boxes or using QEMU’s hostfwd option? Any advice on how to resolve this issue or recover access to the guest would be greatly appreciated. Thanks in advance for your help!
Asked by Ramdhan Hidayat (1 rep)
Sep 15, 2024, 04:09 AM
Last activity: Sep 16, 2024, 09:32 AM