{"id":13582242,"url":"https://github.com/mgoltzsche/slirp-cni-plugin","last_synced_at":"2025-04-12T18:32:00.324Z","repository":{"id":57587142,"uuid":"156092445","full_name":"mgoltzsche/slirp-cni-plugin","owner":"mgoltzsche","description":"A user-mode network (\"slirp\") CNI plugin - container networking for unprivileged users","archived":false,"fork":false,"pushed_at":"2018-11-17T19:39:04.000Z","size":26,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T13:21:21.531Z","etag":null,"topics":["cni","cni-plugin","container","container-networking","networking","slirp","user-space","user-space-networking"],"latest_commit_sha":null,"homepage":"","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/mgoltzsche.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-04T14:48:08.000Z","updated_at":"2025-01-19T13:02:09.000Z","dependencies_parsed_at":"2022-09-26T19:33:20.615Z","dependency_job_id":null,"html_url":"https://github.com/mgoltzsche/slirp-cni-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgoltzsche%2Fslirp-cni-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgoltzsche%2Fslirp-cni-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgoltzsche%2Fslirp-cni-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgoltzsche%2Fslirp-cni-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgoltzsche","download_url":"https://codeload.github.com/mgoltzsche/slirp-cni-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248613596,"owners_count":21133546,"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":["cni","cni-plugin","container","container-networking","networking","slirp","user-space","user-space-networking"],"created_at":"2024-08-01T15:02:31.601Z","updated_at":"2025-04-12T18:32:00.067Z","avatar_url":"https://github.com/mgoltzsche.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"slirp-cni-plugin [![Build Status](https://travis-ci.org/mgoltzsche/slirp-cni-plugin.svg?branch=master)](https://travis-ci.org/mgoltzsche/slirp-cni-plugin)\n=\n\nA [CNI](https://github.com/containernetworking/cni) plugin that provides\ncontainer networking for unprivileged users (\"slirp\") using [slirp4netns](https://github.com/rootless-containers/slirp4netns).  \n\n\n## Build\nBuild the plugin using make and docker:\n```\ngit clone https://github.com/mgoltzsche/slirp-cni-plugin.git\ncd slirp-cni-plugin\nmake slirp\n```\n\nIn order to run the examples below you can also build the dependencies\n[slirp4netns](https://github.com/rootless-containers/slirp4netns) and\n[cnitool](https://github.com/containernetworking/cni/tree/master/cnitool) (written to `build/bin`):\n```\nmake slirp4netns cnitool\n```\n\n\n## Plugin configuration\n\n### JSON configuration file\nAn example configuration file can be found [here](example-conf/10-slirp.json).\n\n| Field  | Default | Description |\n| ------ | ------- | ----------- |\n| `name` |  | The network/configuration file's name |\n| `type` |  | Name used to lookup the plugin binary _(must be `slirp` to make the CNI runtime use this plugin)_ |\n| `mtu`  | `1500` | Maximum Transmission Unit _(1499 \u003c MTU \u003c 65522)_ |\n\nNothing but the MTU can be configured since slirp4netns provides sufficient\n[defaults](https://github.com/rootless-containers/slirp4netns/blob/master/slirp4netns.1.md#description).\nThus the `ipam` CNI plugin configuration is also not supported.\n\n### Environment variables\nTo make the plugin use a specific [slirp4netns](https://github.com/rootless-containers/slirp4netns)\nbinary set the `SLIRP4NETNS` environment variable.\nOtherwise the plugin will lookup slirp4netns in the `PATH`.\n\n\n## Usage\nThis example shows how to create namespaces and add a [slirp network](example-conf/10-slirp.json)\nusing [cnitool](https://github.com/containernetworking/cni/tree/master/cnitool).\nPlease note that the [slirp4netns](https://github.com/rootless-containers/slirp4netns)\nbinary must be in the `PATH` or specified in the `SLIRP4NETNS` environment variable.  \n\nTerminal 1: Create user, network and mount namespaces:\n```\n$ unshare --user --map-root-user --net --mount\nunshared$ echo $$ \u003e /tmp/pid\n```\n\nTerminal 2: Add network interface:\n```\n$ export PATH=\"$(pwd)/build/bin:$PATH\" \\\n         CNI_PATH=\"$(pwd):$CNI_PATH\" \\\n         NETCONFPATH=$(pwd)/example-conf\n$ cnitool add slirp \"/proc/$(cat /tmp/pid)/ns/net\"\n```\n\nTerminal 1: test connectivity:\n```\nunshared$ ip a\n1: lo: \u003cLOOPBACK\u003e mtu 65536 qdisc noop state DOWN group default qlen 1\n    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n2: eth0: \u003cBROADCAST,UP,LOWER_UP\u003e mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000\n    link/ether 12:72:1b:c0:e0:0e brd ff:ff:ff:ff:ff:ff\n    inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0\n       valid_lft forever preferred_lft forever\n    inet6 fe80::1072:1bff:fec0:e00e/64 scope link \n       valid_lft forever preferred_lft forever\nunshared$ curl http://example.org\n\u003c!doctype html\u003e\n...\n```\n\nTerminal 2: remove slirp network from the namespace after you're done:\n```\n$ cnitool del slirp \"/proc/$(cat /tmp/pid)/ns/net\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgoltzsche%2Fslirp-cni-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgoltzsche%2Fslirp-cni-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgoltzsche%2Fslirp-cni-plugin/lists"}