On 01/17/2012 02:57 PM, Jorge Fábregas wrote: > Hello everyone, > > I'm learning about bridged networking and how it is applied to virtual > environments (bypassing all the automation provided by libvirtd etc) . > I have a question regarding ip configuration for the virtual bridge. > > Let's say I have a host (my machine) where I want to run 3 VMs bridged > to my home network (thru eth0). I have a DHCP server running on my DSL > router, and I have dhcp enabled on my 3 VMs so they all should get a > lease from the DHCP. > > As far as a I know these are the raw steps needed to accomplish this: > > 1- create br0 > 2- remove current ip address from eth0 > 3- enslave eth0 to br0 > 4- create tap devices > 5- attach tap devices to br0 > 6- assign tap devices to every VM > > As you can see I haven't assigned an ip address to the virtual bridge > (br0). Why is it that (on almost any site that I visit with this setup) > they always end up assigning an ip address to br0? > > Thanks in advance! > Jorge > _______________________________________________ > virt mailing list > virt@lists.fedoraproject.org > https://admin.fedoraproject.org/mailman/listinfo/virt There should be no reason to use tap devices as the bridge device can be assigned as a network controller like so:
<interface type='bridge'> <mac address='52:54:00:22:92:24'/> <source bridge='br0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <interface type='bridge'> <mac address='52:54:00:7c:0c:db'/> <source bridge='br1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> Using virtmanager to create the network interface would add the above tags and attributes to the guest's config file by creating a Bridge type interface. Assign the host's IP addresses to the brX devices: br0 Link encap:Ethernet HWaddr BC:AE:C5:BE:07:DD inet addr:ww.xxx.yyy.zz Bcast:ww.xxx.yyy.yy Mask:255.255.255.240 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:28384 errors:0 dropped:0 overruns:0 frame:0 TX packets:16265 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:34899139 (33.2 MiB) TX bytes:2018000 (1.9 MiB) It would look like eth0 on the guest. And the guest IP address to ethX: eth0 Link encap:Ethernet HWaddr 52:54:00:1B:A4:E6 inet addr:ww.xxx.yyy.xz Bcast:ww.xxx.yyy.yy Mask:255.255.255.240 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3291 errors:0 dropped:0 overruns:0 frame:0 TX packets:2140 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:995099 (971.7 KiB) TX bytes:414119 (404.4 KiB) Interrupt:11 On the host ifcfg-br0: DEVICE="br0" TYPE="Bridge" BOOTPROTO="none" ONBOOT="yes" DELAY=0 GATEWAY="ww.xxx.yyy.zz" IPADDR="ww.xxx.yyy.zx" NETMASK="255.255.255.240" IPV6INIT=no On the host ifcfg-eth0: DEVICE="eth0" HWADDR="00:00:00:00:00:00" ONBOOT="yes" BRIDGE="br0" IPV6INIT=no On the guest ifcfg-eth0: DEVICE="eth0" BOOTPROTO="none" HWADDR="52:54:00:22:92:24" ONBOOT="yes" IPADDR="ww.xxx.yyy.xz" NETMASK="255.255.255.240" GATEWAY="ww.xxx.yyy.zx" DNS1="ww.xxx.yyy.xx" Emmett _______________________________________________ virt mailing list virt@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/virt