You are not logged in.

#1 2024-06-26 20:09:52

mor3no_kaffee
Member
Registered: 2021-12-27
Posts: 8

Unable to assign static IP to bridge managed by systemd-networkd.

My issue is exactly as described in the title.

I want to achieve a bridge interface (lxcbridge) that has a static ip address. I have no other special configurations at all.

Content in /etc/systemd/network is:

/etc/systemd/network/
├─ 10-lxcbridge.netdev
├─ 10-lxcbridge.network

File 10-lxcbridge.netdev contains:

[NetDev]
Name=lxcbridge
Kind=bridge

File 10-lxcbridge.network contains:

[Match]
Name=lxcbridge

[Network]
Address=172.65.0.2/24
Gateway=172.65.0.1

after executing

sudo systemctl restart systemd-networkd

, the output of

ip addr show

gives:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether re:da:ct:ed:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.120/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
       valid_lft 84311sec preferred_lft 73511sec
7: lxcbridge: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether c6:49:0b:9f:1e:3d brd ff:ff:ff:ff:ff:f

as you can see, lxcbridge did not get its IP address assigned. (The result is the same after a reboot).

I could manually set it using

ip addr set ...

but that is not my intention.

journalctl -u systemd-networkd

gives:

Jun 25 17:39:55 redacted systemd[1]: Started Network Configuration.
Jun 25 17:39:55 redacted systemd-networkd[1245]: lxcbridge: Configuring with /etc/systemd/network/10-lxcbridge.network.
Jun 25 17:39:55 redacted systemd-networkd[1245]: lxcbridge: Link UP
networkctl -a status

gives following info for lxcbridge:

● 7: lxcbridge
                   Link File: /usr/lib/systemd/network/99-default.link
                Network File: /etc/systemd/network/10-lxcbridge.network
                       State: no-carrier (configuring)
                Online state: offline
                        Type: bridge
                        Kind: bridge
                      Driver: bridge
            Hardware Address: c6:49:0b:9f:1e:3d
                         MTU: 1500 (min: 68, max: 65535)
                       QDisc: noqueue
IPv6 Address Generation Mode: eui64
               Forward Delay: 14.990s
                  Hello Time: 1.990s
                     Max Age: 19.990s
                 Ageing Time: 4min 59.990s
                    Priority: 32768
                         STP: no
      Multicast IGMP Version: 2
                        Cost: 1999
                  Port State: disabled
    Number of Queues (Tx/Rx): 1/1
            Auto negotiation: no
           Activation Policy: up
         Required For Online: yes

I do not understand why the address is not simply applied. I also find it strange this device is stuck in "configuring", but this is perhaps because it has no address and hence cannot be called "configured" or "routable".

The main issue is the IP not being assigned as configured, why is this? I have no clue how to dig for the issue other than the commands I have already shown above, which did not give me key indicators of possible errors or configuration mistakes.

Any help is appreciated.

Offline

#2 2024-06-27 10:50:41

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,083

Re: Unable to assign static IP to bridge managed by systemd-networkd.

looks like you missed binding the bridge to a physical interface.

https://wiki.archlinux.org/title/System … _addresses


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-06-27 12:30:21

cryptearth
Member
Registered: 2024-02-03
Posts: 2,185

Re: Unable to assign static IP to bridge managed by systemd-networkd.

here's my setup:

[main@main ~]$ cat /etc/systemd/network/10_br0.netdev                
[NetDev]
Name=br0
Kind=bridge
[main@main ~]$ cat /etc/systemd/network/20_lan.network
[Match]
Name=enp42s0

[Network]
Bridge=br0
[main@main ~]$ cat /etc/systemd/network/30_br0.network
[Match]
Name=br0

[Network]
DHCP=yes

[DHCPv4]
UseDomains=true

[DHCPv6]
UseDomains=true

[IPv6AcceptRA]
UseDomains=true

the important part is the 2nd file which connects the bridge and eth0

Last edited by cryptearth (2024-06-28 08:28:02)

Offline

#4 2024-06-28 07:50:21

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,083

Re: Unable to assign static IP to bridge managed by systemd-networkd.

Mind splitting the outputs so it's clearer where each file ends ?

It looks like you are lacking a file .

you need 2 files to setup the bridge interface, 10-foo.netdev and 10-foo.network

next you need 20-foo1.network to assign a (static) IP address to the bridge device .
(In the wiki link I posted they call this file /etc/systemd/network/MyBridge.network )

last is 30-foo2.network to setup address for the clients using the bridge .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2024-06-28 08:28:44

cryptearth
Member
Registered: 2024-02-03
Posts: 2,185

Re: Unable to assign static IP to bridge managed by systemd-networkd.

Lone_Wolf wrote:

Mind splitting the outputs so it's clearer where each file ends ?

done

Offline

Board footer

Powered by FluxBB