VirtualBox CentOS System Configuration Nat+host only Internet (Zhuan)

Source: Internet
Author: User

Http://www.cnblogs.com/leezhxing/p/4482659.html

**********************************************************

Previously used is the VirtualBox bridge mode, the characteristics of bridge mode :

The virtual machine and the host are in the same position, like a real host in the local area network, can be assigned to a network of independent IP.

You can exchange visits between virtual machines and host hosts.

If the network is disconnected, the host will not be able to access the virtual machine even if the virtual machine and host are actually on a single physical machine.

Configuration view: http://www.cnblogs.com/leezhxing/p/3703420.html

Now instead of the nat+host only way is mainly the company's security department did too good, no authorized host can not access the network, because the bridge mode is equivalent to virtual a real machine, so no.

NAT ensures virtual machine networking, and host only ensures that virtual machines and host hosts can exchange visits.

Describe the features of NAT and host only:

Nat Mode:

The virtual system uses the NAT (network address translation) function to access the public network through the network where the host machine resides. In other words, the use of NAT mode enables access to the Internet in virtual systems.

The TCP/IP configuration information for a virtual system in NAT mode is provided by the DHCP server of the (NAT) virtual network and cannot be modified manually, so the virtual system cannot communicate with other real hosts on the local area network .

The biggest advantage of using NAT mode is that virtual system access to the Internet is very simple, you do not need to do any other configuration, only the host machine can access the Internet.

Host-only mode:

VirtualBox in the host to simulate a virtual machine for the use of a network card, all virtual machines are connected to the network card, the virtual machine can access the host through the network card IP, while VirtualBox provides a DHCP service, the virtual machine can obtain an internal network IP, The host can access the virtual machine through that IP. If you use Host-only mode purely, the virtual machine cannot connect to an external public network.

Here's how to configure it:

1. I downloaded the web version of CentOS [Centos-6.5-x86_64-netinstall.iso], so when installing the system requires networking, first configure a NAT network card to ensure that the installation can proceed normally.

As long as the connection mode to NAT on the line, the other do not change, as long as the host can access the Internet OK.

2. After the installation of the system, set up a good environment, generally in the virtual machine configuration of several domain names, you need to change the physical machine host access. However, the physical machine in NAT mode can not find the existence of virtual machine, need to add a host only network card to achieve mutual visits.

Add Network card 2, modify the connection method and interface name, usually after VirtualBox loaded, will generate a host only network card, corresponding to the name above. The general address is: 192.168.56.1, here we choose the default can. Want to add or modify under admin-Global settings-network.

The NIC is added to boot the virtual machine and needs to be configured for NIC 2 eth1

Copy eth0: cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth1

Edit eth1: Just modify Device,hwaddr[mac address]. Hwaddr can be viewed in. Attached to the previous mine.

Device="Eth1"bootproto="Dhcp"Hwaddr="08:00:27:0f:74:c9"ipv6init= "yes "ipv6_autoconf=" yes "nm_controlled= "yes" onboot= "yes" type= "uuid=" aa9bae56-17a6-4eea-9f8b-712d66166cea "    

Restart the network card: Service Network restart

The virtual machine will be assigned a 192.168.56 network segment of the IP, through the physical machine to connect the IP is OK.

The two steps above will be able to surf the internet and exchange visits.

Summarize:

1. In the case of Nat only, you can also set up port forwarding rules to enable physical machine access to the virtual machine.

Click the port forwarding settings rule:

At this point, the equivalent of the virtual machine 22 port mapping to the local 12100 port, the local Xshell can connect the host's 12100 port to operate the virtual machine.

The network card generated by 2.virtualbox is host only, and no network access rights are normal.

VirtualBox CentOS System Configuration Nat+host only Internet (Zhuan)

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.