I. Introduction
When installed Linux systems with virtual machines, often there will be some problems. For example: the network is not continuous from the host to the virtual machine; the virtual machine can not be networked; IP address of the virtual machine is not fixed. To solve these problems, I have spent a lot of time. Here, note filled pit method.
Second, the environment
System: CentOS 7.2
Virtual machine software: Virtualbox
Third, the target
Configuring have a fixed IP, virtual machines can be networked Centos7.2
Fourth, step
① Open the virtual machine settings, find the network settings. Then enable the card 1, the connection mode select Host-only, select the name of the interface VirtualBox Host-Only Ethernet Adapter, disposed below
prompt:
1. VM network settings, you need to shut down the virtual machine;
2. Host-Only mode used here is to give the virtual machine to set a fixed IP, so that the host and the virtual machine network connected.
② then enable the card 2, connection mode select Network Address Translation (NAT) can, as shown below
prompt:
1. here to set up two network cards, you can start the virtual machine, further configuration;
2. Here the use of Network Address Translation (NAT) mode, the virtual machine is configured to access a network card.
③ edit enp0s3 card, vi / etc / sysconfig / network-scripts / ifcfg-enp0s3, before modification, VirtualBox Host-Only IP address of the Ethernet Adapter (select Virtualbox window while holding down Ctrl + w to view the IP address) need to look at
Partial modification shown below, IP addresses, their actual circumstances tool!
④ View enp0s8 card, if ONBOOT property is no, must remember to modify to yes, otherwise the network card configuration does not take effect
⑤ restart the network network, the changes to take effect. Command: service network restart. Adding dns service address to the /etc/resolv.conf file. Address where you can view the local computer access using dns service address, as shown below
⑥ test
In the local computer network and Sharing Center, set up VirtualBox Host-Only Ethernet Adapter # IP Address 4 of 192.168.0.82, DNS services 192.168.0.1 and 114.114.114.114