VirtualBox Installing CentOS Networking issues

Source: Internet
Author: User

Recently playing Hadoop requires several virtual institutions into a cluster, on the VirtualBox installed CentOS, networking problems arose, specifically, two:

  1. Connectivity between the host and the virtual machine
  2. The problem of Internet access for virtual machines

Turn over a lot of blog, finally solved the problem

Environment Introduction

My host is Ubuntu14.04,virtualbox version is 4.3.28, the virtual machine installed is CentOS 6.3
External environment is the campus network, through PPPoE dial-up Internet
To achieve two goals:

  1. Host and virtual machines can connect to each other (e.g. SSH login)
  2. Virtual machine with Internet access, easy to install software and upgrade
Principle

Virtual piece of network card, this NIC and host is Host-only, this solves the problem 1 ;
The virtual machine is set up as the DHCP way to get the IP address, so as long as the host can access the Internet, virtual machine can also surf the internet, solve the problem 2 ;

Specific steps

步骤1

First, open the 管理 –> 全局设定 –> 网络 –> 仅host-only网络 :

Click New, you can see the creation of a new network card vboxnet0 , right click to edit, as follows:

The default address is:
192.168.56.1, I will not be ready to change, I need to manually edit it

After clicking Confirm, go back to our own host Ubuntu and enter ifconfig :

We specify the virtual network card is added, the address is the default192.168.56.1

步骤2

The virtual machine 设置 is:

Eth0:nat Way
Eth1:host-only

Specific as follows:

步骤3

Start the virtual machine, then edit a few files.

(1)/etc/udev/rules.d/70-persistent-net.rules

Here we have to look at the address of the virtual network card MAC , the MAC address is wrong to start up

Red Place is the MAC address, you and my affirmation is not the same do not copy my ha, we will write it down later use:

(2)/etc/sysconfig/network-scripts/ifcfg-eth0

This file is the eth0 first network card configuration file, here we need to change a few places, such as the red display:

(3)/etc/sysconfig/network-scripts/ifcfg-eth1

Don't worry, there is no such file on your machine, just copy one ifcfg-eth0 :

Cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth1

This is the eth1 configuration file for the virtual NIC:
You need to set the corresponding IP address (with the host unicom) and netmask (subnet mask) and gateway (gateway), and finally a bit of change MAC of address, remember before you remember the address???? Yes, that's it, just write it.

I set the address is 192.168.56.3 , the address must be set with you subnet (the default is 192.168.56.1) in a network segment, you look at the set bar, other see I marked red place, do not have to change, of course, your MAC address and I are not the same ha

Step 4

Restart the entire network:

/etc/init.d/network restart

OK,

If you can surf the Internet under test:
Just try to install a openssh-clients software.

Yum Install openssh-clients

No problem

The test can not be able to connect the host (SSH mode):

SSH [email protected]

Successful landing

At this point our virtual machine address is:

eth0:10.0.2.15
eth1:182.168.56.3

VirtualBox Installing CentOS Networking issues

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.