There are a bunch of guides out there on how to create a virtualbox network to work with about every client distribution there is. This is another one, for CentOS 7. All you will need to do this is a text editor and a minimal CentOS 7 installation, no networkmanager, no ifconfig.
If you want your box to be able to connect to the internet you will first need to add a NAT adapter, which is the default so you probably won’t have to do anything.
Now to the hard part:
1. Create a Host-Only network
You can ignore the ipv6 part. But you should use an ipv4 address and network mask that make sense. A /24 should do the job in most cases. Also make sure disable the DHCP Server
2. Add a Host-Only network adapter to your machine
3. Configure the vbox network
The following commands are to be run from the box itself and assume a standard CentOS 7 installation.
First you need to know the name of your Host-Only interface.
# ip a
The right interface is the one without an ipv4 address, in my case enp0s8.
Now you will need to create an ifcfg for that interface.
# vim /etc/sysconfig/network/scripts/ifcfg-enp0s8
TYPE="Ethernet" BOOTPROTO="static" IPADDR="192.168.24.10" NETMASK="255.255.255.0" NAME="enp0s8" DEVICE="enp0s8" ONBOOT="yes"
Now just restart the network service
# systemctl restart network.service
To check whether everything worked check ip a
and try to ping the new ip from the host machine.
0 Kommentare