Centos – configuring virtualbox bridged adapter

centos 6

Here is how you will set your virtual centos machine to connect to the internet. First your virtual machine must be using a bridged adapter, running ifconfig will give you something like this.

centos configure network

This means that eth0 is not yet configured. We need to manually configure it in order to connect to our local network. First, you must edit ifcfg-eth0 configuration file.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Change ONBOOT parameter to yes.

centos configure network

If you want a static IP address just change the BOOTPROTO to static and put your desired IP address along with the netmask like this.

centos configure network

Also, make sure you set your gateway IP too. Just edit your network file

vi /etc/syconfig/network

centos configure network

Next, we need to tell our server where to look for domains. Edit resolv.conf file

vi /etc/resolv.conf

and use Google’s public DNS.

nameserver 8.8.8.8
nameserver 8.8.4.4

Restart the network service and ping google.com!

service network restart

centos configure network

Not convinced? Download somefiles! 😀

centos configure network

Tags : , , , ,

5 thoughts on “Centos – configuring virtualbox bridged adapter”

  1. I have installed CENTOS7 on my WIndows host, configure VirtualBox to use bridged networking, but I can’t get my eth0 up. When I fire up ifconfig I only gets enp0s3 and lo device. Any advice would be helpfull.

  2. ifcfg-eth0 is originally set up anaconda at host installation time, not by “ifup eth0”. It’s also why copying a disk image of a CentOS VM to create another VM breaks networking.

    There are also a small set of scripts in /etc/sysconfig/networking/profiles/ which can be, frankly, deleted to avoid overlap with these hand edited files you mention.

Leave a Reply

%d bloggers like this: