• Re: virt-manager and networking

    From Marco Moock@21:1/5 to All on Fri Jun 6 20:50:01 2025
    On 06.06.2025 20:20 Uhr Charles Curley wrote:

    Is it possible to set things up so that the virtual machines are on
    the same network as the host machine? The host is on
    192.168.100.0/24. Can I have the virtual machines also on
    192.168.100.0?

    This is called bridge. IIRC you have to set up a bridge on the system
    and then attach it. I've never managed to make that work, so I kept
    using virtualbox.

    --
    kind regards
    Marco

    Send spam to 1749234001muell@stinkedores.dorfdsl.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charles Curley@21:1/5 to All on Fri Jun 6 20:20:01 2025
    I'm setting up a new machine running trixie to run virtual machines,
    using virt-manager. virt-manager sets up a natted network for the
    virtual machines.

    Is it possible to set things up so that the virtual machines are on the
    same network as the host machine? The host is on 192.168.100.0/24. Can
    I have the virtual machines also on 192.168.100.0?

    Thank you.

    --
    Does anybody read signatures any more?

    https://charlescurley.com
    https://charlescurley.com/blog/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Ritter@21:1/5 to Marco Moock on Fri Jun 6 21:20:01 2025
    Marco Moock wrote:
    On 06.06.2025 20:20 Uhr Charles Curley wrote:

    Is it possible to set things up so that the virtual machines are on
    the same network as the host machine? The host is on
    192.168.100.0/24. Can I have the virtual machines also on
    192.168.100.0?

    This is called bridge. IIRC you have to set up a bridge on the system
    and then attach it. I've never managed to make that work, so I kept
    using virtualbox.


    # The primary (real) network interface
    allow-hotplug enx3
    iface enx3 inet manual

    auto br0
    iface br0 inet static
    address 192.168.100.2/24
    gateway 192.168.100.1
    bridge_ports enx3
    bridge_maxwait 1
    bridge_stp off
    bridge_fd 0

    ---

    after a reboot, the br0 interface has eaten your enx3 NIC and
    anything that you thought you should do to enx3 at an IP level,
    do for br0 instead.

    -dsr-

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charles Curley@21:1/5 to Marco Moock on Fri Jun 6 22:00:01 2025
    On Fri, 6 Jun 2025 20:22:16 +0200
    Marco Moock <mm@dorfdsl.de> wrote:

    This is called bridge. IIRC you have to set up a bridge on the system
    and then attach it.

    So it appears. And I get contradictory advice on how to do it when
    searching. Some of it, fairly recent, just flat out fails.

    I've never managed to make that work, so I kept using virtualbox.

    Fair enough. vortualbox is in sid but not trixie, so I'm going to defer
    that suggestion for now. (I figure I can get it from upstream, but
    prefer to stick with Debian provided packages.)

    Thanks.

    --
    Does anybody read signatures any more?

    https://charlescurley.com
    https://charlescurley.com/blog/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew M.A. Cater@21:1/5 to Charles Curley on Fri Jun 6 22:10:01 2025
    On Fri, Jun 06, 2025 at 01:51:46PM -0600, Charles Curley wrote:
    On Fri, 6 Jun 2025 20:22:16 +0200
    Marco Moock <mm@dorfdsl.de> wrote:

    This is called bridge. IIRC you have to set up a bridge on the system
    and then attach it.

    So it appears. And I get contradictory advice on how to do it when
    searching. Some of it, fairly recent, just flat out fails.

    I've never managed to make that work, so I kept using virtualbox.

    Fair enough. vortualbox is in sid but not trixie, so I'm going to defer
    that suggestion for now. (I figure I can get it from upstream, but
    prefer to stick with Debian provided packages.)


    Because of issues with upstream and attitudes to security patching, virtualbox is in sid but *won't* go to testing at all so for anybody reading this -
    don't wait for virtualbox to migrate from unstable to testing.

    Andy
    (amacater@debian.org)

    Thanks.

    --
    Does anybody read signatures any more?

    https://charlescurley.com
    https://charlescurley.com/blog/


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Paoli@21:1/5 to charlescurley@charlescurley.com on Sun Jun 8 09:30:01 2025
    Yes, mostly as others have reported in replies to your post.

    The key bit is bridge - and I suspect this will never become the
    as-shipped configuration by default, because of potential complications, security, etc.

    So bridge, you'll almost certainly need the relevant package(s), e.g. bridge-utils. I've always done this without Network Manager, using
    instead the basic if-up, if-down, /etc/network/interfaces, etc. Your
    results may vary in those regards (not sure how capable Network Manager
    is or would be for such, but I'd guess it ought be sufficiently
    capable).

    So, bridge, as other(s) have pointed out, wired Ethernet interface,
    might be possible on (some) Wi-Fi, but many Wi-Fi interfaces and/or
    their APs/routers thereof won't handle/allow it or pass the relevant
    traffic, etc.

    So, key bits with bridge, you can have multiple IP addresses on bridge, different subnets, etc., and likewise also tie multiple interfaces on
    same bridge - the latter bit is the key point - they all have access to
    that same traffic (for better and/or worse), possibly excepting if you
    do some types of filtering on them (e.g. specific firewalling).

    So, example, I've got physical interface eth0 (yeah, old school name, I
    got tired of the interface name changing every time the hardware
    changed in the slightest or even BIOS/CMOS/NVRAM was updated or settings
    were changed, even with same Ethernet MAC address ... so ... I added
    udev rule to pin the name to eth0), it's got direct raw Internet access
    ... it also has DHCP/ra, and possibly also DHCP6 servers on it, though
    those automated means will give RFC-1918 IPv4 IPs that are behind
    (external to the host) router NAT, but it gets raw direct unfiltered
    Internet IPv6, and Internet IPv4 is directly available also if so
    (statically) configured for it.

    So, the bridge configuration, example from this host (and in libvirt &
    friends, I use both the default NAT and my bridged configuration,
    depending what I want for the VM). Relevant bits from
    /etc/network/interfaces, and I omit showing some workarounds for an
    apparently still present bug in the kernel's driver for the interface,
    and also some IPv6 and other stuff to disable certain autoconfiguration:

    auto br0
    iface br0 inet static
    bridge_waitport 0
    bridge_ports eth0
    address 96.86.170.226
    netmask 255.255.255.248
    network 96.86.170.224
    broadcast 96.86.170.231
    gateway 96.86.170.230

    auto br0:0
    allow-hotplug br0:0
    iface br0:0 inet static
    address 10.1.10.2/24
    netmask 255.255.255.0

    auto br0:1
    allow-hotplug br0:1
    iface br0:1 inet static
    address 192.168.55.1
    netmask 255.255.255.0

    Note that the address of the physical host goes not on eth0, but on br0.
    I also have multiple subnets on that interface. So, basically any
    interface I bridge to that bridge interface can potentially talk
    directly to and is very much on, all those subnets (if I want/need to
    filter that out, there are other ways to do that).

    So, on to libvirt & friends:

    In virt-manager for, e.g. VM using bridge (br0) rather than default:
    Show virtual hardware details (bulb icon)
    click on the NIC
    Details
    Virtual Network Interface
    Network source: bride device...
    Device name: br0

    $ virsh dumpxml balug | sed -ne '/<interface /,/<\/interface>/p'
    <interface type='bridge'>
    <mac address='52:54:00:13:51:99'/>
    <source bridge='br0'/>
    <target dev='vnet0'/>
    <model type='virtio'/>
    <alias name='net0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

    I typically build the VMs by copying, modifying, and running TEMPLATE
    program I wrote:
    https://www.mpaoli.net/~root/bin/TEMPLATE
    which then leverages virt-install

    Anyway, different VMs I'll set up different ways, depending what I
    want/need. Some I'll put on the bridged interface, some on NAT, some
    I'll even give two interfaces and put one on each, and depending what I need/want on each, I may do autoconfiguration of IPv4 and/or IPv6, or
    they may be manually/"static" configurations - or even some of both for
    same protocol and interface, and even different subnets, notably as the
    br0 interface has multiple subnets on it.

    And yes, allows me to do fairly complex network things. E.g. I've got quasi-"production" VM that typically has uptime exceeding the physical
    hosts it resides on. As needed/desired, I live migrate it between the
    two physical hosts - same Internet IP addresses, Ethernet MAC address,
    etc., and with the lovely --copy-storage-all, it all manages that
    without the two physical hosts even having any physical storage in
    common, with virsh, etc. handling the data copy sync and transfer over
    the network (and secured over ssh). So, yeah, balug.org - the VM
    hosting that and fair number of other domains/sites ... yes, it live
    migrates between physical hosts.

    On Fri, Jun 6, 2025 at 11:11 AM Charles Curley <charlescurley@charlescurley.com> wrote:

    I'm setting up a new machine running trixie to run virtual machines,
    using virt-manager. virt-manager sets up a natted network for the
    virtual machines.

    Is it possible to set things up so that the virtual machines are on the
    same network as the host machine? The host is on 192.168.100.0/24. Can
    I have the virtual machines also on 192.168.100.0?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charles Curley@21:1/5 to Charles Curley on Thu Jun 19 18:10:02 2025
    On Fri, 6 Jun 2025 12:10:25 -0600
    Charles Curley <charlescurley@charlescurley.com> wrote:

    I'm setting up a new machine running trixie to run virtual machines,
    using virt-manager. virt-manager sets up a natted network for the
    virtual machines.

    Is it possible to set things up so that the virtual machines are on
    the same network as the host machine? The host is on
    192.168.100.0/24. Can I have the virtual machines also on
    192.168.100.0?

    Thank you.


    I never did get what I wanted. I run Network Manager on almost all my
    systems, including this host. I did create a bridge in Network
    Manager, using these instructions as a basis: https://askubuntu.com/questions/62027/how-do-i-bridge-network-interfaces https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-an-ethernet-connection_configuring-and-managing-networking#configuring-an-ethernet-connection-by-using-nmtui_configuring-an-ethernet-
    connection

    To make this work, you specify one component of the bridge, the
    Ethernet IF, in NM. You specify the other device(s) in Virtual Machine
    Manager.

    Neither set of directions worked. So for now I'm giving this up as a
    bad job.

    I did find out that bridges don't work over some wifi connections for
    technical reasons.

    Due to the IEEE 802.11 standard which specifies the use of
    3-address frames in Wi-Fi for the efficient use of airtime, you
    cannot configure a bridge over Wi-Fi networks operating in Ad-Hoc
    or Infrastructure modes.

    https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-a-network-bridge_configuring-and-managing-networking

    --
    Does anybody read signatures any more?

    https://charlescurley.com
    https://charlescurley.com/blog/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)