• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

Bridged Networking Setup For KVM Virtualization

Bridged Networking example

A bridged networking setup is typically used in KVM(Kernel-based virtual machine) to allow the virtual machines to access the LAN/WAN over the IP address on the physical host. This guide is focused on a CentOS or similar derivative configuration setup. This is the second part of a multi-part series in setting up KVM services on a server. If you havent already please view our guide on KVM installation on CentOS

First Install the bridged networking package:

yum -y install bridge-utils

The package bridge-utils contains the utilities for configuring  Ethernet bridges.

Next Reconfigure the network interface:

In this example we are going to reconfigure eth1 to be a bridged interface:

First go to the network-scripts directory:

cd /etc/sysconfig/network-scripts/

Rename the network interface:

mv ifcfg-eth1 ifcfg-bridge1

Edit ifcfg-bridge1:

Before it was this:

DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
HWADDR=00:1C:23:E1:54:58
IPADDR=192.168.1.80
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes

We are going to change it to:

DEVICE=bridge1
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.1.80
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes

DEVICE was changed to a new name, type was set to ‘Bridge’ and the HWADDR was removed.

We are going to create a new ifcfg-eth1 for eth1 now that will contain the following:

DEVICE=eth1
ONBOOT=yes
HWADDR=00:1C:23:E1:54:58
BRIDGE=bridge1

DEVICE sets the device name, we copied the HWADDR when we removed it from the bridge1 file and we set BRIDGE=bridge1.

Lastly Load the new settings:

Go ahead and restart the network to bring up the bridged interface and eth1 again

CentOS 6:

/etc/init.d/network restart

CentOS 7:

systemctl restart network

Type the following to confirm the new settings are working correctly:

ifconfig -a

You should see:

bridge1 Link encap:Ethernet HWaddr 00:1C:23:E1:54:58
 inet addr:192.168.1.80 Bcast:192.168.1.255 Mask:255.255.255.0
 inet6 addr: fe80::21c:23ff:fee1:5458/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:92 errors:0 dropped:0 overruns:0 frame:0
 TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:11935 (11.6 KiB) TX bytes:3563 (3.4 KiB)

eth1 Link encap:Ethernet HWaddr 00:1C:23:E1:54:58
 inet6 addr: fe80::21c:23ff:fee1:5458/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:87 errors:0 dropped:0 overruns:0 frame:0
 TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:13117 (12.8 KiB) TX bytes:3325 (3.2 KiB)
 Interrupt:17

That is it for this portion on setting up networking for KVM.

Part 1: KVM Installation on CentOS
Part 2: Bridged Networking Setup For KVM Virtualization
Part 3: Creating A New Virtual Machine with KVM

Apr 25, 2017LinuxAdmin.io
0 0 votes
Article Rating
KVM installation on CentOSLinux Access Control Lists
You Might Also Like
 
Blocking Bad UserAgents with ModSecurity and Fail2ban
 
Install And Configure ProFTPD On CentOS
Subscribe
Notify of
guest

guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jc
Jc
7 years ago

Hello there! I could have sworn I’ve visited this blog before but after going through a few of the posts I realized it’s new to me. Anyhow, I’m certainly happy I discovered it and I’ll be bookmarking it and checking back regularly!

0
Reply
LinuxAdmin.io
Author
LinuxAdmin.io
7 years ago
Reply to  Jc

Thank you for the kind words!

0
Reply
Stacy
Stacy
7 years ago

Very nice write-up. I certainly love this site. Stick with it!

0
Reply
LinuxAdmin.io
Author
LinuxAdmin.io
7 years ago
Reply to  Stacy

Glad to help!

0
Reply
8 years ago 4 Comments Linux Tutorials, Virtualization kvm, linux, networking2,339
Recent Posts
  • Configuring Firewalld to Work Seamlessly with Docker on CentOS
  • Mastering NGINX Tuning: Optimizing Web Server Performance
  • Exploring eBPF: Revolutionizing Network and System Monitoring
  • Kubernetes: Installation and Overview on CentOS 8
  • Install Docker on Centos 8
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
76,228 views
Zend Opcache
Setup and Optimize Zend OpCache
47,113 views
Install ffmpeg
FFMpeg Install On CentOS 7
21,687 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz