{"id":13492032,"url":"https://github.com/containernetworking/cni","last_synced_at":"2025-09-09T21:12:28.600Z","repository":{"id":29883846,"uuid":"33429211","full_name":"containernetworking/cni","owner":"containernetworking","description":"Container Network Interface - networking for Linux containers","archived":false,"fork":false,"pushed_at":"2025-04-22T21:46:17.000Z","size":4573,"stargazers_count":5724,"open_issues_count":148,"forks_count":1098,"subscribers_count":215,"default_branch":"main","last_synced_at":"2025-05-05T16:04:01.855Z","etag":null,"topics":["containers","docker","kubernetes","networking"],"latest_commit_sha":null,"homepage":"https://cni.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/containernetworking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-04-05T03:35:49.000Z","updated_at":"2025-05-05T15:37:21.000Z","dependencies_parsed_at":"2023-10-02T19:34:48.676Z","dependency_job_id":"4888f1ce-12bb-4f97-9983-1385da614664","html_url":"https://github.com/containernetworking/cni","commit_stats":{"total_commits":747,"total_committers":188,"mean_commits":3.973404255319149,"dds":0.8942436412315931,"last_synced_commit":"3b4dfc5dffa2afac26d2c083ca68cbe9b5837097"},"previous_names":["appc/cni"],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernetworking%2Fcni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernetworking%2Fcni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernetworking%2Fcni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernetworking%2Fcni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/containernetworking","download_url":"https://codeload.github.com/containernetworking/cni/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253800687,"owners_count":21966522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containers","docker","kubernetes","networking"],"created_at":"2024-07-31T19:01:02.528Z","updated_at":"2025-09-09T21:12:28.588Z","avatar_url":"https://github.com/containernetworking.png","language":"Go","readme":"![CNI Logo](logo.png)\n\n---\n\n# CNI - the Container Network Interface\n\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2446/badge)](https://bestpractices.coreinfrastructure.org/projects/2446)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/containernetworking/cni/badge)](https://securityscorecards.dev/viewer/?uri=github.com/containernetworking/cni)\n\n## What is CNI?\n\nCNI (_Container Network Interface_), a [Cloud Native Computing Foundation](https://cncf.io) project, consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins.\nCNI concerns itself only with network connectivity of containers and removing allocated resources when the container is deleted.\nBecause of this focus, CNI has a wide range of support and the specification is simple to implement.\n\nAs well as the [specification](SPEC.md), this repository contains the Go source code of a [library for integrating CNI into applications](libcni) and an [example command-line tool](cnitool) for executing CNI plugins.  A [separate repository contains reference plugins](https://github.com/containernetworking/plugins) and a template for making new plugins.\n\nThe template code makes it straight-forward to create a CNI plugin for an existing container networking project.\nCNI also makes a good framework for creating a new container networking project from scratch.\n\nHere are the recordings of two sessions that the CNI maintainers hosted at KubeCon/CloudNativeCon 2019:\n\n- [Introduction to CNI](https://youtu.be/YjjrQiJOyME)\n- [CNI deep dive](https://youtu.be/zChkx-AB5Xc)\n\n\n## Contributing to CNI\n\nWe welcome contributions, including [bug reports](https://github.com/containernetworking/cni/issues), and code and documentation improvements.\nIf you intend to contribute to code or documentation, please read [CONTRIBUTING.md](CONTRIBUTING.md). Also see the [contact section](#contact) in this README.\n\nThe CNI project has a [biweekly meeting](https://calendar.google.com/calendar/event?action=TEMPLATE\u0026tmeid=MHN0c2FiaHJiNWI3MDQ1MjRycm42Y3M4M2FfMjAyNTA5MDFUMTUwMDAwWiAyMmM0NjU1ZjFjMjkzZTg0NDRhNTU2OTVmNDIxODg3MDgwYzc1OWU0YTQ1MjVhYmQ2NTFmYmI2MGVlYTc2YzE5QGc\u0026tmsrc=22c4655f1c293e8444a55695f421887080c759e4a4525abd651fbb60eea76c19%40group.calendar.google.com\u0026scp=ALL) on [jitsi](https://meet.jit.si/CNIMaintainersMeeting). It takes place Mondays at 11:00 US/Eastern. All are welcome to join.\n\n## Why develop CNI?\n\nApplication containers on Linux are a rapidly evolving area, and within this area networking is not well addressed as it is highly environment-specific.\nWe believe that many container runtimes and orchestrators will seek to solve the same problem of making the network layer pluggable.\n\nTo avoid duplication, we think it is prudent to define a common interface between the network plugins and container execution: hence we put forward this specification, along with libraries for Go and a set of plugins.\n\n## Who is using CNI?\n### Container runtimes\n- [Kubernetes - a system to simplify container operations](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)\n- [OpenShift - Kubernetes with additional enterprise features](https://github.com/openshift/origin/blob/master/docs/openshift_networking_requirements.md)\n- [Cloud Foundry - a platform for cloud applications](https://github.com/cloudfoundry-incubator/cf-networking-release)\n- [Apache Mesos - a distributed systems kernel](https://github.com/apache/mesos/blob/master/docs/cni.md)\n- [Amazon ECS - a highly scalable, high performance container management service](https://aws.amazon.com/ecs/)\n- [Singularity - container platform optimized for HPC, EPC, and AI](https://github.com/sylabs/singularity)\n- [OpenSVC - orchestrator for legacy and containerized application stacks](https://docs.opensvc.com/latest/fr/agent.configure.cni.html)\n\n### 3rd party plugins\n- [Project Calico - a layer 3 virtual network](https://github.com/projectcalico/calico)\n- [Contiv Networking - policy networking for various use cases](https://github.com/contiv/netplugin)\n- [SR-IOV](https://github.com/hustcat/sriov-cni)\n- [Cilium - eBPF \u0026 XDP for containers](https://github.com/cilium/cilium)\n- [Multus - a Multi plugin](https://github.com/k8snetworkplumbingwg/multus-cni)\n- [Romana - Layer 3 CNI plugin supporting network policy for Kubernetes](https://github.com/romana/kube)\n- [CNI-Genie - generic CNI network plugin](https://github.com/Huawei-PaaS/CNI-Genie)\n- [Nuage CNI - Nuage Networks SDN plugin for network policy kubernetes support ](https://github.com/nuagenetworks/nuage-cni)\n- [Linen - a CNI plugin designed for overlay networks with Open vSwitch and fit in SDN/OpenFlow network environment](https://github.com/John-Lin/linen-cni)\n- [Vhostuser - a Dataplane network plugin - Supports OVS-DPDK \u0026 VPP](https://github.com/intel/vhost-user-net-plugin)\n- [Amazon ECS CNI Plugins - a collection of CNI Plugins to configure containers with Amazon EC2 elastic network interfaces (ENIs)](https://github.com/aws/amazon-ecs-cni-plugins)\n- [Bonding CNI - a Link aggregating plugin to address failover and high availability network](https://github.com/Intel-Corp/bond-cni)\n- [ovn-kubernetes - an container network plugin built on Open vSwitch (OVS) and Open Virtual Networking (OVN) with support for both Linux and Windows](https://github.com/openvswitch/ovn-kubernetes)\n- [Juniper Contrail](https://www.juniper.net/cloud) / [TungstenFabric](https://tungstenfabric.io) -  Provides overlay SDN solution, delivering multicloud networking, hybrid cloud networking, simultaneous overlay-underlay support, network policy enforcement, network isolation, service chaining and flexible load balancing\n- [Knitter - a CNI plugin supporting multiple networking for Kubernetes](https://github.com/ZTE/Knitter)\n- [DANM - a CNI-compliant networking solution for TelCo workloads running on Kubernetes](https://github.com/nokia/danm)\n- [cni-route-override - a meta CNI plugin that override route information](https://github.com/redhat-nfvpe/cni-route-override)\n- [Terway - a collection of CNI Plugins based on alibaba cloud VPC/ECS network product](https://github.com/AliyunContainerService/terway)\n- [Cisco ACI CNI - for on-prem and cloud container networking with consistent policy and security model.](https://github.com/noironetworks/aci-containers)\n- [Kube-OVN - a CNI plugin that bases on OVN/OVS and provides advanced features like subnet, static ip, ACL, QoS, etc.](https://github.com/kubeovn/kube-ovn)\n- [Project Antrea - an Open vSwitch k8s CNI](https://github.com/vmware-tanzu/antrea)\n- [Azure CNI - a CNI plugin that natively extends Azure Virtual Networks to containers](https://github.com/Azure/azure-container-networking)\n- [Hybridnet - a CNI plugin designed for hybrid clouds which provides both overlay and underlay networking for containers in one or more clusters. Overlay and underlay containers can run on the same node and have cluster-wide bidirectional network connectivity.](https://github.com/alibaba/hybridnet)\n- [Spiderpool - An IP Address Management (IPAM) CNI plugin of Kubernetes for managing static ip for underlay network](https://github.com/spidernet-io/spiderpool)\n- [AWS VPC CNI - Networking plugin for pod networking in Kubernetes using Elastic Network Interfaces on AWS](https://github.com/aws/amazon-vpc-cni-k8s)\n\nThe CNI team also maintains some [core plugins in a separate repository](https://github.com/containernetworking/plugins).\n\n\n## How do I use CNI?\n\n### Requirements\n\nThe CNI spec is language agnostic.  To use the Go language libraries in this repository, you'll need a recent version of Go.  You can find the Go versions covered by our [automated tests](https://travis-ci.org/containernetworking/cni/builds) in [.travis.yaml](.travis.yml).\n\n### Reference Plugins\n\nThe CNI project maintains a set of [reference plugins](https://github.com/containernetworking/plugins) that implement the CNI specification.\nNOTE: the reference plugins used to live in this repository but have been split out into a [separate repository](https://github.com/containernetworking/plugins) as of May 2017.\n\n### Running the plugins\n\nAfter building and installing the [reference plugins](https://github.com/containernetworking/plugins), you can use the `priv-net-run.sh` and `docker-run.sh` scripts in the `scripts/` directory to exercise the plugins.\n\n**note - priv-net-run.sh depends on `jq`**\n\nStart out by creating a netconf file to describe a network:\n\n```bash\n$ mkdir -p /etc/cni/net.d\n$ cat \u003e/etc/cni/net.d/10-mynet.conf \u003c\u003cEOF\n{\n\t\"cniVersion\": \"0.2.0\",\n\t\"name\": \"mynet\",\n\t\"type\": \"bridge\",\n\t\"bridge\": \"cni0\",\n\t\"isGateway\": true,\n\t\"ipMasq\": true,\n\t\"ipam\": {\n\t\t\"type\": \"host-local\",\n\t\t\"subnet\": \"10.22.0.0/16\",\n\t\t\"routes\": [\n\t\t\t{ \"dst\": \"0.0.0.0/0\" }\n\t\t]\n\t}\n}\nEOF\n$ cat \u003e/etc/cni/net.d/99-loopback.conf \u003c\u003cEOF\n{\n\t\"cniVersion\": \"0.2.0\",\n\t\"name\": \"lo\",\n\t\"type\": \"loopback\"\n}\nEOF\n```\n\nThe directory `/etc/cni/net.d` is the default location in which the scripts will look for net configurations.\n\nNext, build the plugins:\n\n```bash\n$ cd $GOPATH/src/github.com/containernetworking/plugins\n$ ./build_linux.sh # or build_windows.sh\n```\n\nFinally, execute a command (`ifconfig` in this example) in a private network namespace that has joined the `mynet` network:\n\n```bash\n$ CNI_PATH=$GOPATH/src/github.com/containernetworking/plugins/bin\n$ cd $GOPATH/src/github.com/containernetworking/cni/scripts\n$ sudo CNI_PATH=$CNI_PATH ./priv-net-run.sh ifconfig\neth0      Link encap:Ethernet  HWaddr f2:c2:6f:54:b8:2b  \n          inet addr:10.22.0.2  Bcast:0.0.0.0  Mask:255.255.0.0\n          inet6 addr: fe80::f0c2:6fff:fe54:b82b/64 Scope:Link\n          UP BROADCAST MULTICAST  MTU:1500  Metric:1\n          RX packets:1 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:0 errors:0 dropped:1 overruns:0 carrier:0\n          collisions:0 txqueuelen:0\n          RX bytes:90 (90.0 B)  TX bytes:0 (0.0 B)\n\nlo        Link encap:Local Loopback  \n          inet addr:127.0.0.1  Mask:255.0.0.0\n          inet6 addr: ::1/128 Scope:Host\n          UP LOOPBACK RUNNING  MTU:65536  Metric:1\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\n          collisions:0 txqueuelen:0\n          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)\n```\n\nThe environment variable `CNI_PATH` tells the scripts and library where to look for plugin executables.\n\n## Running a Docker container with network namespace set up by CNI plugins\n\nUse the instructions in the previous section to define a netconf and build the plugins.\nNext, docker-run.sh script wraps `docker run`, to execute the plugins prior to entering the container:\n\n```bash\n$ CNI_PATH=$GOPATH/src/github.com/containernetworking/plugins/bin\n$ cd $GOPATH/src/github.com/containernetworking/cni/scripts\n$ sudo CNI_PATH=$CNI_PATH ./docker-run.sh --rm busybox:latest ifconfig\neth0      Link encap:Ethernet  HWaddr fa:60:70:aa:07:d1  \n          inet addr:10.22.0.2  Bcast:0.0.0.0  Mask:255.255.0.0\n          inet6 addr: fe80::f860:70ff:feaa:7d1/64 Scope:Link\n          UP BROADCAST MULTICAST  MTU:1500  Metric:1\n          RX packets:1 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:0 errors:0 dropped:1 overruns:0 carrier:0\n          collisions:0 txqueuelen:0\n          RX bytes:90 (90.0 B)  TX bytes:0 (0.0 B)\n\nlo        Link encap:Local Loopback  \n          inet addr:127.0.0.1  Mask:255.0.0.0\n          inet6 addr: ::1/128 Scope:Host\n          UP LOOPBACK RUNNING  MTU:65536  Metric:1\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\n          collisions:0 txqueuelen:0\n          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)\n```\n\n## What might CNI do in the future?\n\nCNI currently covers a wide range of needs for network configuration due to its simple model and API.\nHowever, in the future CNI might want to branch out into other directions:\n\n- Dynamic updates to existing network configuration\n- Dynamic policies for network bandwidth and firewall rules\n\nIf these topics are of interest, please contact the team via the mailing list or IRC and find some like-minded people in the community to put a proposal together.\n\n## Where are the binaries?\n\nThe plugins moved to a separate repo:\nhttps://github.com/containernetworking/plugins, and the releases there\ninclude binaries and checksums.\n\nPrior to release 0.7.0 the `cni` release also included a `cnitool`\nbinary; as this is a developer tool we suggest you build it yourself.\n\n## Contact\n\nFor any questions about CNI, please reach out via:\n- Email: [cni-dev](https://groups.google.com/forum/#!forum/cni-dev)\n- IRC: #[containernetworking](irc://irc.freenode.net:6667/#containernetworking) channel on [freenode.net](https://freenode.net/)\n- Slack: #cni on the [CNCF slack](https://slack.cncf.io/).  NOTE: the previous CNI Slack (containernetworking.slack.com) has been sunsetted.\n\n## Security\n\nIf you have a _security_ issue to report, please do so privately to the email addresses listed in the [MAINTAINERS](MAINTAINERS) file.\n","funding_links":[],"categories":["Go","Go (134)","Specifications:","Operators vs Controllers","networking","docker","Networking \u0026 Connectivity"],"sub_categories":["Networking"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainernetworking%2Fcni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontainernetworking%2Fcni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainernetworking%2Fcni/lists"}