How To Install containernetworking-plugins on Ubuntu 22.04

In this tutorial we learn how to install containernetworking-plugins on Ubuntu 22.04. containernetworking-plugins is standard networking plugins - binaries

Introduction

In this tutorial we learn how to install containernetworking-plugins on Ubuntu 22.04.

What is containernetworking-plugins

containernetworking-plugins is:

This package contains binaries of the Container Networking Initiative’s official plugins:

Interfaces

  • bridge: Creates a bridge, adds the host and the container to it.
  • ipvlan: Adds an [ipvlan] interface in the container.
  • loopback: Set the state of loopback interface to up.
  • macvlan: Creates a new MAC address, forwards all traffic to that to the container.
  • ptp: Creates a veth pair.
  • vlan: Allocates a vlan device.
  • host-device: Move an already-existing device into a container.

IPAM: IP Address Management

  • dhcp: Runs a daemon to make DHCP requests on behalf of the container.
  • host-local: Maintains a local database of allocated IPs
  • static: Allocates a static IPv4/IPv6 address.

Other

  • flannel: Generates an interface corresponding to a flannel config file
  • tuning: Tweaks sysctl parameters of an existing interface
  • portmap: An iptables-based portmapping plugin. Maps ports from the host’s address space to the container.
  • bandwidth: Allows bandwidth-limiting through use of traffic control tbf.
  • sbr: Configures source based routing for an interface.
  • firewall: Uses iptables or firewalld to add rules to allow traffic to/from the container.

There are three methods to install containernetworking-plugins on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install containernetworking-plugins Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install containernetworking-plugins using apt-get by running the following command:

sudo apt-get -y install containernetworking-plugins

Install containernetworking-plugins Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install containernetworking-plugins using apt by running the following command:

sudo apt -y install containernetworking-plugins

Install containernetworking-plugins Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install containernetworking-plugins using aptitude by running the following command:

sudo aptitude -y install containernetworking-plugins

How To Uninstall containernetworking-plugins on Ubuntu 22.04

To uninstall only the containernetworking-plugins package we can use the following command:

sudo apt-get remove containernetworking-plugins

Uninstall containernetworking-plugins And Its Dependencies

To uninstall containernetworking-plugins and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove containernetworking-plugins

Remove containernetworking-plugins Configurations and Data

To remove containernetworking-plugins configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge containernetworking-plugins

Remove containernetworking-plugins configuration, data, and all of its dependencies

We can use the following command to remove containernetworking-plugins configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge containernetworking-plugins

References

Summary

In this tutorial we learn how to install containernetworking-plugins package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.