Le Mon, 27 Mar 2023 19:37:53 +0200,
Denis 'GNUtoo' Carikli <[email protected]> a écrit :

> On Fri, 24 Mar 2023 18:14:48 +0100
> Julien Lepiller <[email protected]> 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  

OK, I figured it out. So, bridges are actually supported in
guile-netlink, and here is how you would do that with guile-netlink:

> (link-add "br0" "bridge")
> (link-set "br0" #:master "eth0")

So, you should be able to add the bridge with

> (network-link (name "br0")
>               (type "bridge"))

However, I don't see link-set being used except for setting interfaces
UP in the networking-service in Guix, so I think this is not yet
supported. It should not be too difficult to do though.

Probably, adding some more optional fields in static-networking-link
for the arguments supported by link-set, then call link-set with these
arguments when they are set. Do you think you could come up with a
patch for that?

If you want to add an IP address to the new link, we probably also need
to reverse the link and addr order in network-set-up/linux.

With such a patch, you should then be able to write something like

> (network-link (name "br0")
>               (type "bridge")
>               (master "eth0"))

WDYT?

Reply via email to