Location>code7788 >text

Unable to connect remotely after qumu VM startup

Popularity:306 ℃/2024-09-11 19:48:26

After starting the qemu VM via virsh, you can access the VM via VNC, but you cannot log in via the external mapped port of the set SSH. First view the VM on the host (csv\)tpm\name) of the network configuration, you can see the port mapping and the network segment of the current network (10.0.10.0/24).

$ virsh edit csv_tpm_name

Include in the configuration the VNC port (5995) for accessing the virtual machine, through which you can set up access to the virtual machine using the vncviewer software.

Use VNC to log in to the VM through port 5995, and further use theifconfigcommand to check the internal NIC configuration of the virtual machine, and found that there are two NICs, ens4 and ens5. The ens4 card is bound to the 192.168.122.21 address and the ens5 card is bound to the 10.0.10.15 address. According to the virtual machine configuration on the host, we know that the 10.0. segment is the internal segment of the virtual machine, so normally the gateway of the virtual machine should be the ens5 card bound to the 10.0.10.15 address. The gateway should be an address within the 10.0.10.0/24 segment, usually one of the first few IP addresses, which can be passed one by one.pingcommand. Here I tried 10.0.10.2 and it pinged through, so I can probably assume that IP address is the gateway address.

Continuing to check the current routing table, you find that the default gateway set in the routing table goes to ens4, but according to the above judgment, the correct gateway should be bound to the ens5 NIC, so you can determine the problem.

The corresponding solution is to modify the routing table and redirect the default gateway. Here, the current default 'default' route is deleted first, and then thedhclientcommand generates a new default routing table directly through the specified NIC.

$ route del default
$ dhclient ens5

After the above, you can access the virtual machine via SSH normally.