LAB: Configure network settings.

Share this link

In the default KVM configuration, all connections to the VM go through the KVM host via a NAT mechanism.
With this setting, a VM can access outside but not the opposite which is a very limited configuration.
It’s better to set up a bridged configuration. Furthermore, this configuration only requires one network card.

Install the bridge-utils package:

# yum install -y bridge-utils

Create the file /etc/sysconfig/network-scripts/ifcfg-br0 file and add the following lines (here is the host KVM IP address, is the gateway IP address, the KVM host is the DNS server):


Note: parameters are case sensitive: specify “Bridge” and not “bridge“.

Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 and put the following lines:


If a file called /etc/sysconfig/network-scripts/ifcfg-Auto_eth0 exists, remove it:

# rm /etc/sysconfig/network-scripts/ifcfg-Auto_eth0

Stop the NetworkManager:

# service NetworkManager stop

Disable the NetworkManager at boot:

# chkconfig NetworkManager off

Restart the network configuration:

# service network restart

Activate the network service at boot:

# chkconfig network on

Activate the NTP service at boot:

# chkconfig ntpd on

Start the NTP service:

# service ntpd start

To allow connections between VM and outside, edit the /etc/sysconfig/iptables and add the following lines before the last 3 lines:

-A INPUT -i virbr0 -j ACCEPT
-A INPUT -i br0 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5905 -j ACCEPT
-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT

Restart the firewall configuration:

# service iptables restart

You can find additional information on the Libvirt website or on the IBM website.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create an EXT4 file system mounted under /vol based on a logical volume of 100MB.
Reduce the size to 60MB.

RHCE7: Task of the day

Allowed time: 8 minutes.
Set up an iScsi target based on a block backstore of 100MB called lv_iscsi with basic authentication, ext4 filesystem and standard firewall configuration.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...