centos virtual bridge

3
[1] nixCraft: Linux Tips, Hacks, Tutorials, And Ideas In Blog Format http://www.cyberciti.biz/ ~ RSS Feed ~ Facebook ~ Twitter ~ Google+ ~ Youtube Copyrighted material Home > FAQ > Virtualization > Linux KVM > RedHat and Friends > CentOS CentOS / Redhat: KVM Bridged Network Configuration Posted By nixCraft < [email protected]> On January 12, 2010 @ 9:31 am [ 17 Comments ] With bridged networking you can share actual network device with KVM machines. This is required for servers with multiple network cards and gives you good performance. You can choose to put multiple segments into one bridged network or to divide it into different networks interconnected by routers. Our Sample Setup The following describes the networking used by our setup: +------+ +-----+ LAN --> | eth0 | <==> | br0 | -> KVM VMs connected to LAN for SAN/NFS +------+ +-----+ 10.10.x.y/24 +------+ +-----+ Internet --> | eth1 | <==> | br1 | -> KVM VMs connected to the Inernet +------+ +-----+ 123.1.2.0/28 Where, All other clients can reached to all VMs via br1 which is connected to public interface. br1 is our default gateway. br0 is connected to private LAN to access other servers, services and storage devices such as SAN/NAS or NFS servers. br0 route is configured via route-br0 static networking configuration file. Turn Off NetworkManager The NetworkManager (GUI) tool can create problems with bridged based networking so disable it as follows, enter: # chkconfig NetworkManager off # chkconfig network on # service NetworkManager stop Edit /etc/sysconfig/network, enter: # vi /etc/sysconfig/network Update file as follows: NETWORKING =yes HOSTNAME=kvm42.nixcraft.net GATEWAY=br1 Save and close the file. br0: Configure Bridging for eth0 Edit /etc/sysconfig/network-scripts/ifcfg-eth0, enter: # vi /etc/sysconfig/network-scripts/ifcfg-eth0 Update it as follows: DEVICE=eth0 ONBOOT=yes ETHTOOL_OPTS="autoneg off speed 100 duplex full" BRIDGE=br0 nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 1 of 3

Upload: pepon2014

Post on 23-Dec-2015

221 views

Category:

Documents


5 download

DESCRIPTION

Centos Virtual Bridge

TRANSCRIPT

Page 1: Centos Virtual Bridge

[1]

nixCraft Linux Tips Hacks Tutorials And Ideas In Blog Formathttpwwwcybercitibiz ~ RSS Feed ~ Facebook ~ Twitter ~ Google+ ~Youtube

Copyrighted material

Home gt FAQ gt Virtualization gt Linux KVM gt RedHat and Friends gt CentOS

CentOS Redhat KVM Bridged Network ConfigurationPosted By nixCraft ltwebmastercybercitibizgt On January 12 2010 931 am [ 17 Comments ]

With bridged networking you can share actual network device with KVM machines This is required for servers withmultiple network cards and gives you good performance You can choose to put multiple segments into one bridgednetwork or to divide it into different networks interconnected by routers

Our Sample Setup

The following describes the networking used by our setup

+------+ +-----+LAN --gt | eth0 | lt==gt | br0 | -gt KVM VMs connected to LAN for SANNFS +------+ +-----+ 1010xy24 +------+ +-----+Internet --gt | eth1 | lt==gt | br1 | -gt KVM VMs connected to the Inernet +------+ +-----+ 12312028

Where

All other clients can reached to all VMs via br1 which is connected to public interface br1 is our default gatewaybr0 is connected to private LAN to access other servers services and storage devices such as SANNAS or NFSservers br0 route is configured via route-br0 static networking configuration file

Turn Off NetworkManager

The NetworkManager (GUI) tool can create problems with bridged based networking so disable it as follows enter chkconfig NetworkManager off chkconfig network on service NetworkManager stopEdit etcsysconfignetwork enter vi etcsysconfignetworkUpdate file as follows

NETWORKING=yesHOSTNAME=kvm42nixcraftnetGATEWAY=br1

Save and close the file

br0 Configure Bridging for eth0

Edit etcsysconfignetwork-scriptsifcfg-eth0 enter vi etcsysconfignetwork-scriptsifcfg-eth0Update it as follows

DEVICE=eth0ONBOOT=yesETHTOOL_OPTS=autoneg off speed 100 duplex fullBRIDGE=br0

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 1 of 3

HWADDR=b8ac6f6531e5

Save and close the file Create etcsysconfignetwork-scriptsifcfg-br0 enter vi etcsysconfignetwork-scriptsifcfg-br0Update it as follows (note options are case sensitive ie Bridge and bridge are two different options)

DEVICE=br0TYPE=BridgeBOOTPROTO=staticONBOOT=yesIPADDR=10102170NETMASK=255255255192DELAY=0

Save and close the file Finally create static routing file etcsysconfignetwork-scriptsroute-br0 enter vi etcsysconfignetwork-scriptsroute-br0Edit it as follows

100008 via 101021122 dev br0

Save and close the file Delete old etcsysconfignetwork-scriptsroute-eth0 (if exists) rm etcsysconfignetwork-scriptsroute-eth0

br1 Configure Bridging for eth1

Edit etcsysconfignetwork-scriptsifcfg-eth1 enter vi etcsysconfignetwork-scriptsifcfg-eth1Update it as follows

DEVICE=eth1ONBOOT=yesETHTOOL_OPTS=autoneg off speed 100 duplex fullBRIDGE=br1HWADDR=0030498c48ad

Please note that test server is set to 100Mbps full duplex Save and close the file Edit etcsysconfignetwork-scriptsifcfg-br1 enter vi etcsysconfignetwork-scriptsifcfg-br1Define public IP address including gateway as follows

DEVICE=br1BOOTPROTO=staticONBOOT=yesIPADDR=123123NETMASK=255255255248GATEWAY=12312200TYPE=BridgeDELAY=0

Save and close the file

Restart Network Service

Type the following command service network restartMake sure everything is working fine brctl showSample outputs

bridge name bridge id STP enabled interfacesbr0 80000030488e31ac no eth0br1 80000030488e31ad no eth1

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 2 of 3

virbr0 8000000000000000 yes

Verify IPs and routing tables ip addr show br0 ip addr show br1 ip route ping cybercitibiz host googlecom

Important Message from nixCraft

4000+ howtos and counting Want to read more Linux UNIX howtos tips and tricks We request you to sign up forthe following to ensure that you make the most from our guides howtos

1 RSS feed for nixCraft - Get intimated about our new howtos faqs as soon as it is released2 Daily email newsletter or weekly newsletter - Get intimated about our new howtos faqs as soon as it is

released via email

URL to article httpwwwcybercitibizfaqrhel-linux-kvm-virtualization-bridged-networking-with-libvirt

URLs in this post

[1] Image httpwwwcybercitibizfaqcategorylinux-kvm

Copyrighted material

Copyright copy 2006-2013 nixCraft All rights reserved This print pdf version is for personal non-commercial use only Unless otherwise indicated thedocuments and graphics stored on this Web server wwwcybercitibiz are copyrighted Links to these documents are permitted and encouraged No

copies may be made without permission More details - httpwwwcybercitibiztipscopyright

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 3 of 3

Page 2: Centos Virtual Bridge

HWADDR=b8ac6f6531e5

Save and close the file Create etcsysconfignetwork-scriptsifcfg-br0 enter vi etcsysconfignetwork-scriptsifcfg-br0Update it as follows (note options are case sensitive ie Bridge and bridge are two different options)

DEVICE=br0TYPE=BridgeBOOTPROTO=staticONBOOT=yesIPADDR=10102170NETMASK=255255255192DELAY=0

Save and close the file Finally create static routing file etcsysconfignetwork-scriptsroute-br0 enter vi etcsysconfignetwork-scriptsroute-br0Edit it as follows

100008 via 101021122 dev br0

Save and close the file Delete old etcsysconfignetwork-scriptsroute-eth0 (if exists) rm etcsysconfignetwork-scriptsroute-eth0

br1 Configure Bridging for eth1

Edit etcsysconfignetwork-scriptsifcfg-eth1 enter vi etcsysconfignetwork-scriptsifcfg-eth1Update it as follows

DEVICE=eth1ONBOOT=yesETHTOOL_OPTS=autoneg off speed 100 duplex fullBRIDGE=br1HWADDR=0030498c48ad

Please note that test server is set to 100Mbps full duplex Save and close the file Edit etcsysconfignetwork-scriptsifcfg-br1 enter vi etcsysconfignetwork-scriptsifcfg-br1Define public IP address including gateway as follows

DEVICE=br1BOOTPROTO=staticONBOOT=yesIPADDR=123123NETMASK=255255255248GATEWAY=12312200TYPE=BridgeDELAY=0

Save and close the file

Restart Network Service

Type the following command service network restartMake sure everything is working fine brctl showSample outputs

bridge name bridge id STP enabled interfacesbr0 80000030488e31ac no eth0br1 80000030488e31ad no eth1

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 2 of 3

virbr0 8000000000000000 yes

Verify IPs and routing tables ip addr show br0 ip addr show br1 ip route ping cybercitibiz host googlecom

Important Message from nixCraft

4000+ howtos and counting Want to read more Linux UNIX howtos tips and tricks We request you to sign up forthe following to ensure that you make the most from our guides howtos

1 RSS feed for nixCraft - Get intimated about our new howtos faqs as soon as it is released2 Daily email newsletter or weekly newsletter - Get intimated about our new howtos faqs as soon as it is

released via email

URL to article httpwwwcybercitibizfaqrhel-linux-kvm-virtualization-bridged-networking-with-libvirt

URLs in this post

[1] Image httpwwwcybercitibizfaqcategorylinux-kvm

Copyrighted material

Copyright copy 2006-2013 nixCraft All rights reserved This print pdf version is for personal non-commercial use only Unless otherwise indicated thedocuments and graphics stored on this Web server wwwcybercitibiz are copyrighted Links to these documents are permitted and encouraged No

copies may be made without permission More details - httpwwwcybercitibiztipscopyright

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 3 of 3

Page 3: Centos Virtual Bridge

virbr0 8000000000000000 yes

Verify IPs and routing tables ip addr show br0 ip addr show br1 ip route ping cybercitibiz host googlecom

Important Message from nixCraft

4000+ howtos and counting Want to read more Linux UNIX howtos tips and tricks We request you to sign up forthe following to ensure that you make the most from our guides howtos

1 RSS feed for nixCraft - Get intimated about our new howtos faqs as soon as it is released2 Daily email newsletter or weekly newsletter - Get intimated about our new howtos faqs as soon as it is

released via email

URL to article httpwwwcybercitibizfaqrhel-linux-kvm-virtualization-bridged-networking-with-libvirt

URLs in this post

[1] Image httpwwwcybercitibizfaqcategorylinux-kvm

Copyrighted material

Copyright copy 2006-2013 nixCraft All rights reserved This print pdf version is for personal non-commercial use only Unless otherwise indicated thedocuments and graphics stored on this Web server wwwcybercitibiz are copyrighted Links to these documents are permitted and encouraged No

copies may be made without permission More details - httpwwwcybercitibiztipscopyright

nixCraft is GIT UL++++ W+++ C++++ M+ e+++ d- Page 3 of 3