More About Iptables

See iptables-save configuration

sudo iptables-save

Let’s disable ufw:

sudo ufw disable

and then remove it

sudo apt remove ufw

Let’s do all the work in IPTABLES!

For a persistent configuration:

touk@ubuntu-server:~$ sudo apt list iptables*
Listing... Done
iptables-converter-doc/jammy 0.9.8-1.2 all
iptables-converter/jammy 0.9.8-1.2 all
iptables-netflow-dkms/jammy 2.6-2ubuntu1 amd64
iptables-persistent/jammy,now 1.0.16 all [installed]
iptables/jammy-updates,now 1.8.7-1ubuntu5.1 amd64 [installed]

it is already installed for me the ‘iptables-persistent’ package

TURN YOUR LINUX MACINE INTO A ROUTER

We need to enable ip forwrding so a packet can jump from one interface to another

sudo vim /etc/sysctl.conf

this setting takes effect when system boots or force it

sudo sysctl -p

And now everything is saved in /etc/iptables/rules*

good command to monitor traffic with iptables

sudo watch -n 0.5 iptables -vnL --line

Last updated