Virtualbox is a virtual machine product of Oracle, similar to vmware
Host system: mac 10.12.6
Virtual machine system: CentOS 6.9
virtualbox: 5.1.28 r117968 (Qt5.6.2)
1. First set up the virtual network card:
Click on virtualbox in the upper left corner - set preferences - network, add two networks
NAT network: This network card is used by the virtual machine to connect to the Internet
Host-Only network: used by the host to connect to the virtual machine
2. Create a virtual machine
Set up the virtual machine network:
Add two network cards:
3, start to install linux
During the installation process, you need to set the IP and gateway of eth0
192.168.56.1
4, set ip
/etc/sysconfig/network-scripts/ifcfg-eth0, corresponding to host-only network card
DEVICE=eth0 TYPE=Ethernet UUID=db0befdd-0ed5-47a4-b64d-d1b58806dae0 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none DEFROUTE = yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth0" HWADDR=08:00:27:6C:2D:FA #Virtual machine network card mac IPADDR=192.168.56.11 #IP PREFIX=24 GATEWAY=192.168.56.1 #host-only ip
/etc/sysconfig/network-scripts/ifcfg-eth1, corresponding to NAT network card, dhcp automatically obtains IP without modification.
DEVICE=eth1 TYPE=Ethernet UUID=9467b12f-1e2e-4d9a-ab20-cc4540ee1809 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=dhcp HWADDR = 08: 00: 27: 30: 4E: 02 DEFROUTE = yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no NAME="System eth1"