all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: Julien Lepiller <julien@lepiller.eu>
Cc: help-guix@gnu.org
Subject: Re: static-networking-service-type: Using a static network bridge
Date: Mon, 27 Mar 2023 19:37:53 +0200	[thread overview]
Message-ID: <20230327193753.7c4a04c1@primary_laptop> (raw)
In-Reply-To: <E46B5F88-8191-4EDF-B259-7E063B3FB3A3@lepiller.eu>

[-- Attachment #1: Type: text/plain, Size: 2563 bytes --]

On Fri, 24 Mar 2023 18:14:48 +0100
Julien Lepiller <julien@lepiller.eu> wrote:

> The type should be a string, so "bridge" would be correct. However,
> it's not supported by guile-netlink yet, sorry. Do you think you
> could send me a scenario with iproute2 commands so I ean test an
> implementation?
What is a scenario here?

If it's about reproducing a setup with bridges something like that is
probably the easiest for the creation of the bridge:

                    +-->[eth0]<---->Local network<-->Router<-->Internet
                    |
+----------+        v      +----------+
| VM1 [eth0]<--> [br0] <-->[eth0] VM2 |
+----------+               +----------+

The bridge would be created with:
> sudo ip link add br0 type bridge
> ip link set dev br0 up

Then the host eth0 can joint it like that:
> sudo ip link set dev eth0 master br0
> sudo ip link set dev eth0 up

I've only tested that setup with eth0 being unconfigured (no IP
address), and by having br0 get the IP address instead.

So if you use DHCP, you can use 'dhclient br0' instead of the usual
'dhclient eth0', or you can set the static IP address to br0 instead of
eth0.

For the VM, you'd need to setup two qemu-kvm VMs with virt-manager.

Once you have a VM, there is a "Add hardware" button. You then need to
select "Network" for the type of hardware to add and fill some
information: "Network source" should be set to Bridge device, and
"Device name:" should be set to the bridge name on the host (like br0
for instance).

The equivalent libvirt XML for the VM network interface looks like that:
> <interface type="bridge">
>   <mac address="XX:XX:XX:XX:XX:XX"/>
>   <source bridge="lan0"/>
>   <model type="virtio"/>
>   <address type="pci" domain="0x0000" bus="0x00" slot="0x03"
> function="0x0"/> </interface>

Then you can setup a static IP address to the Ethernet interface inside
the VMs, and ping the static IP address of one VM from the other VM or
ping your router from a VM or vice versa.

Maybe there are easier ways to test that without VMs or physical
network but I don't have ideas about that yet.

In my case the bridge is used for 2 different things:
- making the VMs join the local network and be treated like any other
  physical machine.
- Enabling GNU/Linux smartphones connected to my laptop though USB to
  also join the local network: when a smartphone is connected, an usb0
  Ethernet interface appears, and an udev rule makes it join the bridge.

Thanks a lot for the infos and the help.

Denis.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-27 17:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  0:32 static-networking-service-type: Using a static network bridge Denis 'GNUtoo' Carikli
2023-03-22  6:24 ` Julien Lepiller
2023-03-23 23:08   ` Denis 'GNUtoo' Carikli
2023-03-24 17:14     ` Julien Lepiller
2023-03-27 17:37       ` Denis 'GNUtoo' Carikli [this message]
2023-03-29 18:27         ` Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230327193753.7c4a04c1@primary_laptop \
    --to=gnutoo@cyberdimension.org \
    --cc=help-guix@gnu.org \
    --cc=julien@lepiller.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.