[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Using KVM public bridge manually



Hi, 

I want to setup my KVM bridge so that, 

- assign an IP address to the virtual machines and make them accessible 
from the local network 
- leave my physical interface eth0 as is, and only bring up the KVM 
bridge device if I am using KVM.

The best tutorial I found so far for above setup are
http://www.linux-kvm.org/page/Networking
http://jimmyg.org/blog/2009/sensible-kvm-networking.html

However, even my host setup seems to be find, the KVM guest network 
doesn't work. ifconfig shows that eth0 doesn't have any ip address. 

This is what I've been doing on the host side:

sudo brctl addbr br0
sudo ifconfig br0 192.168.1.1 netmask 255.255.255.0 up

USERID=`whoami`
iface=`sudo tunctl -b -u $USERID`
sudo brctl addif br0 $iface
sudo ifconfig $iface up 0.0.0.0 promisc

$ echo $iface
tap1

$ ifconfig
br0       Link encap:Ethernet  HWaddr 36:58:6b:f0:c4:c8  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::dc76:3aff:fedb:6fb8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 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:0 (0.0 B)  TX bytes:6341 (6.1 KiB)

eth0      Link encap:Ethernet  HWaddr 00:e0:4d:b8:98:ef  
          inet addr:192.168.0.106  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4dff:feb8:98ef/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16669445 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9665524 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:21328927793 (19.8 GiB)  TX bytes:966868671 (922.0 MiB)
          Interrupt:27 Base address:0xa000 

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:5254561 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5254561 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4760493036 (4.4 GiB)  TX bytes:4760493036 (4.4 GiB)

tap1      Link encap:Ethernet  HWaddr 36:58:6b:f0:c4:c8  
          inet6 addr: fe80::3458:6bff:fef0:c4c8/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:16 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=0.063 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=0.054 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=0.051 ms

kvm -m 1024 -smp 2 -net nic -net tap,ifname=$iface,script=no,downscript=no 
-hda . . . 

Anyone can help? 

Thanks

-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/techdocs/
  http://xpt.sourceforge.net/tools/


Reply to: