# Help: Network magic on boot, or systemd one time script? (docker / macvlan)

**URL:** https://discourse.nixos.org/t/help-network-magic-on-boot-or-systemd-one-time-script-docker-macvlan/71333
**Category:** Help
**Created:** [October 25, 2025, 3:59pm UTC](https://discourse.nixos.org/t/help-network-magic-on-boot-or-systemd-one-time-script-docker-macvlan/71333 "2025-10-25T15:59:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Roo](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/r/90db22/32.png) [@Roo](https://discourse.nixos.org/u/Roo)
#### Post date: [October 25, 2025, 4:19pm UTC](https://discourse.nixos.org/t/help-network-magic-on-boot-or-systemd-one-time-script-docker-macvlan/71333/2 "2025-10-25T16:19:55Z")

</div>

It’s like [rubber duck debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging) - I keep answering my own questions.

```auto
$ which ip
/run/current-system/sw/bin/ip

$ ls -l /run/current-system/sw/bin/ip
lrwxrwxrwx 6 root root 66 Dec 31 1969 /run/current-system/sw/bin/ip -> /nix/store/69c1w82hwk2ki1xapdci0hdsvrhl232g-iproute2-6.14.0/bin/ip

```

From this I can squint and figure out that the package is `iproute2`

This let’s me path it in the systemd setup … thus

```auto
systemd.services.macvlan-host-routing = {
    serviceConfig.Type = "oneshot";
    wantedBy = ["docker.service"];
    script = ''
      ${pkgs.iproute2}/bin/ip link add myNewNet-shim link enp3s0 type macvlan mode bridge;
      ${pkgs.iproute2}/bin/ip addr add 192.168.1.67/32 dev myNewNet-shim;
      ${pkgs.iproute2}/bin/ip link set myNewNet-shim up;
      ${pkgs.iproute2}/bin/ip route add 192.168.1.64/30 dev myNewNet-shim;
    '';
  };

```

Will work… but is it the best approach with NixOS?

---

_[View the full topic](https://discourse.nixos.org/t/help-network-magic-on-boot-or-systemd-one-time-script-docker-macvlan/71333)._
