O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To define a new bridged network and attach a guest to it, follow the steps:

  1. Take down the interface we are going to bridge:
root@kvm:~# ifdown eth1root@kvm:~#
  1. Edit the network configuration file on the host and replace the eth1 block with the following, if your host OS is Debian/Ubuntu:
root@kvm:~# vim /etc/network/interfaces... auto virbr2 iface virbr2 inet static     address 192.168.1.2     netmask 255.255.255.0     network 192.168.1.0     broadcast 192.168.1.255     gateway 192.168.1.1     bridge_ports eth1     bridge_stp on     bridge_maxwait 0...root@kvm:~#
  1. If using RedHat/CentOS distributions, edit the following two files instead:
root@kvm:~# cat /etc/sysconfig/ifcfg-eth1DEVICE=eth1NAME=eth1NM_CONTROLLED=yesONBOOT=yesTYPE=EthernetBRIDGE=virbr2 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required