---
title: 'manage multiple workplaces with systemd-networkd'
url: 'https://willifix.net/blog/manage-multiple-workplaces-with-systemd-networkd'
markdown: 'https://willifix.net/blog/manage-multiple-workplaces-with-systemd-networkd.md'
date: '2024-10-16'
description: 'A few days ago, a colleague asked me how I configure my network configuration for the respective workstations (home, Scheertower, wifi) because he finds it quite complicated to do something simple like that under Linux. When I told him udev and systemd-networkd the confusion was complete. How is th…'
---

# manage multiple workplaces with systemd-networkd

## [manage multiple workplaces with systemd-networkd](https://willifix.net/blog/manage-multiple-workplaces-with-systemd-networkd)

    16th Oct 2024  

A few days ago, a colleague asked me how I configure my network configuration for the respective workstations (home, Scheertower, wifi) because he finds it quite complicated to do something simple like that under Linux.

When I told him `udev` and `systemd-networkd` the confusion was complete. How is that supposed to work? he currently uses `Networkmanager`.

#### The Trick

Using `udev` rules, I can **rename** the network cards depending on the reported **mac-address** which must be different depending on the docking station connected. Some of you should now realize why I don't need anything other than `udev` and `systemd-networkd` that is already there.

I have defined the following 2 rules in `/etc/udev/rules.d/10-network.rules` *mac-addresses randomized for security reasons*

```bash
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="02:fa:1b:80:c3:a5", NAME="eth2", DRIVERS=="?*"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="04:46:08:a6:12:00", NAME="eth0", DRIVERS=="?*"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:2a:a5:5d:2c:b2", NAME="wlan0"
```

Lines 1 and 2 name the network card of the connected docking station according to **eth2**or **eth0**

systemd-networkd has a configuration for the respective, then existing network card in `/etc/systemd/network/`

![RWill_2024-10-16%2016-12-15](https://willifix.net/user/pages/03.blog/manage-multiple-workplaces-with-systemd-networkd/RWill_2024-10-16%2016-12-15.png "RWill_2024-10-16%2016-12-15")

the eth2.network file looks like this:

```bash
[Match]
Name=eth2

[Network]
DHCP=ipv4
DNS=192.168.0.1
Domains=local
```

Since `udev` renames the network card according to its **mac-address**, `systemd-networkd` sets the necessary settings accordingly. With this trick, no further services are required for the network configuration. Newer Versions of `systemd-networkd` understanding the `MACAddress=` Parameter in the Match Section so then a renaming is not necessary anymore but useful for Firewalls,VLAN and so on. The solution shown is also **super-fast!**

![th-39118152](https://willifix.net/user/pages/03.blog/manage-multiple-workplaces-with-systemd-networkd/th-39118152.jpg "th-39118152")

for Wifi Connections i use `iwd` Daemon which works pretty well.

 [ Previous Post](https://willifix.net/blog/updating-740-3cx-users-via-configuration-api) [Next Post ](https://willifix.net/blog/seafile-11-traefik-config)

---

## Navigation

- Parent: [Blog](https://willifix.net/blog.md)
- Previous: [Seafile 11 traefik configuration](https://willifix.net/blog/seafile-11-traefik-config.md)
- Next: [updating 740 3cx Users via Configuration API](https://willifix.net/blog/updating-740-3cx-users-via-configuration-api.md)
