LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   VM network bridge (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/vm-network-bridge-4175454567/)

asd0z 03-18-2013 03:47 PM

VM network bridge
 
Hi all

How to make bridge for KVM virtual machine in Fedora/RHEL like in VMware Workstation?

Virtual machine must be in same network as host but have different MAC+IP. NAT is not ok.

Air-Global 03-19-2013 03:54 AM

Step one, add a bridge network.

ill use eth0 for all examples:

Create a copy of your eth0 file as br0:
Code:

$ cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-br0
Edit your original eth file for bridgeing:

Code:

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
change/add these lines:
Code:

NM_CONTROLLED="no" //might be needed, for me it works both ways
BRIDGE="br1"

Edit the new br file:
Code:

$ vi /etc/sysconfig/network-scripts/ifcfg-br0
Make sure you end up with it as follows:
Code:

DEVICE="br0"
MACADDR="YO:RE:MA:CH:ER:E!"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Bridge"
IPV4_FAILURE_FATAL="no"

restart your network service:
Code:

$ service network restart
Now that your host setup is done, lets set your KVM Setup:
Ill assume your KVM guest is running.

Edit your KVMGuests setup
Code:

$ virsh edit kvmGuestName
Add these lines (or replace your current network setup) & Make sure the slot on the last line is unique in your file
Code:

<interface type='bridge'>
  <mac address='52:54:00:xx:xx:xx'/>  //Write any unique to your nets mac
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>


Restart your guest and you are done

asd0z 03-19-2013 05:34 AM

What MAC i should type here?
Quote:

MACADDR="YO:RE:MA:CH:ER:E!"
Did i understand correctly that 'host eth0' and 'virtual internal interface of kvmGuestName' will be in the same network?

Air-Global 03-19-2013 06:56 AM

Ah yes, that could have been clearer :P

The mac of your orriginal interface. It binds the bridge to the mac.


All times are GMT -5. The time now is 04:43 AM.