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

Re: [libvirt-users] I have ping through bridge , net has been started , But IPs they're not equivalent.

On 04/28/2016 10:44 PM, Mohsen Pahlevanzadeh wrote:
Dear All,

I have the following configuration and I have ping from bridge :

iface eth0 inet static
auto ivbr0
iface ivbr0 inet static
        bridge_ports eth0
        bridge_stp on
        bridge_maxwait 0
        bridge_fd 0

You misunderstood the instructions for putting your ethernet behind a bridge.

You should *never* give an IP address to both the bridge and the ethernet device that is attached to it. If an ethernet is attached to a bridge, remove *all* IP config information for the ethernet. For debian/ubuntu this means removing the entire "iface eth0" section. If you read the instructions on the wiki page carefully, you'll see that it is telling you to *replace* the line that says "iface eth0 ...." with one that says "iface br0...", *not* to add an entire new section for the bridge while leaving the section for eth0 intact.

# brctl show
bridge name    bridge id        STP enabled    interfaces
ivbr0        8000.18037360b44e    yes        eth0
my network xml file :
  <forward mode='nat'>
       <interface dev="eth0" />
  <bridge name='ivbr0' stp='on' delay='0' />
<mac address='52:54:00:0f:f4:f0'/>
  <ip address='' netmask=''>
      <range start='' end=''/>

You have misunderstood the working of libvirt's virtual networks. You should *not* assign a bridge device that is already in the host system's network config to be used by a libvirt virtual network with a forward mode of nat, route (or no forward mode). libvirt creates the bridges for those types of networks itself, and they should *never* be listed in the system's network config.

Since you've mixed the use of a host-system-managed bridge (normally used when you want the guests to have an IP address that is visible/reachable directly from the physical network) with a libvirt-managed virtual network in NAT mode (normally used when the guest will only be used for outbound traffic (+ incoming only from the host)), I'm not sure which you want.

1) If you want the guests to be directly on the physical network, do this:

* edit /etc/network/interfaces and *remove* the entire section that starts with "interface eth0 inet static"

* "virsh net-edit myintranet" and change it to this:

  <forward mode='bridge'/>
  <bridge name='ivbr0'/>

(this make the libvirt network a simple unmanaged (by libvirt) pointer to an existing bridge named ivbr0. All bridge device configuration will be handled by the host system network config.)

* virsh net-destroy myintranet && ifup ivbr0 && virsh net-start myintranet && virsh net-autostart myintranet

(ifup ivbr0 will restore the system IP config of the bridge)

Any guests connected to this network will be connected directly to the physical network (assuming that ivbr0 is functioning properly)

2) If, on the other hand, you wanted your guests to be connected to a network that was NATed behind the host system's physical IP address, and be unreachable for incoming connections anywhere beyond the host, you should do this:

* edit /etc/network/interfaces and *remove* either the entire section that starts with "interface eth0 inet static" (if you want to maintain the option of connecting some guests directly to the physical network) *OR* the entire section that starts with "auto ivbr0" (if you don't want the option of connecting guests directly to the physical network).

* "virsh netedit myintranet" and make the following changes:

   * remove this line:   <interface dev="eth0" />
   * remove this line:  <bridge name='ivbr0' blah blah/>
   * correct the ending address of the dhcp range:
         <range start='' end=''/>
     (I'm surprised that didn't generate an error)

* virsh net-destroy myintranet && ifup ivbr0 && virsh net-start myintranet && virsh net-autostart myintranet

This will restart the myintranet network using a new bridge device (automatically named and created by libvirt), as well as restoring the original ivbr0 interface (or eth0 interface, depending on which section you removed from /etc/network/interfaces)

Now , I have ping of my modem and internet.
Then I did the following command :
# ip l set dev ivbr0 down
# brctl delbr ivbr0
# virsh net-start myintranet
Network myintranet started

According to above , myintranet network has been started. But with the following IP address :
# ip a show dev ivbr0
17: ivbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 52:54:00:0f:f4:f0 brd ff:ff:ff:ff:ff:ff
    inet brd scope global ivbr0
       valid_lft forever preferred_lft forever
//////// ?
Question is , Where I change this address?(I set in myxml file.)

Did you edit the files in /etc/libvirt directly? You should never do that. Only edit them via virsh net-edit (or some other program that uses the libvirt API to retrieve and save the config).

--best regards

libvirt-users mailing list
libvirt-users redhat com

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