RHEL7: Configure lab network settings.

Share this link

Presentation

In the default KVM configuration, all connections to the VM go through the KVM host via a NAT mechanism (Network Address Translation).
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 doesn’t require any additional network card.

Before going any further, you can decide to restore the old naming convention for your network interface card (for example eth0 instead of enp2s0).

Bridge configuration

Install the bridge-utils package (if not already there):

# yum install -y bridge-utils

Stop the Firewalld service:

# systemctl disable firewalld
# systemctl stop firewalld

Note: Firewalld needs NetworkManager to define which network interface a packet is coming from. As we are going to stop NetworkManager, Firewalld should be stopped too.

Stop the NetworkManager service:

# systemctl mask NetworkManager
# systemctl mask NetworkManager-dispatcher
# systemctl stop NetworkManager 

Note: As NetworkManager is a dbus-activated service, disabling it is not enough to be sure that it will not restart any more. Masking needs to be done before stopping, otherwise you won’t be sure it is really stopped. NetworkManager-dispatcher is a service run by NetworkManager to start or stop services according to network interfaces going up or down.

Start the network service:

# systemctl start network
# chkconfig network on

Note: At this point you may need to rename IPADDR0 in IPADDR, NETMASK0 in NETMASK and GATEWAY0 in GATEWAY in the /etc/sysconfig/network-scripts/ifcfg-eth0 file (if your interface is called eth0), otherwise you won’t get any default gateway (Test done with CentOS 7.4).

Create a bridge called br0 (here the physical interface is eth0):

# virsh iface-bridge eth0 br0

Alternatively, you can manually create the bridge as follows:

Rename the ifcfg-eth0 configuration file in ifcfg-br0:

# cd /etc/sysconfig/network-scripts
# mv ifcfg-eth0 ifcfg-br0

Edit the ifcfg-br0 file:

DEVICE=br0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.1.5
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
IPV6INIT=yes
IPV6_AUTOCONF=yes
DHCPV6=no
STP=on
DELAY=0
DNS1=192.168.1.1
DOMAIN=example.com

Create the new ifcfg-eth0 file:

DEVICE=eth0
ONBOOT=yes
BRIDGE=br0
HWADDR="XX:XX:XX:XX:XX:XX"

Now, you need to reboot to get your bridge working.

Additional resources

You can find additional information on the Libvirt website.
Fedora Magazine published an article about Building a network bridge with Fedora.

(No Ratings Yet)
Loading...
14 comments on “RHEL7: Configure lab network settings.
  1. boyko says:

    Hello CertDepot,

    First I want to say that this is the most helpful site I ever seen regarding RHEL certifications and I am grateful that it exists !

    I want to share my experience with this topic.
    During my attempts to setup a lab I had issues setting up the networking for the KVM host. Maybe because I installed the system with GUI (“Server with GUI” option from the installer) I had to disable the NetworkManager service and work with the network service which did the magic for me. Find below how I did the setup:
    # systemctl stop NetworkManager.service
    # systemctl disable NetworkManager.service

    and the setup for the network interfaces:

    [root@hvhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0
    DEVICE=”br0″
    BOOTPROTO=”static”
    IPADDR=192.168.1.50
    NETMASK=255.255.255.0
    GATEWAY=192.168.1.1
    DNS1=192.168.1.1
    IPV6INIT=”yes”
    IPV6_AUTOCONF=”yes”
    ONBOOT=”yes”
    TYPE=”Bridge”
    DELAY=”0″
    [root@hvhost ~]#
    [root@hvhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
    TYPE=Ethernet
    NAME=eth0
    UUID=xxxxxx-e062-4e99-xxxx-39ca3e89c54d
    ONBOOT=yes
    HWADDR=XX:XX:XX:XX:XX:XX
    BRIDGE=br0
    [root@hvhost ~]#

  2. number 6 says:

    Hello, I tried to make the bridge in CentOS but here’s the problem:

    [root@localhost night]# systemctl disable NetworkManager
    [root@localhost night]# systemctl stop NetworkManager
    [root@localhost night]#
    [root@localhost night]# systemctl stop NetworkManager
    [root@localhost night]# systemctl start network
    Job for network.service failed. See ‘systemctl status network.service’ and ‘journalctl -xn’ for details.
    [root@localhost night]# systemctl status network.service
    network.service – LSB: Bring up/down networking
    Loaded: loaded (/etc/rc.d/init.d/network)
    Active: failed (Result: exit-code) since Sun 2015-03-01 17:15:05 EET; 17s ago
    Process: 4155 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain network[4155]: RTNETLINK answers: File exists
    Mar 01 17:15:05 localhost.localdomain systemd[1]: network.service: control process exi…=1
    Mar 01 17:15:05 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down n…g.
    Mar 01 17:15:05 localhost.localdomain systemd[1]: Unit network.service entered failed …e.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@localhost night]# chkconfig network on
    [root@localhost night]# virsh iface-bridge eth0 br0
    error: An error occurred, but the cause is unknown

    I tried to restore the old naming convention the network interface card but same happens.

  3. travisby says:

    Hello,

    In this step you mention to disable nm+firewalld,

    However in the subsequent step (setup local repo), you mention how to allow http traffic through the firewall. Should either of these two services be renabled, or was it an error on the other page?

    Thanks,

    Travis

  4. cdz says:

    why you are running

    “chkconfig network on”

    after starting network with systemd? Shouldn’t it be rather “systemctl enable network”?

    • CertDepot says:

      Try to execute the systemctl enable network command and you will see that this command doesn’t work. There is certainly a more “Systemd” way to do it but I don’t know it!

  5. brb says:

    Hello guys, I am going to buy below laptop. Can I setup my rhce and KVM labs using this laptop? Please share your advice. Thank you!
    ==============================================
    Toshiba Satellite S70-BBT2N23 Laptop @ $740.99
    ==============================================
    – 4th Generation Intel® Core™ i7-4720HQ Processor (6M Cache, up to 3.60 GHz)
    – Windows 8.1
    – 12GB DDR3L 1600MHz (8GB + 4GB)
    – 500GB HDD (5400rpm, Serial ATA)
    – 17.3″ HD+ TruBrite® LED Backlit display (1600×900)
    – DVD SuperMulti (+/-R double layer) drive
    – Premium Raised Tile Keyboard (black)
    – Wi-Fi® Wireless networking (802.11b/g/n)+ Bluetooth 4.0
    – McAfee Live Safe™ (30-day trial)
    – 1 Year Standard Limited Warranty (1 Year on Battery)

  6. Mike_ says:

    After starting the network service you indicate we should update “/etc/sysconfig/network-config/ifcfg-eth0” is this a typo? I expect the ifcfg-eth0 file to be in “/etc/sysconfig/network-scripts”, I am not familiar with the “network-config” directory. (I am using Centos 7.0-1406)

Leave a Reply

Upcoming Events (Local Time)

There are no events.

Follow me on Twitter

Archives

vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |