Solution to the problem that Xshell cannot connect to the virtualBox virtual machine

Solution to the problem that Xshell cannot connect to the virtualBox virtual machine

First, let's explain the network setting mode of the virtualBox virtual machine: NAT+Host-Only mode

Selecting this mode can ensure that the virtual machine is connected to the external network, and the local computer is connected to the virtual machine.

Network 1: NAT mode

insert image description here

Network 2: Host-Only Mode

insert image description here

Enter the virtual machine and enter ifconfig to find that no IP is displayed:

insert image description here

But pinging Baidu is successful:

insert image description here

Therefore, it can be inferred that there is no problem with the NAT network, but there is a problem with Host-Only.

Normally, there should be information about two network cards, but currently there is only enp0s3, so we can reasonably infer that the Host-Only network card is not started.

Solution:

1. First, set enp0s3 to start automatically at boot

vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
Add ONBOOT="yes"

2. If there is no enp0s8, create enp0s8

cp enp0s3 enp0s8
vim enp0s8

The configuration is as follows:
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s8"
UUID="3ec9eebb-f9e1-4e4a-8ea7-ae6c4df8c795"
DEVICE="enp0s8"
ONBOOT="yes"
IPADDR="192.168.56.105"

Note: The copied UUID needs to be modified to distinguish it from the one in ifcfg-en0s3.

3. Restart the network

systemctl restart network

4. Check the IP address and you will have it

insert image description here

At this point, you can use Xshell on your local computer to connect to the virtual machine. You can also connect to the Internet by pinging http://www.baidu.com.

This is the end of this article about the solution to the problem that Xshell cannot connect to the virtualBox virtual machine. For more related content about the solution that Xshell cannot connect to virtualBox, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Use xshell to connect to the Linux server
  • Use Xshell to connect to the Linux virtual machine on VMware (graphic steps)
  • How to connect Xshell5 to Linux in a virtual machine and how to solve the failure
  • Use xshell to implement proxy function and test it with navicat for MySQL

<<:  Solution to large line spacing (5 pixels more in IE)

>>:  A brief discussion on the fun of :focus-within in CSS

Recommend

Nginx installation error solution

1. Unzip nginx-1.8.1.tar.gz 2. Unzip fastdfs-ngin...

How does Vue3's dynamic components work?

Table of contents 1. Component Registration 1.1 G...

Detailed explanation of Vue project optimization and packaging

Table of contents Preface 1. Routing lazy loading...

How to use type enhancement without typingscript

Preface Due to the weak typing of JS, loose writi...

MySQL 5.7.20 free installation version configuration method graphic tutorial

I have seen many relevant tutorials on the Intern...

Minimalistic website design examples

Web Application Class 1. DownForEveryoneOrJustMe ...

Detailed explanation of the integer data type tinyint in MySQL

Table of contents 1.1Tinyint Type Description 1.2...

How to install MySQL using yum on Centos7 and achieve remote connection

Centos7 uses yum to install MySQL and how to achi...

Two methods to disable form controls in HTML: readonly and disabled

In the process of making web pages, we often use f...

How to manually install MySQL 5.7 on CentOS 7.4

MySQL database is widely used, especially for JAV...

How to install redis5.0.3 in docker

1. Pull the official 5.0.3 image [root@localhost ...

Tutorial on building an FTP server in Ubuntu 16.04

Ubuntu 16.04 builds FTP server Install ftp Instal...