# How to configure Nomad to reference CNI plugins location?

**URL:** <https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763>\
**Category:** Nomad\
**Created:** [December 10, 2023, 4:03pm UTC](https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763 "2023-12-10T16:03:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![niftyjennins](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@niftyjennins](https://discuss.hashicorp.com/u/niftyjennins)\
**Post date:** [December 10, 2023, 4:03pm UTC](https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763/1 "2023-12-10T16:03:42Z")

</div>

I’m having some trouble getting Nomad to reference the CNI plugins from the Debian 12 packages. The Debian 12 packages drop the CNI plugins in /usr/lib/cni:

```auto
$ dpkg -L containernetworking-plugins | grep loopback
/usr/lib/cni/loopback

```

and so I have a plugin config directive in /etc/nomad.d/nomad.hcl:

```auto
plugin "cni" {
  directory = "/usr/lib/cni"
}

```

however after a restart I’m getting log messages like so:

```auto
... msg="failed to setup alloc: pre-run hook \"network\" failed: failed to configure networking for alloc: failed to configure network: plugin type=\"loopback\" failed (add): failed to find plugin \"loopback\" in path [/opt/cni/bin]" failed=true

```

which seems to suggest that Nomad is still looking for CNI in /opt/cni/bin.

---

<div class="post-metadata">

**Author:** ![niftyjennins](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@niftyjennins](https://discuss.hashicorp.com/u/niftyjennins)\
**Post date:** [December 10, 2023, 4:10pm UTC](https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763/2 "2023-12-10T16:10:05Z")

</div>

fwiw, I was able to get this working via:

```auto
mkdir -p /opt/cni && \
  cd /opt/cni && \
  ln -s /usr/lib/cni bin

```

but that’s sort of a cheap hack.

---

<div class="post-metadata">

**Author:** ![jrasell](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jrasell/32/5500_2.png) [@jrasell](https://discuss.hashicorp.com/u/jrasell)\
**Post date:** [December 11, 2023, 9:08am UTC](https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763/3 "2023-12-11T09:08:32Z")

</div>

Hi @niftyjennins,

You can use the [`client.cni_path`](https://developer.hashicorp.com/nomad/docs/configuration/client#cni_path) configuration parameter to specify where the CNI plugins can be found along with the [`client.cni_config_dir`](https://developer.hashicorp.com/nomad/docs/configuration/client#cni_config_dir) to specify the path to any CNI configuration files.

Your configuration could therefore look like:

```auto
client {
  cni_path = "/usr/lib/cni/"
}

```

Thanks,  
jrasell and the Nomad team

---

<div class="post-metadata">

**Author:** ![niftyjennins](https://avatars.discourse-cdn.com/v4/letter/n/5daacb/32.png) [@niftyjennins](https://discuss.hashicorp.com/u/niftyjennins)\
**Post date:** [December 17, 2023, 7:04pm UTC](https://discuss.hashicorp.com/t/how-to-configure-nomad-to-reference-cni-plugins-location/60763/4 "2023-12-17T19:04:14Z")

</div>

Thanks. FWIW, here is the working config for Debian 12 with the containernetworking-plugins package installed:

```auto
client {
  cni_path = "/usr/lib/cni"
  cni_config_dir = "/etc/nomad.d/cni_config"
}

```
