Getting started with nftables

Let's start with a clean snapshot of our Ubuntu virtual machine, and install the nftables package. 

The command-line utility for nftables is nft. You can either do nft commands from the Bash shell, or you can do sudo nft -i to run nft in interactive mode. For our present demos, we'll just run the commands from the Bash shell.

Now, let's take a look at the list of installed tables:

sudo apt install nftablessudo nft list tables

Hmmm... You didn't see any tables, did you? So, let's load some up.

If you look at the nftables.conf file in the /etc directory, you'll see the beginnings of a basic nft firewall configuration:

#!/usr/sbin/nft -fflush rulesettable inet filter {        chain input { type filter hook input priority ...

Get Mastering Linux Security and Hardening now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.