Select Page

Host-only network with virtual CentOS 7 instances

by | Jul 30, 2015 | Linux, Virtualisierung, Network

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

Create 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

add network

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 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

More posts on the topic Linux | Virtualisierung | Network

Kickstart your Laptop with Linux

Alle paar Jahre bekomme ich einen neuen Laptop bei Netways. Vor zwei Wochen war es wieder so weit und somit eine gute Gelegenheit mal wieder die Betriebssystem-Frage zu stellen. Die alte Frage also: "Welches Linux ist das Beste?". Also für mich ganz persönlich. Nicht...

Ansible – Testing roles with Molecule

Ansible is a widely used and a powerful open-source configuration and deployment management tool. It can be used for simple repetitive daily tasks or complex application deployments, therefore Ansible is able to cover mostly any situation. If used in complex or...