Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #227117 > unrolled thread

libvirt guest bridge configuration

Started byLucio Crusca <lucio@sulweb.org>
First post2020-09-19 00:20 +0200
Last post2020-09-19 23:30 +0200
Articles 15 — 6 participants

Back to article view | Back to linux.debian.user


Contents

  libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-19 00:20 +0200
    Re: libvirt guest bridge configuration Dan Ritter <dsr@randomstring.org> - 2020-09-19 01:00 +0200
      Re: libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-19 08:30 +0200
        Re: libvirt guest bridge configuration Fabien Roucaute <fabien.roucaute@free.fr> - 2020-09-19 10:10 +0200
          Re: libvirt guest bridge configuration Reco <recoverym4n@enotuniq.net> - 2020-09-19 10:20 +0200
          Re: libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-19 10:30 +0200
            Re: libvirt guest bridge configuration Fabien Roucaute <fabien.roucaute@free.fr> - 2020-09-19 10:50 +0200
              Re: libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-19 14:40 +0200
                Re: libvirt guest bridge configuration Fabien Roucaute <fabien.roucaute@free.fr> - 2020-09-19 15:30 +0200
                  Re: libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-19 16:10 +0200
                    Re: libvirt guest bridge configuration Fabien Roucaute <fabien.roucaute@free.fr> - 2020-09-19 16:50 +0200
                      [SOLVED] Re: libvirt guest bridge configuration Lucio Crusca <lucio@sulweb.org> - 2020-09-20 12:10 +0200
                        Re: [SOLVED] Re: libvirt guest bridge configuration Lucas Castro <lucas@gnuabordo.com.br> - 2020-09-21 20:20 +0200
    Re: libvirt guest bridge configuration john doe <johndoe65534@mail.com> - 2020-09-19 18:40 +0200
    Re: libvirt guest bridge configuration Lucas Castro <lucas@gnuabordo.com.br> - 2020-09-19 23:30 +0200

#227117 — libvirt guest bridge configuration

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-19 00:20 +0200
Subjectlibvirt guest bridge configuration
Message-ID<AQwTv-36T-1@gated-at.bofh.it>
I'm trying to bridge a network interface between host and guest (both 
Debian Buster+Bullseye+Sid) so that NAT is not needed.

In the host /etc/network/interfaces I've declared a bridge like this:

auto eno1
iface eno1 inet static
   address 2.4.6.8
   netmask 255.255.255.224
   gateway 2.4.6.1
   up route add -net 2.4.6.0 netmask 255.255.255.224 gw 2.4.6.1 dev eno1


auto virbr-dummy
iface virbr-dummy inet manual
     pre-up /sbin/ip link add virbr-dummy type dummy
     up /sbin/ip link set virbr-dummy address 52:54:00:f0:37:ba


auto virbr10
iface virbr10 inet static
     bridge_ports virbr-dummy
     bridge_stp on
     bridge_fd 2
     address 2.4.6.73
     netmask 255.255.255.224
     gateway 2.4.6.65
     broadcast 2.4.6.95
     up route add -net 2.4.6.64 netmask 255.255.255.224 gw 2.4.6.65 dev eno1

Please note that 2.4.6.x are not my real IP addresses, but I've been 
really assigned 2 IP addresses and I want to use one for the host and 
the other for the guest.

Until here it seems to work in that I can ping both addresses. However I 
don't know how I should configure my guest VM interface. There is no 
nat, no DHCP and if I specify the same IP address for the virtualized 
interface as the host bridge it's connecting to, it doesn't even detect 
any link.

The guest was created with:

# virt-install --network bridge=virbr10,model=virtio ...

Please help.

[toc] | [next] | [standalone]


#227118

FromDan Ritter <dsr@randomstring.org>
Date2020-09-19 01:00 +0200
Message-ID<AQxwd-3jJ-3@gated-at.bofh.it>
In reply to#227117
Lucio Crusca wrote: 
> I'm trying to bridge a network interface between host and guest (both Debian
> Buster+Bullseye+Sid) so that NAT is not needed.
> 
> In the host /etc/network/interfaces I've declared a bridge like this:
> 
> auto eno1
> iface eno1 inet static
>   address 2.4.6.8
>   netmask 255.255.255.224
>   gateway 2.4.6.1
>   up route add -net 2.4.6.0 netmask 255.255.255.224 gw 2.4.6.1 dev eno1
> 
> 
> auto virbr-dummy
> iface virbr-dummy inet manual
>     pre-up /sbin/ip link add virbr-dummy type dummy
>     up /sbin/ip link set virbr-dummy address 52:54:00:f0:37:ba


> 
> 
> auto virbr10
> iface virbr10 inet static
>     bridge_ports virbr-dummy
>     bridge_stp on
>     bridge_fd 2
>     address 2.4.6.73
>     netmask 255.255.255.224
>     gateway 2.4.6.65
>     broadcast 2.4.6.95
>     up route add -net 2.4.6.64 netmask 255.255.255.224 gw 2.4.6.65 dev eno1

auto eno1
iface eno1 manual

auto virbr10
iface virb10 inet static
  bridge_ports eno1
  bridge_stp off
  address 2.4.6.8
  netmask 255.255.255.224
  gateway 2.4.6.1

the bridge eats the eno1 interface.

The virtual machine setup should add a new bridge_port to the
bridge when it comes up, and remove it when it comes down.

Now the virtual machine interfaces can be on the same network
as the bridge is.

No need for a virbr-dummy.

-dsr-

[toc] | [prev] | [next] | [standalone]


#227120

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-19 08:30 +0200
Message-ID<AQExH-7OF-1@gated-at.bofh.it>
In reply to#227118
Il 19/09/20 00:54, Dan Ritter ha scritto:
> auto eno1
> iface eno1 manual
> 
> auto virbr10
> iface virb10 inet static
>    bridge_ports eno1
>    bridge_stp off
>    address 2.4.6.8
>    netmask 255.255.255.224
>    gateway 2.4.6.1
> 
> the bridge eats the eno1 interface.

Using that configuration it actually brings up eno1 with the correct IP 
address, but I have no bridge at all:

# ifconfig -a
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 2.4.6.8  netmask 255.255.255.224  broadcast 2.4.6.31
         [...]

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
         inet 127.0.0.1  netmask 255.0.0.0
         [...]

# brctl show
#

I'm puzzled: how does it manage to work if there's no bridge at all?

[toc] | [prev] | [next] | [standalone]


#227122

FromFabien Roucaute <fabien.roucaute@free.fr>
Date2020-09-19 10:10 +0200
Message-ID<AQG6t-mM-1@gated-at.bofh.it>
In reply to#227120
Le 19/09/2020 à 08:21, Lucio Crusca a écrit :
> Il 19/09/20 00:54, Dan Ritter ha scritto:
>> auto eno1
>> iface eno1 manual
>>
>> auto virbr10
>> iface virb10 inet static
>>    bridge_ports eno1
>>    bridge_stp off
>>    address 2.4.6.8
>>    netmask 255.255.255.224
>>    gateway 2.4.6.1
>>
>> the bridge eats the eno1 interface.
> 
> Using that configuration it actually brings up eno1 with the correct IP
> address, but I have no bridge at all:
> 
> # ifconfig -a
> eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 2.4.6.8  netmask 255.255.255.224  broadcast 2.4.6.31
>         [...]
> 
> lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
>         inet 127.0.0.1  netmask 255.0.0.0
>         [...]
> 
> # brctl show
> #
> 
> I'm puzzled: how does it manage to work if there's no bridge at all?
> 
eno1 still has an IP address, try to shut it down and up with 'ifdown
eno1;ifup eno1' and see if it still have an IP.

[toc] | [prev] | [next] | [standalone]


#227123

FromReco <recoverym4n@enotuniq.net>
Date2020-09-19 10:20 +0200
Message-ID<AQGg9-qh-1@gated-at.bofh.it>
In reply to#227122
	Hi.

On Sat, Sep 19, 2020 at 10:03:20AM +0200, Fabien Roucaute wrote:
> Le 19/09/2020 à 08:21, Lucio Crusca a écrit :
> > Il 19/09/20 00:54, Dan Ritter ha scritto:
> >> auto eno1
> >> iface eno1 manual
> >>
> >> auto virbr10
> >> iface virb10 inet static
> >>    bridge_ports eno1
> >>    bridge_stp off
> >>    address 2.4.6.8
> >>    netmask 255.255.255.224
> >>    gateway 2.4.6.1
> >>
> >> the bridge eats the eno1 interface.
> > 
> > Using that configuration it actually brings up eno1 with the correct IP
> > address, but I have no bridge at all:
> > 
> > # ifconfig -a
> > eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
> >         inet 2.4.6.8  netmask 255.255.255.224  broadcast 2.4.6.31
> >         [...]
> > 
> > lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
> >         inet 127.0.0.1  netmask 255.0.0.0
> >         [...]
> > 
> > # brctl show
> > #
> > 
> > I'm puzzled: how does it manage to work if there's no bridge at all?
> > 
> eno1 still has an IP address, try to shut it down and up with 'ifdown
> eno1;ifup eno1' and see if it still have an IP.

It won't do anything since now /etc/network/interfaces does not contain an
IP for eno1.

What's actually needed is

ip addr del dev eno1 2.4.6.8/27

Similar thing needs to be done for the routing table.

Reco

[toc] | [prev] | [next] | [standalone]


#227124

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-19 10:30 +0200
Message-ID<AQGpP-tt-7@gated-at.bofh.it>
In reply to#227122

Il 19/09/20 10:03, Fabien Roucaute ha scritto:
> Le 19/09/2020 à 08:21, Lucio Crusca a écrit :
>> Il 19/09/20 00:54, Dan Ritter ha scritto:
>>> auto eno1
>>> iface eno1 manual
>>>
>>> auto virbr10
>>> iface virb10 inet static
>>>     bridge_ports eno1
>>>     bridge_stp off
>>>     address 2.4.6.8
>>>     netmask 255.255.255.224
>>>     gateway 2.4.6.1
>>>
>>> the bridge eats the eno1 interface.
>>
>> Using that configuration it actually brings up eno1 with the correct IP
>> address, but I have no bridge at all:
>>
>> # ifconfig -a
>> eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>>          inet 2.4.6.8  netmask 255.255.255.224  broadcast 2.4.6.31
>>          [...]
>>
>> lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
>>          inet 127.0.0.1  netmask 255.0.0.0
>>          [...]
>>
>> # brctl show
>> #
>>
>> I'm puzzled: how does it manage to work if there's no bridge at all?
>>
> eno1 still has an IP address, try to shut it down and up with 'ifdown
> eno1;ifup eno1' and see if it still have an IP.
> 

Sorry, I forgot to mention the situation above is what I get after reboot.

[toc] | [prev] | [next] | [standalone]


#227125

FromFabien Roucaute <fabien.roucaute@free.fr>
Date2020-09-19 10:50 +0200
Message-ID<AQGJc-zI-3@gated-at.bofh.it>
In reply to#227124
Le 19/09/2020 à 10:24, Lucio Crusca a écrit :
> 
> 
> Il 19/09/20 10:03, Fabien Roucaute ha scritto:
>> Le 19/09/2020 à 08:21, Lucio Crusca a écrit :
>>> Il 19/09/20 00:54, Dan Ritter ha scritto:
>>>> auto eno1
>>>> iface eno1 manual
>>>>
>>>> auto virbr10
>>>> iface virb10 inet static
>>>>     bridge_ports eno1
>>>>     bridge_stp off
>>>>     address 2.4.6.8
>>>>     netmask 255.255.255.224
>>>>     gateway 2.4.6.1
>>>>
>>>> the bridge eats the eno1 interface.
>>>
>>> Using that configuration it actually brings up eno1 with the correct IP
>>> address, but I have no bridge at all:
>>>
>>> # ifconfig -a
>>> eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>>>          inet 2.4.6.8  netmask 255.255.255.224  broadcast 2.4.6.31
>>>          [...]
>>>
>>> lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
>>>          inet 127.0.0.1  netmask 255.0.0.0
>>>          [...]
>>>
>>> # brctl show
>>> #
>>>
>>> I'm puzzled: how does it manage to work if there's no bridge at all?
>>>
>> eno1 still has an IP address, try to shut it down and up with 'ifdown
>> eno1;ifup eno1' and see if it still have an IP.
>>
> 
> Sorry, I forgot to mention the situation above is what I get after reboot.
> 
Yes, there some mistakes in your interface file:
delete the 'auto eno1' and add inet in the line beneath to get that
'iface eno1 inet manual'

[toc] | [prev] | [next] | [standalone]


#227128

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-19 14:40 +0200
Message-ID<AQKjN-2Li-9@gated-at.bofh.it>
In reply to#227125

Il 19/09/20 10:48, Fabien Roucaute ha scritto:
> Yes, there some mistakes in your interface file:
> delete the 'auto eno1' and add inet in the line beneath to get that
> 'iface eno1 inet manual'
> 

After fixing those mistakes and rebooting, the system is not reachable 
anymore. Unfortunately I can only reboot it with a live system, but I 
can't look at it while it runs on that config from remote to tell what's 
wrong with the configuration you suggested.

[toc] | [prev] | [next] | [standalone]


#227129

FromFabien Roucaute <fabien.roucaute@free.fr>
Date2020-09-19 15:30 +0200
Message-ID<AQL69-3gC-5@gated-at.bofh.it>
In reply to#227128
Le 19/09/2020 à 14:38, Lucio Crusca a écrit :

> 
> After fixing those mistakes and rebooting, the system is not reachable
> anymore. Unfortunately I can only reboot it with a live system, but I
> can't look at it while it runs on that config from remote to tell what's
> wrong with the configuration you suggested.
> 
Well sorry, I didn't know you were working on it via the net.
Did you set the firewall (iptables or nftables)?
I have no idea how you can fix the issue without having access to a
console now though.

[toc] | [prev] | [next] | [standalone]


#227130

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-19 16:10 +0200
Message-ID<AQLIS-3Je-13@gated-at.bofh.it>
In reply to#227129

Il 19/09/20 15:23, Fabien Roucaute ha scritto:
> Well sorry, I didn't know you were working on it via the net.
> Did you set the firewall (iptables or nftables)?

No firewall at all.

> I have no idea how you can fix the issue without having access to a
> console now though.

I can actually have a console access over IP via a Lantiq console, but I 
have to know in advance what to do with that, because it's billed per 
hour of use. So, if you know how what I should check when it does not 
work, you can assume there is a console and explain to me what to do.

[toc] | [prev] | [next] | [standalone]


#227131

FromFabien Roucaute <fabien.roucaute@free.fr>
Date2020-09-19 16:50 +0200
Message-ID<AQMlA-3WZ-7@gated-at.bofh.it>
In reply to#227130
Le 19/09/2020 à 16:03, Lucio Crusca a écrit :

> 
> I can actually have a console access over IP via a Lantiq console, but I
> have to know in advance what to do with that, because it's billed per
> hour of use. So, if you know how what I should check when it does not
> work, you can assume there is a console and explain to me what to do.
> 
Need the output of 'systemctl status networking.service' and 'ip a', and
the complete text of /etc/network/interface (with the public IPs
anonymized) and if it exists the content of the files in
/etc/network/interface.d/

[toc] | [prev] | [next] | [standalone]


#227162 — [SOLVED] Re: libvirt guest bridge configuration

FromLucio Crusca <lucio@sulweb.org>
Date2020-09-20 12:10 +0200
Subject[SOLVED] Re: libvirt guest bridge configuration
Message-ID<AR4sa-6BU-3@gated-at.bofh.it>
In reply to#227131

Il 19/09/20 16:42, Fabien Roucaute ha scritto:
> Need the output of 'systemctl status networking.service'

Using the console I could find the culprit: the datacenter uses ethernet 
switches that filter MAC addresses, so I had to set the virbr10 mac 
address to the same as eno1 interface. It now works with this 
configuration (those are not the real IP addresses):


iface eno1 inet manual

auto virbr10
iface virbr10 inet static
     bridge_ports eno1
     bridge_stp off
     bridge_fd 0
     bridge_waitport 0
     address 2.4.6.8
     netmask 255.255.255.224
     gateway 2.4.6.1
     post-up /usr/sbin/ip link set virbr10 address 0c:c4:7a:00:36:06

and similar configuration is in place in the guest for its 
virtio-emulated network interface card.

[toc] | [prev] | [next] | [standalone]


#227218 — Re: [SOLVED] Re: libvirt guest bridge configuration

FromLucas Castro <lucas@gnuabordo.com.br>
Date2020-09-21 20:20 +0200
SubjectRe: [SOLVED] Re: libvirt guest bridge configuration
Message-ID<ARyzT-7UN-3@gated-at.bofh.it>
In reply to#227162
On 9/20/20 7:01 AM, Lucio Crusca wrote:
>
>
> Il 19/09/20 16:42, Fabien Roucaute ha scritto:
>> Need the output of 'systemctl status networking.service'
>
> Using the console I could find the culprit: the datacenter uses 
> ethernet switches that filter MAC addresses, so I had to set the 
> virbr10 mac address to the same as eno1 interface. It now works with 
> this configuration (those are not the real IP addresses):
>
>
> iface eno1 inet manual
>
> auto virbr10
> iface virbr10 inet static
>     bridge_ports eno1
>     bridge_stp off
>     bridge_fd 0
>     bridge_waitport 0
>     address 2.4.6.8
>     netmask 255.255.255.224
>     gateway 2.4.6.1
>     post-up /usr/sbin/ip link set virbr10 address 0c:c4:7a:00:36:06
>
> and similar configuration is in place in the guest for its 
> virtio-emulated network interface card.
>
But there is no need to attach  physical interface just for a host and 
guest network.

"bridge_ports none" should set a bridge without physical attachment and 
you get a interface for host and guest networking.

-- 
Lucas Castro

[toc] | [prev] | [next] | [standalone]


#227133

Fromjohn doe <johndoe65534@mail.com>
Date2020-09-19 18:40 +0200
Message-ID<AQO42-50n-3@gated-at.bofh.it>
In reply to#227117
On 9/19/2020 12:08 AM, Lucio Crusca wrote:
> I'm trying to bridge a network interface between host and guest (both
> Debian Buster+Bullseye+Sid) so that NAT is not needed.
>

If you don't incist on using /etc/network/interfaces you could also use
systemd-network:

/etc/systemd/network$ tail -n +1 *
==> br0.netdev <==
[NetDev]
         Name=br0
         Kind=bridge
         MACAddress=<MAC-OF-INT-TO-BRIDGE>

==> br0.network <==
[Match]
         Name=br0

[Network]
         DHCP=yes

==> uplink.network <==
[Match]
         Name=<INT-TO-BRIDGE>

[Network]
         Bridge=br0


This assumes that the bridge will reseave an IP from a DHCP server.


HTH.

--
John Doe

[toc] | [prev] | [next] | [standalone]


#227137

FromLucas Castro <lucas@gnuabordo.com.br>
Date2020-09-19 23:30 +0200
Message-ID<AQSAG-7LQ-7@gated-at.bofh.it>
In reply to#227117
On 9/18/20 7:08 PM, Lucio Crusca wrote:
> I'm trying to bridge a network interface between host and guest (both 
> Debian Buster+Bullseye+Sid) so that NAT is not needed.
>
> In the host /etc/network/interfaces I've declared a bridge like this:
>
> auto eno1
> iface eno1 inet static
>   address 2.4.6.8
>   netmask 255.255.255.224
>   gateway 2.4.6.1
>   up route add -net 2.4.6.0 netmask 255.255.255.224 gw 2.4.6.1 dev eno1
>
>
> auto virbr-dummy
> iface virbr-dummy inet manual
>     pre-up /sbin/ip link add virbr-dummy type dummy
>     up /sbin/ip link set virbr-dummy address 52:54:00:f0:37:ba
>
>
> auto virbr10
> iface virbr10 inet static
>     bridge_ports virbr-dummy
>     bridge_stp on
>     bridge_fd 2
>     address 2.4.6.73
>     netmask 255.255.255.224
>     gateway 2.4.6.65
>     broadcast 2.4.6.95
>     up route add -net 2.4.6.64 netmask 255.255.255.224 gw 2.4.6.65 dev 
> eno1
>
> Please note that 2.4.6.x are not my real IP addresses, but I've been 
> really assigned 2 IP addresses and I want to use one for the host and 
> the other for the guest.
>
> Until here it seems to work in that I can ping both addresses. However 
> I don't know how I should configure my guest VM interface. There is no 
> nat, no DHCP and if I specify the same IP address for the virtualized 
> interface as the host bridge it's connecting to, it doesn't even 
> detect any link.
>
> The guest was created with:
>
> # virt-install --network bridge=virbr10,model=virtio ...
>
> Please help.
>
I really can't understand why all that.

You just need a bridge interface and share the network.

brctl addbr br1

ip addr add 172.50.50.10/24 dev br1  #  Host

Add a interface in your guest on br1.

ip addr add 172.50.50.11/24 dev ${IF_GUEST} # Guest


That works fine,

Check your firewall for allow/deny rules.



-- 
Lucas Castro

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web