0

I have a clean installation of ubuntu 24.04, but I am having problems setting up iptables. For the initial configuration, my goal is simply to allow all outgoing traffic and incoming SSH traffic. This is the output of sudo iptables -L with my current configuration:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 1154 68036 ACCEPT all -- any any anywhere anywhere ctstate RELATED,ESTABLISHED 2 1 52 ACCEPT tcp -- any any anywhere anywhere tcp dpt:ssh 3 20 1436 DROP all -- any any anywhere anywhere Chain FORWARD (policy DROP 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 396 packets, 41595 bytes) num pkts bytes target prot opt in out source destination 

and this is the output of sudo nft list ruleset:

table ip filter { chain INPUT { type filter hook input priority filter; policy accept; ct state related,established counter packets 1055 bytes 62068 accept tcp dport 22 counter packets 1 bytes 52 accept counter packets 16 bytes 1156 drop } chain OUTPUT { type filter hook output priority filter; policy accept; } chain FORWARD { type filter hook forward priority filter; policy drop; } } 

SSH access works good, but the problem is that server cannot access the internet with this firewall configuration, even though I followed the official documentation. If I delete INPUT rule 3 it works perfectly. I think rule 1 is not working properly, but I don't know why.

Any ideas?

New contributor
Sergio Teijido is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Why are you mixing iptables and nftables? Use only one of them. For now, you're running two firewalls simultaneously in the kernel (e.g. check every packet twice, etc.) I suggest you remove everything from iptables and even unload its modules from the kernel. nftables can do everything alone perfectly. Commented 2 days ago

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.