Enable the Virtual Machine Centos to access the Internet

Source: Internet
Author: User

Enable the Virtual Machine Centos to access the Internet
Download Centos Image & VirtualBox

In Baidu searched for a "Centos China image" (http://centos.ustc.edu.cn/) site. Looks good. The latest version is 6.0.

  • Find the minimum installation package for a 32-bit system download: CentOS-6.0-i386-minimal.iso
  • 64-bit isX86_6.
  • I found a multi-language version of VirtualBox:VirtualBox(Virtual Machine) 4.1.2 multi-language edition
Installation Process

For example. After VBox is installed, the centos automatically selects the Red Hat version. The other options are the next step by default. It is basically not difficult to modify.

Next,

  • I use the UltraISO software to install a virtual optical drive (the same is true for reading from the optical drive directly ).
  • Mount the downloaded CentOS-6.0-i386-minimal.iso to the Virtual Drive
  • Start Centos created in VBox. When you start Centos for the first time, you will be asked to select the installed optical drive and select one. (If you want to modify it later, click Settings/IDE controller in VBox to modify or delete it)
  • Install Centos (not detailed or difficult)

At this point, there should be no difficulty. Smooth all the way.

Enable the Virtual Machine Centos to access the Internet

Next, let the Virtual Machine Centos be able to access the Internet. It took a long time to split. Summarize the experience here. I chose the NAT network connection method.

According to my understanding, the advantage of the NAT network connection mode is that it is convenient to configure. You do not need to manually set the IP address or so on, just get it automatically. Virtual machines can access the network. The Virtual Machine and the Host machine can also access each other. However, external websites cannot access virtual machines (disadvantages ). But it doesn't matter. It is a virtual machine used for practice. There is no need for external access.

After CentOS is installed, go to the system. The network is not enabled yet. Use the following command to enable the network.

Ifconfig eth0 up # enable NIC (ifconfig eth0 down) ping g.cn # Or ping www.baidu.com

Ifconfig eth0 up should be able to access the Internet normally. Ping the Internet to test. You can ping it. The next step is to automatically connect to the website each time Centos is started. The following is a reference:

vi /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE="eth0"HWADDR="08:00:27:BE:80:A6"NM_CONTROLLED="yes"ONBOOT="yes"BOOTPROTO="dhcp"

BOOTPROTO: Set the way for the NIC to obtain the IP address. The possible options are static, dhcp or bootp, which respectively correspond to the IP address specified by the static state, the IP address obtained through the dhcp protocol, and the IP address obtained through the bootp protocol.

Reboot # restart

You can also access the Internet after restarting.

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.