SSH access to Linux in Linux virtual machine

Source: Internet
Author: User
Tags ssh access

Typically install a Linux system within the virtual machine, the virtual machine network is set to bridge, the Linux system will automatically set its DHCP configuration during the installation, it will randomly assign an IP, this IP can be viewed with the command "Ifconfig". Of course, this command needs to be used under root privileges, or the normal user has sudo permissions.

If you do not choose to install the desktop when installing the Linux system, you will enter the pure instruction terminal interface without any surprises.

The Linux Native Terminal window has several drawbacks:

1, long and wide fixed, you can not see more content in one interface;

2, unable to uplink, other windows can go up and down through the arrow keys to view the content, but the original window is fixed dead, you can not look at the front content, if the content displayed more than a page length, you can only see the last page of content, the problem is the most pit.

3, the Linux kernel is no Chinese font, if the original window to view Chinese, it is likely that some garbled.

Therefore, it is important to replace the native window with another window.

Think of here, SSH remote login.

Using SSH to log in to the remote host to operate the benefits are endless, the most important thing is to use a variety of Windows to operate the Linux system. We can copy, paste and even drag. So, using SSH to telnet to the operations master has become the first thing to do when working.

If SSH login, we just know the host's external IP and port, and the host on the installation started SSH service, you can ssh to telnet. There is a lot of information in this area, so there is not much to say.

But here's the case: what if you need to access one of several virtual hosts within a remote server?

There are two ways to do this:

1, know the remote server IP, through the port mapping, as the external network access to the local area network host, through the server ip+ map port to remote access;

2, through the internal IP to access.

Here's a second approach. Of course, if you need to be able to telnet to a machine within the server.

Let's imagine a situation where we can log in to the server, but the Linux system inside the new virtual machine inside the server is inaccessible because it does not know the network IP. Nor can we visit him by setting up port mappings. You can do this at this time:

1, set its network connection for the bridge mode;

2. The IP of the Linux system is in the same network segment as the IP of other hosts in the server and can ping. For example: 192.168.1.3 and 192.168.1.14 in the same network segment, and 192.168.0.8 and 192.168.4.5 is not a network segment, so also can not ping pass. If the two are no longer the same network segment, you can manually set the static IP to set it to the same network segment as the server host.

3. SSH service is turned on in Linux system.

4, the normal connection to the outside network, the general 3rd reached the conditions, you can also connect the outside network.

5, the first through the SSH connection to the server can telnet to the host, and then within the host again SSH into the target virtual machine, two times to log on to the virtual machine. This avoids the need to know the network IP and port of the system inside the virtual machine to remotely access the virtual machine.

Of course, the most correct method is the first method, port-mapped access. But the second approach can also meet the needs of certain situations. Picking!

SSH access to Linux in Linux virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.