How to connect Xshell5 to Linux in a virtual machine and how to solve the failure

How to connect Xshell5 to Linux in a virtual machine and how to solve the failure

I installed a virtual machine a long time ago, and now I have finally installed Linux. Although the machine's configuration is pretty good and the virtual machine is generally not particularly stuck, switching back and forth can sometimes be a real headache. Although it is not stuck, the CPU usage is still very high. It also consumes a lot of power. So since I heard about the magical tool Xshell, I started to study it. (Please scroll down if you have any questions.)

First of all, Xshell is an application that connects two hosts in the same network segment. Simply put, it is an application that can use one machine to control multiple computers. Note that it is the same network segment. This concept is very important and we will definitely use it when configuring Xshell. This application allows us to operate the system terminals of other computers in one interface. A virtual machine is equivalent to a computer, so of course it can also be connected.

First you need to download Xshell5. You can find it on Baidu. A key will be asked for during installation, but you don't need one if you choose home or school use. After trying it, I found this is the correct option. Then we turn on our virtual machine. Enter the system's terminal. Enter the command line command ifconfig and we can clearly see our network settings.

Here we can clearly see our IP address. Friends who are not connected to the Internet or cannot connect will not be able to see the IP address here, because some are random and some are not set at all. We will discuss this later in our analysis.

Then we need to open the network settings of the virtual machine to check the set IP address. There is a virtual network editor in the edit column of the virtual machine. Let's click it to open it.

Here we are using a NAT connection. We need to make sure that the IP address we see is similar to the IP address of the virtual machine just now, but it does not need to be exactly the same. If it is the same, an error will be reported because the IP address will be repeated. However, the first three digits need to be the same and the last digit can be set at will, so as to ensure that they are in the same network segment as mentioned earlier. Next we need to open the Network and Sharing Center, which can be opened from the lower right corner. Click Change adapter settings on the right. We should be able to see two extra network cards.

The one on the left is 1 and the one on the right is 2. Then right click and open properties. Then protocol version 4. Under normal circumstances, it is not set. At this time, we need to set it ourselves, but remember that the IP address in the same network segment cannot be repeated. For example, I set it to 192.168.1.X above. This completes our local setup. Next, we open the Xshell we installed and click the file session in the upper right corner. The following window will appear


Fill in the IP address of your virtual machine on the host. (Important things should be said three times). Just click OK. If the connection is successful under normal circumstances, you will need to enter your Centos root name and login password. Just enter them to complete the connection.

The operations performed here are no different from operating the terminal in CentOS.

-------------------------------This is the dividing line of funny things-----------------------------------------

This is the simplest connection method I have ever seen on the Internet. Maybe if you still want me to do it I won’t make it = =! After all, I'm just a newbie. Next I will write down a few places where failures occurred. If any newbies are "lucky" enough to read this, I wish you good luck.

The first is the problem of the IP address of the virtual machine. Some friends found that they could not connect after loading the system. It might be because the network card was not turned on (fog). Anyway, after entering ifconfig, there was no IP address where I drew a red line. It was very embarrassing to see that there was no IP address at all. You must be unable to connect to the Internet at this time. The first thing we need to do is set the IP. In the terminal of the virtual machine, enter setup. If you are logging in for the first time, it may require you to enter a password. No problem, just enter your login password directly. (At the same time, here is a problem, but everyone does not change the password so there is no difference. In fact, the login password and the root password are different.) At this time, the graphical interface will become as shown below

The mouse cannot be used here. You need to use the keyboard to move to the network configuration and press Enter. Select the second device configuration and press Enter. Select the first device and press Enter. The following interface will appear

Because I have set this up, there will be an IP address. If you haven’t set it up, move the cursor to use DHCP and press the space bar. What existed previously* will disappear. Then you can enter the IP address below and the subnet mask as well. Just enter it like I did. Then just confirm all the way back and remember to press Enter. . . . (I would like to mention here that we can actually check the IP address of the virtual machine first and then set the IP address of centos according to that network segment, which seems to be more convenient), leave other settings unchanged and then try it on Xshell.

Here are some simple instructions, but please note that these are immediate, meaning they will become invalid if you restart the virtual machine. This is because some IP addresses are random.

Enter the following command and you may be prompted that you do not have sufficient permissions. In this case, enter su root in the terminal and you will be prompted to enter your password.

The password you enter in Linux will not be displayed. That is, you have clearly entered it, but it will not be displayed. You can just press Enter to show that it has actually been entered.

Modify IP address <br /> Effective immediately:
# ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Start to take effect:
Modify /etc/sysconfig/network-scripts/ifcfg-eth0

Modify the Default Gateway
Effective immediately:
# route add default gw 192.168.0.1 dev eth0
Start to take effect:
Modify /etc/sysconfig/network

Modify DNS
Modify /etc/resolv.conf
The modification will take effect immediately and the startup will also be effective

Modify the host name
Effective immediately:
# hostname centos1
Start to take effect:
Modify /etc/sysconfig/network

Modify the network card configuration

#vi /etc/udev/rules.d/70-persistent-net.rules

After modifying the network settings, you must restart
# service network restart
or
# /etc/init.d/network restart

If you still can't connect at this time, you can try to open port 20 because when we set up Xshell, the default port is 22 (although this port is open most of the time)

/etc/init.d/sshd start

If it still doesn't work, maybe the firewall is not turned off. We can only turn it off decisively.

1) Enable after reboot: chkconfig iptables on
To turn off: chkconfig iptables off

2) Take effect immediately and become invalid after reboot service iptables start
Shutdown: service iptables stop

Well, that’s about it. . . If you still can't connect, please leave a message and I'll check it out in time, although I may not be able to explain it. . . . .

This concludes this article about how to connect Xshell5 to Linux in a virtual machine and how to solve the cause of failure. For more relevant content about connecting Xshell5 to Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you 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)
  • Solution to the problem that Xshell cannot connect to the virtualBox virtual machine
  • Use xshell to implement proxy function and test it with navicat for MySQL

<<:  Vue echarts realizes dynamic display of bar chart

>>:  Detailed explanation of MySql view trigger stored procedure

Recommend

Detailed explanation of the use of title tags and paragraph tags in XHTML

XHTML Headings Overview When we write Word docume...

A brief discussion on the differences between FTP, FTPS and SFTP

Table of contents Introduction to FTP, FTPS and S...

Pitfalls and solutions for upgrading MySQL 5.7.23 in CentOS 7

Preface Recently, I found a pitfall in upgrading ...

Mysql 8.0 installation and password reset issues

Mysql 8.0 installation problems and password rese...

Pure CSS to change the color of the picture

The css technique for changing the color of an im...

Detailed explanation of CSS margin overlap and solution exploration

I recently reviewed some CSS-related knowledge po...

HTML discount price calculation implementation principle and script code

Copy code The code is as follows: <!DOCTYPE HT...

Analysis of the solution to Nginx Session sharing problem

This article mainly introduces the solution to th...

Teach you how to build the vue3.0 project architecture step by step

Table of contents Preface: 1. Create a project wi...

Examples of new selectors in CSS3

Structural (position) pseudo-class selector (CSS3...

10 excellent Web UI libraries/frameworks

1. IT Mill Toolkit IT Mill Toolkit is an open sou...

MySQL 8.0.18 installation and configuration method graphic tutorial (linux)

This article records the installation and configu...

Understanding of web design layout

<br />A contradiction arises. In small works...