[CentOS-virt] Network Bridgeing

Mon Jun 9 20:44:17 UTC 2014
Zoltan Frombach <zoltan at frombach.com>

I didn't know you were using a DHCP server... Can you set a static IP on 
your Windows guest instead? ( With the configuration I suggested. )
I believe that would solve your problem.

In my host I do not have a virbr0 bridge, I only have br0
So probably you should remove virbr0
Same goes for eth0:1 which should be removed. ( Do not create an alias 
interface on eth0 if you make it belong to br0 )

Also, you should add (or change)
NM_CONTROLLED=no
in both your /etc/sysconfig/network-scripts/ifcfg-eth0 and 
/etc/sysconfig/network-scripts/ifcfg-br0 files.

I do have ipv6 completely disabled in my host config which you can 
achieve by adding
IPV6INIT=no
IPV6_AUTOCONF=no
lines to /etc/sysconfig/network-scripts/ifcfg-eth0 and 
/etc/sysconfig/network-scripts/ifcfg-br0 files

As an example, here is my working 
/etc/sysconfig/network-scripts/ifcfg-eth0 file:

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Ethernet
HWADDR=xx:xx:xx:xx:xx:xx   <= your physical NIC's MAC goes here
BRIDGE=br0
USERCTL=no
IPV6INIT=no
IPV6_AUTOCONF=no

and my /etc/sysconfig/network-scripts/ifcfg-br0 file:

DEVICE=br0
BOOTPROTO=static
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Bridge
IPADDR=xxx.xxx.xxx.xxx   <= the IP you want to use for your host goes here
NETMASK=255.255.255.xxx   <= your netmask goes here
GATEWAY=xxx.xxx.xxx.xxx  <= your gateway goes here
DNS1=8.8.8.8
DNS2=8.8.4.4
PEERDNS=yes
DELAY=0
STP=off
USERCTL=no
IPV6INIT=no
IPV6_AUTOCONF=no

And I set a static IP in Windows, for DNS I use Google Public DNS:
( https://developers.google.com/speed/public-dns/docs/using )

8.8.8.8
8.8.4.4

In Virtual Machine Manager, my Windows guest's NIC is configured as
Network Source: Specify shared device name
       Bridge Name: br0
Device model: virtio
MAC address: Here I have an auto generated unique MAC address to be used 
for this VM only!

In Windows, install the latest virtio drivers which you can download 
from here:
http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers

Zoltan

On 6/9/2014 9:38 PM, Ing. Ramon Resendiz wrote:
>
> Hi Zoltan,
>
> I did the eth0 bridge to br0. As you explain i did the assignment the 
> ip from eth0 to the br0 interface. And is working I could ping between 
> interface from IP eth0 (br0) to VM and from VM to IP eth0. As well I 
> tried to configure my VM with the valid IP address and the 
> connectivity loss until I get back to the original configuration (dhcp).
>
> *Here is my ifconfig output*:
>
> br0 Link encap:Ethernet  HWaddr 00:26:9E:XX:XX:XX
>
> inet addr:208.66.XX.XX  Bcast:208.66.XX.XX Mask:255.255.255.248
>
> inet6 addr: fe80::226:9eff:fe82:5538/64 Scope:Link
>
>      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>
> RX packets:8096 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:10438 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:0
>
> RX bytes:629208 (614.4 KiB)  TX bytes:6818121 (6.5 MiB)
>
> eth0 Link encap:Ethernet  HWaddr 00:26:9E:XX:XX:XX
>
> inet6 addr: fe80::226:9eff:fe82:5538/64 Scope:Link
>
> UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>
> RX packets:6768417 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:1952736 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:1000
>
> RX bytes:9696354264 (9.0 GiB)  TX bytes:305746274 (291.5 MiB)
>
> Memory:df6e0000-df700000
>
> eth0:1 Link encap:Ethernet  HWaddr 00:26:9E:XX:XX:XX
>
> UP BROADCAST RUNNING 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:0
>
> collisions:0 txqueuelen:1000
>
> RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)
>
> Memory:df6e0000-df700000
>
> eth1 Link encap:Ethernet  HWaddr 00:26:9E:XX:XX:XX
>
> UP BROADCAST MULTICAST  MTU:1500  Metric:1
>
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:1000
>
> RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
>
> Memory:df660000-df680000
>
> 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:312493 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:312493 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:0
>
> RX bytes:188275585 (179.5 MiB)  TX bytes:188275585 (179.5 MiB)
>
> virbr0 Link encap:Ethernet  HWaddr 52:54:00:ED:EC:C7
>
> 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:67131 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:110832 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:0
>
> RX bytes:4087482 (3.8 MiB)  TX bytes:163016646 (155.4 MiB)
>
> vnet0 Link encap:Ethernet  HWaddr FE:54:00:85:AE:AF
>
> inet6 addr: fe80::fc54:ff:fe85:aeaf/64 Scope:Link
>
> UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>
> RX packets:2735 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:54661 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:500
>
> RX bytes:292355 (285.5 KiB)  TX bytes:2884496 (2.7 MiB)
>
> *Here is my brctrl show:*
>
> bridge name     bridge id               STP enabled     interfaces
>
> br0 8000.00269e825538       no              eth0
>
> virbr0 8000.525400edecc7       yes             virbr0-nic
>
> vnet0
>
> *Here is my vm network config (Windows Server 2003 Standard x64)*:
>
> Windows IP Configuration
>
> DHCP: Yes
>
> IP Address: 192.168.122.77
>
> Subnet Mask: 255.255.255.0
>
> Default Gateway: 192.168.122.1
>
> DHCP Server: 192.168.122.1
>
> DNS Server: 192.168.122.1
>
> *De:*centos-virt-bounces at centos.org 
> [mailto:centos-virt-bounces at centos.org] *En nombre de *Zoltan Frombach
> *Enviado el:* lunes, 09 de junio de 2014 01:03 a.m.
> *Para:* Discussion about the virtualization on CentOS
> *Asunto:* Re: [CentOS-virt] Network Bridgeing
>
> You need to add eth0 to the bridge (br0) which you already did. But do 
> NOT assign an IP address to eth0. Instead, assign the host's IP to br0.
> Then just use another of your IPs for your VM (which can also be 
> called eth0 inside your VM).
> This way your host and your VM(s) can communicate with each other via 
> the bridge.
>
> Note: If you want to use more than one IP address to access your host, 
> then create alias interfaces on the host for the bridge such as br0:0, 
> br0:1, etc.
> Do not create alias interfaces on eth0. Also do not create an alias 
> interface on your host for the IP(s) which you'll be using inside your 
> VM(s).
>
> I hope this helps.
>
> On 6/9/2014 2:30 AM, Ing. Ramon Resendiz wrote:
>
>     Hi,
>
>     I have the following issue i recently installed a VM with qemu and
>     libvirtd, everything is almost ok. The problem is that i have 5
>     usable IP address (valid ip address on internet) for eth0, and i
>     want to use one of this IP for my VM (Windows 2008 Standard R2 by
>     the way). I did the bridge between my eth0 and br0, the VM could
>     browse into internet and download patches, etc. etc.
>
>     I tried to use a networking alias, this is the network interface
>     eth0 assign a IP address and for the eth0:1 assign other IP
>     address, and this bridged to the br0 instead of eth0 to eth0:1;
>     after restart the network service the connectivity lost, and then
>     get in back the original configuration everything seems to work
>     again. But my goal is not archived.
>
>     Goal:
>
>     eth0 must have a valid ip address to be accesed, eth0:1 (bridged
>     to br0) must have a valid address to be assigned to the VM.
>     Through iptables assign ACL to each IP address (valid IP address)
>     depending of the services to host (web server and db server,  rdp
>     host) and between interfaces could be possible to communicate
>     between them (virtual host and virtual machine).
>
>     eth0: Virtual Host
>
>     eth0:1: Virtual  machine (bridged to br0)
>
>     Thank you very much for you time.
>
>     Best regards,
>
>     RR
>
>
>
>
>     _______________________________________________
>
>     CentOS-virt mailing list
>
>     CentOS-virt at centos.org  <mailto:CentOS-virt at centos.org>
>
>     http://lists.centos.org/mailman/listinfo/centos-virt
>
>
>
> _______________________________________________
> CentOS-virt mailing list
> CentOS-virt at centos.org
> http://lists.centos.org/mailman/listinfo/centos-virt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-virt/attachments/20140609/f50ceaeb/attachment-0006.html>