Prerequisites
In the new company need to use MySQL, just the computer configuration can also be installed on the virtual machine to install Linux, then install MySQL, and make other hosts in the network can use the MySQL service, so we need to configure the VBox under the Linux network environment.
Preparation conditions:
- Install the VirtualBox.
- Install Linux, this installation is the CentOS 6.x
View the native network
The company network environment is not very clear, check the network card situation as follows, IP and DNS are automatically obtained:
Under cmd Check ipconfig, you can see the following network conditions:
At the same time after the installation completed VBox, VBox will give us a virtual network card, we can see the network card in Windows, the configuration of the network adapter we also installed Ethernet card configuration
Configure network for Linux
I installed CENTOC when I chose the mini version, and later found that the network is not configured, about the Linux network configuration of the article many recommended two
Beginner's article: http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/05/3000859.html
Advanced article: http://www.cnblogs.com/xiaoluo501395377/archive/2013/05/26/3100065.html
Here we choose to configure the method of automatic access, that is, DHCP mode, vi/etc/sysconfig/network-scripts/ifcfg-etch0, configuration content is as follows:
Device= "eth0"hwaddr= "XX:XX:XX:XX:XX:XX"onboot= "yes" // Start Network bootproto= "DHCP" // IP Get mode nm_controlled= "yes"ipv6init= "no"userctl= "no"
After modifying, press ESC to exit the edit state, enter: Wq represents write&quit, after the modification is completed, we need to restart the network, execute the following command:
/etc/rc.d/init.d/network restart
To complete the network configuration restart
You can use the Linux command ifconfig to check the network configuration at this time.
Configure virtual Machine network mode
Configure it by checking the virtual machine-to-network, select the appropriate network connection method, as follows:
one of the things to note is :
Here the network card 1, refers to VBox installed in Windows Virtual network card, that is, the network configuration of Windows See "VirtualBox host-only Ethernet Adapter".
Connection means, VBox the virtual network card and the real network card communication mode
The interface name, because this time uses the notebook, which has the wireless network card and the wired network card two choice, chooses the Windows to connect the network NIC.
1. Network address translation (NAT) mode
This mode features :
The operating system within the virtual machine can access the Internet through a host host (that is, a real PC)
The operating system within the virtual machine can access the host host
Host host cannot access virtual in-machine system
After using this method, the IP of Linux within the virtual machine is as follows:
Host host Windows IP is 10.10.0.98, test network condition:
Linux:
Ping www.baidu.com//test Linux for access to the Internet, with the result that you can ping the
Ping 10.10.0.98//tests whether Linux can access the host host, with the result that it can be ping-pass.
Note: You need to turn off Windows Firewall when you ping windows, or you will not be able to ping
Winsows:
Ping 10.0.2.15//test host host is able to access virtual machine Linux, resulting in
2. Bridge Connection mode
This mode features :
The operating system within the virtual machine can access the Internet through a host host (that is, a real PC)
The operating system within the virtual machine can access the host host
Host host can access virtual machine internal operating system
After using the bridging method, the LINUXIP inside the virtual machine is as follows:
As you can see, our eth0 NIC IP has changed after using the bridging method:
IP is automatically assigned as 10.10.0.115 and Windows 10.10.0.98 remain in the same segment
The subnet mask is the same, both 255.255.0.0
You can test windows and Linux yourself before you ping each other, and Linux to ping other external networks
Ps: In most cases, we don't just want Linux to be able to access the Internet, I also need Linux and Windows to share resources, such as the Linux installation of the service can be used by other LAN hosts, here I will choose bridging mode.
Under the bridge mode network, you can meet the networking requirements for installing MySQL under virtual machine Linux that can be provided to hosts in the 10.10.0 network segment
There are other ways, not much to explain here.
VirtualBox Configuring the CentOS Network