Am 04.04.2010 20:02, schrieb Dan Johansson:
> On Sunday 04 April 2010 15.00:26 sudhir kumar wrote:
>> On Sun, Apr 4, 2010 at 5:47 PM, Dan Johansson <k...@dmj.nu> wrote:
>>> Hi,
>>>
>>> I am new to this list and to KVM (and qemu) so please be gentle with me.
>>> Up until now I have been running my virtualizing  using VMWare-Server.
>>> Now I want to try KVM due to some issues with the  VMWare-Server and I am
>>> having some troubles with the networking part of KVM.
>>>
>>> This is a small example of what I want (best viewed in a fix-font):
>>>
>>>  +-----------------------------------+
>>>  | Host                              |
>>>  |  +----------+                eth0 |---- 192.168.1.0/24
>>>  |  |      eth0|-- +                 |
>>>  |  | VM1  eth1|---(---+------- eth1 |---- 192.168.2.0/24
>>>  |  |      eth2|---(---(---+         |
>>>  |  +----------+   |   |   |         |
>>>  |                 |   |   |         |
>>>  |  +----------+   +---(---(--- eth2 |---- 192.168.1.0/24
>>>  |  |      eth0|---+   |   |         |
>>>  |  | VM2  eth1|-------+   +--- eth3 |---- 192.168.3.0/24
>>>  |  |      eth2|-----------+         |
>>>  |  +----------+                     |
>>>  |                                   |
>>>  +-----------------------------------+
>>>
>>> Host-eth0 is only for the Host (no VM)
>>> Host-eth1 is shared between the Host and the VM's (VM?-eth1)
>>> Host-eth2 and Host-eth3 are only for the VMs (eth0 and eth2)
>>>
>>> The Host and the VMs all have fixed IPs (no dhcp or likewise).
>>> In this example th IPs could be:
>>> Host-eth0:      192.168.1.1
>>> Host-eth1:      192.168.2.1
>>> Host-eth2:      -
>>> Host-eth3:      -
>>> VM1-eth0:               192.168.1.11
>>> VM1-eth1:               192.168.2.11
>>> VM1-eth2:               192.168.3.11
>>> VM2-eth0:               192.168.1.22
>>> VM2-eth1:               192.168.2.22
>>> VM3-eth2:               192.168.3.22
>>>
>>> And, yes, Host-eth0 and Host-eth2 are in the same subnet, with eth0
>>> dedicated to the Host and eth2 dedicated to the VMs.
>>>
>>> In VMWare this was quite easy to setup (three bridged networks).
>>
>> Its easy with KVM too. You want 3 NICs per VM, so you need to pass the
>> corresponding parameters(including qemu-ifup script) for 3 NICs to
>> each VM.
>> In the host you need to create 2 bridges: say br-eth1 and br-eth2.
>> Make them as the interface on the host in place of the corresponding
>> eth interfaces.(brct addbr br-eth1; ifcfg eth1 0.0.0.0 up; brctl addif
>> br-eth eth1; assign eth1's ip and routes to breth1; same for eth2).
>> In the corresponding qemu-ifup scripts of each interface use
>> bridge=br-ethN (This basicaly translates to brctl addif br-ethN $1,
>> where $ is the tap device created)
>> This should work perfectly fine with your existing NW setup.
>> For a quick reference use: http://www.linux-kvm.org/page/Networking
> 
> Thanks for your help, but... I am still not able to get it to work the way I 
> want.
> This is what I have don so far:
> brctl addbr br-eth1
> brctl addbr br-eth3
> 
> ip link set eth1 up
> ip link set eth3 up
> 
> brctl addif br-eth1 eth1
> brctl addif br-eth3 eth3
> 
> tunctl -b -t qtap1
> tunctl -b -t qtap3
> 
> brctl addif br-eth1 qtap1
> brctl addif br-eth3 qtap3
> 
> ifconfig qtap1 up 0.0.0.0 promisc
> ifconfig qtap3 up 0.0.0.0 promisc
> 
> # ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:0d:88:52:51:24
>           inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:443638 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:758540 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:47041686 (44.8 MiB)  TX bytes:990115354 (944.2 MiB)
>           Interrupt:19 Base address:0xec00
> 
> eth1      Link encap:Ethernet  HWaddr 00:0d:88:52:51:25
>           inet addr:192.168.4.1  Bcast:192.168.4.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:6 errors:0 dropped:0 overruns:0 carrier:6
>           collisions:0 txqueuelen:1000
>           RX bytes:0 (0.0 B)  TX bytes:360 (360.0 B)
>           Interrupt:18 Base address:0xe880
> 
> eth3      Link encap:Ethernet  HWaddr 00:0d:88:52:51:27
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:0 (0.0 B)  TX bytes:240 (240.0 B)
>           Interrupt:16 Base address:0xe480
> 
> qtap1     Link encap:Ethernet  HWaddr 26:c0:de:df:c5:e4
>           UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
>           RX packets:351 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:500
>           RX bytes:14742 (14.3 KiB)  TX bytes:0 (0.0 B)
> 
> qtap3     Link encap:Ethernet  HWaddr 26:3e:ba:2d:97:bc
>           UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
>           RX packets:6 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:500
>           RX bytes:252 (252.0 B)  TX bytes:0 (0.0 B)
> 
> 
> # brctl show
> bridge name     bridge id               STP enabled     interfaces
> br-eth1         8000.000d88525125       no              eth1
>                                                         qtap1
> br-eth3         8000.000d88525127       no              eth3
>                                                         qtap3
> 
> 
> This is the way I start the guest:
> kvm -net nic,vlan=1,model=rtl8139,macaddr=52:54:00:12:34:56 -net 
> tap,vlan=1,ifname=qtap1,script=no,downscript=no -net 
> nic,vlan=3,model=rtl8139,macaddr=52:54:00:12:34:58 -net 
> tap,vlan=3,ifname=qtap3,script=no,downscript=no Robbie.img -m 1024
> 
> 
> The eth3/br-eth3/qtap3 looks OK (I can ping the "default-GW" on that network 
> from the guest) but the connection to the "shared" interface (eth1/br-
> eth1/qtap1) does not work, I can not ping or ssh to/from the guest from/to 
> the 
> host. Do not ask me if I can ping any other host on that network - there are 
> no other host on the network yet, just the Host and the guest.
> 
> Any suggestions?
eth1 should not have an IP address:
# ifconfig eth1 0.0.0.0

br-eth1 is not activated (it's missing in `ifconfig`), and it needs an
IP address:
# ifconfig br-eth1 192.168.2.1/24

Even if it works I would explicitly activate br-eth3 too:
# ifconfig br-eth3 0.0.0.0 up

Looking at the output of `ifconfig` shows that the IP-address of eth0
(192.168.1.3) doesn't match 192.168.1.1 from your address list, and eth1
(192.168.4.1) is in a different network than the specified 192.168.2.1/24.

HTH,
Bernhard

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to