You are not logged in.

#1 2010-08-18 21:29:20

solo9300
Member
Registered: 2010-08-18
Posts: 13

HowTo qemu-kvm and Bridging

Hello all,

Basically my problem is how can i access a virtual machine from local network. I am able to do so from the host PC put not from other  PC's on the same network.

here is my what i did so far

/etc/rc.conf

MOD_AUTOLOAD="yes"
MODULES=(kvm kvm-intel)
USELVM="no"

HOSTNAME="cloud"
eth0="eth0 10.0.1.4 netmask 255.255.255.240 broadcast 10.0.1.15"
eth1="eth1 0.0.0.0 up"
br0="br0 10.0.1.5 netmask 255.255.255.240 broadcast 10.0.1.15 up"
INTERFACES=(eth0 eth1 br0)
gateway="default gw 10.0.1.1"
ROUTES=(gateway)

DAEMONS=(syslog-ng dbus hal network sshd rpcbind nfs-server libvirtd netfs crond)

/etc/conf.d/bridges

bridge_br0="eth1"
BRIDGE_INTERFACES=(br0)

/etc/resolv.conf

domain lan
nameserver 10.0.1.1

bridge setup

brctl addbr br0
brctl addif br0 eth1

brctl show

bridge name    bridge id        STP enabled    interfaces
br0        8000.001cc038afba    no        eth1
virbr0        8000.fe540045a731    yes        vnet0

ifconfig -a

br0       Link encap:Ethernet  HWaddr 00:1C:C0:38:AF:BA  
          inet addr:10.0.1.5  Bcast:10.0.1.15  Mask:255.255.255.240
          inet6 addr: fe80::21c:c0ff:fe38:afba/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:60123 (58.7 Kb)  TX bytes:704 (704.0 b)

eth0      Link encap:Ethernet  HWaddr 00:C0:DF:13:AF:87  
          inet addr:10.0.1.4  Bcast:10.0.1.15  Mask:255.255.255.240
          inet6 addr: fe80::2c0:dfff:fe13:af87/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38676 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4442847 (4.2 Mb)  TX bytes:12389134 (11.8 Mb)
          Interrupt:22 Base address:0x800 

eth1      Link encap:Ethernet  HWaddr 00:1C:C0:38:AF:BA  
          inet6 addr: fe80::21c:c0ff:fe38:afba/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1267 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:95013 (92.7 Kb)  TX bytes:1422 (1.3 Kb)
          Memory:e3200000-e3220000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:15110 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15110 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1571110 (1.4 Mb)  TX bytes:1571110 (1.4 Mb)

virbr0    Link encap:Ethernet  HWaddr FE:54:00:45:A7:31  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:42 errors:0 dropped:0 overruns:0 frame:0
          TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5002 (4.8 Kb)  TX bytes:5361 (5.2 Kb)

vnet0     Link encap:Ethernet  HWaddr FE:54:00:45:A7:31  
          inet6 addr: fe80::fc54:ff:fe45:a731/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:42 errors:0 dropped:0 overruns:0 frame:0
          TX packets:862 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:5590 (5.4 Kb)  TX bytes:48437 (47.3 Kb)

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.1.0        0.0.0.0         255.255.255.240 U     0      0        0 eth0
10.0.1.0        0.0.0.0         255.255.255.240 U     0      0        0 br0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
0.0.0.0         10.0.1.1        0.0.0.0         UG    0      0        0 eth0



the IP Address for the virtual machine i am trying to access is 192.168.122.72. I am only can access it from the host PC only, therefore, how i can i access it from other PC's on the network ?

Any help would be much appreciated.

Last edited by solo9300 (2010-08-18 23:10:32)

Offline

#2 2010-08-19 01:46:38

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: HowTo qemu-kvm and Bridging

since there is already a bridge created named virbr0, you dont need to create another bridge, simply add eth1 interface to virbr0.

also, the virtual machine ip address must be in the same address space as the addresses for the network machines.

change your virbr0 ip address to 10.0.1.5 and set the virtual machine ip to 10.0.1.6

Offline

#3 2010-08-19 05:38:54

solo9300
Member
Registered: 2010-08-18
Posts: 13

Re: HowTo qemu-kvm and Bridging

Sin.citadel wrote:

since there is already a bridge created named virbr0, you dont need to create another bridge, simply add eth1 interface to virbr0.

also, the virtual machine ip address must be in the same address space as the addresses for the network machines.

change your virbr0 ip address to 10.0.1.5 and set the virtual machine ip to 10.0.1.6

OK,
I changed eth1 to

eth1="eth1 10.0.1.5 netmask 255.255.255.240 broadcast 10.0.1.15"

and  I try to change  virbr0 ip address to 10.0.1.5 by editing /etc/libvirt/qemu/networks/default.xml

<network>
  <name>default</name>
  <uuid>17dee4e4-313f-47cf-aa4e-6e79e55f857b</uuid>
  <bridge name="virbr0" />
  <forward/>

  <ip address="10.0.1.5" netmask="255.255.255.240">
    <dhcp>
      <range start="10.0.1.8" end="10.0.1.14" />
    </dhcp>
  </ip>
</network>

However, i could not change the virbr0 ip address to 10.0.1.5!

so how can i change virbr0 ip address to 10.0.1.5?

Last edited by solo9300 (2010-08-19 05:39:45)

Offline

#4 2010-08-19 15:59:46

solo9300
Member
Registered: 2010-08-18
Posts: 13

Re: HowTo qemu-kvm and Bridging

Anyone !

Offline

#5 2010-08-21 05:02:06

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: HowTo qemu-kvm and Bridging

you can use ifconfig,

ifconfig vibr0 10.0.1.5

Offline

Board footer

Powered by FluxBB