VMware NAT Port mapping extranet access to virtual machine Linux

Source: Internet
Author: User
Tags administrator password ssh port

Purpose of this article:

An. SSH connection

Two. Access HTTP

  

VMware Workstation provides two ways to access virtual machines, one bridge, one Nat,bridge to get a public address, and NAT to be an intranet address.

NAT is equivalent to using a host as a NAT translator, and we can add port mappings so that the extranet can access virtual machines that use NAT to surf the web.

Host Environment: Win7

Public network ip:128.206.82.47

Virtual machine version: VMware Workstation 10

Virtual machine system: CentOS 6.5

Virtual Machine ip:192.168.111.129

Current situation: After the native installation of the virtual machine system, through the virtual machine IP can be used in the local Win7 SSH connection, but the external network cannot connect the virtual machine via SSH.

An. SSH connection

1. First turn off the firewall

1 /etc/init.d/iptables stop

Open the VMware Network Editor to find the network card used by this virtual machine. Select a network card with type NAT (VMNET8)

 

2. Click Nat setting ...

3. Click Add (You can see the ports I have added)

Host Port: Which port of the local Win7 do you plan to use as a listening port

Virtual Machine IP Address: Your Linux IP is not much, you fill in how much

Virtual machine port: Which port do you plan to map to VM Linux with listening port, 22 not SSH port, 80 not HTTP port

4. Close the local Win7 firewall

As we have previously shut down the virtual machine Linux firewall, but did not turn off the local Win7 corresponding listening port firewall, so you have to set up a Win7 firewall.

If Windows Firewall blocks a program and you want to allow the program to communicate through a firewall, you can usually do so by selecting it in the list of programs allowed by Windows Firewall (also known as the "exception list"). To learn how to do this.

However, if the program is not listed, you may need to open a port. For example, when you are online with a friend for multiplayer games, you may need to open a port for the game so that the firewall can allow the game information to reach your computer. The port remains open, so be sure to close the ports that you do not need to open.

    1. Open Windows Firewall by clicking the Start button, and then clicking Control Panel. In the search box, type firewall, and then click Windows Firewall.

    2. In the left pane, click Advanced Settings. If you are prompted for an administrator password or for confirmation, type the password, or provide confirmation.

    3. In the Windows Firewall with Advanced Security dialog box, in the left pane, click Inbound Rules, and then in the right pane, click New Rule.

    4. Follow the instructions in the New Inbound Rule wizard.

5. Connection test

Because we are the Linux that is connected to the virtual machine through the way of mapping,

So host name is the IP address of the native Win7, Port is Win7 just set the listening port 5022, user name is your own Linux user name.

And then you're done.

Two. Connect the HTTP

1. Install HTTP

1 yum install httpd

Start the HTTP service

1 /etc/init.d/httpd start

Finish this step on the virtual machine Linux open the browser input 127.0.0.1 or local Win7 Enter the virtual machine Linux IP address 192.168.111.129

You can see the effect of HTTP, but the extranet is not able to access the Web page because you want to set up port mappings.

2. Setting up port Mappings

Not much to say, look at the above SSH connection 1, 2, 3, 4 step method to set the port mapping is good, as long as the mapping port to 80 on the line, pay attention to do not engage in conflict monitoring port.

3. Access Testing

The remote machine is accessed using the local Win7 IP address, plus the listening port, in the format http://Win7 ip:port

Win7 ip:128.206.82.47

port:5080

So my test was http://128.206.82.47:5080/.

The problems I have encountered:

1. Set the listening port is not sure why I set to 10022 or 10080 virtual machine Linux will not be able to surf the internet immediately.

2. The local Win7 firewall has not been closed before, so it has not been connected to SSH

Some suggestions:

1. Before setting up the extranet to connect virtual machine Linux, make sure that the extranet can ping the IP with the local Win7. (Can be nonsense)

2. It is not certain that the virtual machine Linux IP will change dynamically after the next reboot, so it is good to set up a static IP for the virtual machine Linux.

VMware NAT Port mapping extranet access to virtual machine Linux

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.