Results 1 to 7 of 7

Thread: Configuring bridge for KVM with single interface

  1. #1
    Join Date
    Jun 2008
    Location
    The Netherlands
    Posts
    249

    Default Configuring bridge for KVM with single interface

    I just wanted to write this down for anyone spending half a morning on this problem.

    For KVM I configured a bridge with YAST. After saving the config I lost connection to the server. With a rescue tool I could mount / and noticed that the file ifroute-eth0 was still there, but YAST didn't made ifroute-br0 containing the gateway. During the initial bridge configuration I tried to change the route in YAST after configuring the bridge I wanted to change the route interface from eth0 to br0 but I couldn't because, of course, br0 didn't exist yet.

    So to me it seems like a small YAST problem, which can be prevented by creating the ifroute-br0 in /etc/sysconfig/network containing the text default GATEWAY - br0 before you start creating the bridge.

    Also the SUSE documentation explaining how to set up bridging for KVM failed to point this out.

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,109
    Blog Entries
    2

    Default Re: Configuring bridge for KVM with single interface

    Although I haven't done it this way (I generally prefer to create my bridge devices using libvirt (vm manager) instead of YaST), I imagine what you describe can be done entirely within YaST...

    - Create the Bridge device (device br0) in YaST, then
    - Go to the routing tab (still in Network Settings, same place where you created the Bridge device) and configure. You should see br0 in the dropdown at the far right of your IPv4 routing gateway.

    But, for most people this can be completely avoided if you installed KVM properly... using the YaST "Install Virtualization" module. The module will step through a number of automated steps, including offering to create a default br0 (which would be bound to your exisitng network interface and configured as a network bridging device).

    As a last resort, you can do also do all this using the command "brctl."
    Even if you created your bridge devices some other way, you should become familiar with brctl for listing your bridge devices and some minimal configuration settings (eg spanning).

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3

    Default Re: Configuring bridge for KVM with single interface

    Quote Originally Posted by tsu2 View Post
    But, for most people this can be completely avoided if you installed KVM properly... using the YaST "Install Virtualization" module. The module will step through a number of automated steps, including offering to create a default br0 (which would be bound to your existing network interface and configured as a network bridging device).
    Is there a way to run only that last part of "Install Virtualization" module, that is convert interfaces to bridges, some time later? (Let's say that at the moment I was not comfortable with automated conversion, but later changed my mind).

    I suppose I can un-install KVM or LXC, then re-install it, but maybe there is a shortcut?


    Best regards,
    Sinisa

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,109
    Blog Entries
    2

    Default Re: Configuring bridge for KVM with single interface

    There is actually no "conversion"
    A br0 interface is every much a real software network interface as eth0 for example.

    Bridge interface are tied to, or associated with physical interfaces to enable access to the outside world.

    And, bridge interfaces can be managed and manipulated without using YaST or libvirt tools, you can use brctl.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  5. #5

    Default Re: Configuring bridge for KVM with single interface

    Quote Originally Posted by tsu2 View Post
    There is actually no "conversion"
    A br0 interface is every much a real software network interface as eth0 for example.

    Bridge interface are tied to, or associated with physical interfaces to enable access to the outside world.

    And, bridge interfaces can be managed and manipulated without using YaST or libvirt tools, you can use brctl.

    TSU
    I know what bridge is, I know how to "convert" physical interfaces to bridge by hand (and by using Yast), I was just wondering if there was a way to run only the last stage of "yast2 virtualization" where it converts all of the physical interfaces to bridges, just to save some time and reduce the possibility of mistakes...

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,109
    Blog Entries
    2

    Default Re: Configuring bridge for KVM with single interface

    KvM publishes a document describing many ways to set up networking...
    https://www.linux-kvm.org/page/Networking

    But,
    If you want to set up networking in the most flexible manner, ie re-using network objects,
    No interfaces are "converted" into any other kind of interface.

    There is a clear layered model where the physical network interfaces (eg eth0, wlan0) are associated with physical hardware network devices.
    Bridge devices eg. br0, virbr0 exist in their own layer and are often used to connect to the physical network interfaces. When a bridge device isn't associated with a physical interface, then that bridge device represents a "Host-only" network where any virtualized hosts on the same physical machine can communicate with each other but not any other machine not on the same machine.
    This networking model has the advantage in that each bridge device represents a particular virtual network with its own network settings, IP range and possibly its own DHCP server... So this makes it simple for any machine to participate in the same network by simply pointing to the same bridge device.

    If you understand this networking model, you can apply this concept almost universally across most/all virtualizations technologies... ie Anything managed by libvirt, KVM, Xen, VMware, Virtualbox, Hyper-V and the list goes on. Docker is the only major isolation technology I know that configures networking differently.

    If you want to do something different, the KVM article I referenced more or less is willing to say "whatever works, go ahead and do it" and describes several different ways networking can be set up. But unless there is a special reason to do so (eg I've had to configure wireless without using a bridge device to support aircrack-ng), I'd advise doing your networking like 99% of the rest of the world.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  7. #7
    Join Date
    Jun 2008
    Location
    The Netherlands
    Posts
    249

    Default Re: Configuring bridge for KVM with single interface

    Ok it's working now.

    To answer some questions,

    libvirt was running fine for the last 2 years. For testing purposes I stop and disabled the daemon.
    Today I finished copying my VM's from the machine and I reinstalled the OS and it didn't work. I also installed CentOS and this failed also when starting the bridge config.
    Then I reinstalled TW and tried some other stuff, nothing worked. About two hours ago I requested the service provider to swap the hardware and they did, I so love Hetzner..

    I installed TW, configured the bridge. As usual Yast failed to change the default gateway from eth0 to br0 so I had to do this manually via the rescue system. This is 'normal' I made a post about this couple of years ago. I rebooted and... it worked! Finally! I am copying back my VM's as we speak.

    I really don't see how loading a bridge config could fail like that on the server. Like I said in the beginning, the old server actually rebooted a couple of times when loading the bridge config.

    So thanks everyone for the suggestions. I did learn a lot the couple of days, but I'm tired as **** now... I need to get this up and running before Monday.

    o/ <3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •