How To Install iptables-nftables-compat on Ubuntu 18.04

In this tutorial we learn how to install iptables-nftables-compat on Ubuntu 18.04. iptables-nftables-compat is iptables compat tools for nftables

Introduction

In this tutorial we learn how to install iptables-nftables-compat on Ubuntu 18.04.

What is iptables-nftables-compat

iptables-nftables-compat is:

this package includes the compat tools to load iptables, ip6tables, arptables and ebtables rules to the nf_tables kernel subsystem.

The tools are called: ‘iptables-compat’, ‘iptables-compat-save’, ‘iptables-compat-restore’, ‘ip6tables-compat’, ‘ip6tables-compat-save’, ‘ip6tables-compat-restore’, ‘arptables-compat’ and ’ebtables-compat’.

A basic way to understand this compat stuff is to load the ruleset skeleton, i.e: a first call iptables-compat -L'. Then, you can use nft, i.e: nft list ruleset’. Same for the other families.

Also, this package contains the translation tools, which are ‘iptables-translate’, ‘ip6tables-translate’, ‘iptables-restore-translate’, and ‘ip6tables-restore-translate’.

These translation tools works by reading an input in iptables native syntax and then printing the nftables syntax equivalent.

There are three methods to install iptables-nftables-compat on Ubuntu 18.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 iptables-nftables-compat Using apt-get

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

sudo apt-get update

After updating apt database, We can install iptables-nftables-compat using apt-get by running the following command:

sudo apt-get -y install iptables-nftables-compat

Install iptables-nftables-compat Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install iptables-nftables-compat using apt by running the following command:

sudo apt -y install iptables-nftables-compat

Install iptables-nftables-compat 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 iptables-nftables-compat using aptitude by running the following command:

sudo aptitude -y install iptables-nftables-compat

How To Uninstall iptables-nftables-compat on Ubuntu 18.04

To uninstall only the iptables-nftables-compat package we can use the following command:

sudo apt-get remove iptables-nftables-compat

Uninstall iptables-nftables-compat And Its Dependencies

To uninstall iptables-nftables-compat and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove iptables-nftables-compat

Remove iptables-nftables-compat Configurations and Data

To remove iptables-nftables-compat configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge iptables-nftables-compat

Remove iptables-nftables-compat configuration, data, and all of its dependencies

We can use the following command to remove iptables-nftables-compat configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge iptables-nftables-compat

References

Summary

In this tutorial we learn how to install iptables-nftables-compat package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.