Virutalbox Virtual Machine accessing the Internet in Nat Mode

Source: Internet
Author: User
Tags ftp protocol

Problem description:

Centos is installed in virutalbox. The physical host does not use a vswitch or a vro.

 

Requirements:

In Windows, you can use SSH to connect to a virtual machine and access the Web Services Provided by the virtual machine.

 

Preface:

In general, in windows, the network settings of Linux virtual machines virtualized by virutalbox should be bridging, so that virtual machines and physical machines can coexist.

In the same Lan, you can ping each other, but the premise is that the physical machine uses a switch or router. If these devices are not used, the two systems cannot simply Ping each other.

 

Solution:

Set port forwarding rules in Nat mode in virtualbox

1. Open virtualbox, right-click the Linux virtual machine, and select Settings. On the device panel, select the network type, SET network interface card 1 to Network Address Translation Nat, and click Advanced to display advanced settings, as shown in:

2. Click the port forwarding button to open the port forwarding rule list. You can add or delete rules.

Some Terms in the Rules are described as follows:

HOST: Physical host system

Subsystem: virtualbox virtualized System

Host port: the port of the physical host system. This port is forwarded to the subsystem port.

Subsystem port: the port of the Virtual Machine Subsystem

The following uses adding an SSH connection rule as an example:

Click the green plus sign on the right to add a rule to the rule list. Change the name to ssh ). Select TCP as the Protocol. You do not need to enter the host IP address or subsystem IP address. Enter 2222 for the host port, or change it to another port, as long as it does not conflict with other ports, the physical host uses this port for SSH connection to the virtual machine. Fill in the subsystem port 22, because SSH connection uses port 22 by default, so this cannot be entered at will, for example, the most common HTTP protocol is port 80 by default, the default FTP protocol is port 21. After entering the information, click OK to save the settings.

Open the Linux virtual machine, install and enable the SSH service, and disable the firewall. In Windows, you can use putty or securecrt to connect to a Linux Virtual Machine. Enter localhost or 127.0.0.1 as the SSH address, and enter the host port in the port forwarding rule set in virtualbox, in the preceding example, 2222 is used. If the connection fails, check whether the Linux virtual machine has been installed and enabled for the SSH service, and disable the firewall.

Related Article

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.