cnitool

command
v0.7.0-alpha0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

cnitool

cnitool is a simple program that executes a CNI configuration. It will add or remove an interface in an already-created network namespace.

Example invocation

First, install cnitool:

go install github.com/containernetworking/cni/cnitool

Then, check out and build the plugins. All commands should be run from this directory.

git clone https://github.com/containernetworking/plugins.git
cd plugins
./build.sh

Create a network configuration

echo '{"cniVersion":"0.3.1","name":"myptp","type":"ptp","ipMasq":true,"ipam":{"type":"host-local","subnet":"172.16.29.0/24","routes":[{"dst":"0.0.0.0/0"}]}}' | sudo tee /etc/cni/net.d/10-myptp.conf

Create a network namespace. This will be called testing:

sudo ip netns add testing

Add the container to the network:

sudo CNI_PATH=./bin cnitool add myptp /var/run/netns/testing

Test that it works:

sudo ip -n testing addr
sudo ip netns exec testing ping -c 1 4.2.2.2

And clean up:

sudo CNI_PATH=./bin cnitool del myptp /var/run/netns/testing
sudo ip netns del testing

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL