IPTables rules are not applied, not even temporarily "sudo iptables -L" remains unchanged

Hi’m trying to add some IPtable rules following som tutorials.

But I realised that my OSMC setup does not apply any of those rules that I set.

The rules I try to add are:

sudo iptables -t nat -N REDSOCKS
sudo iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
sudo iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN

But the content of “sudo iptables -L” remains the same before and after issuing these commands:

osmc@osmc:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

WHy isnt my osmc setup not applying the iptable rules?

I’m using the June 2018 image on a raspberry 1

Try:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

I think then, after creating your chain:

iptables -t nat -F POSTROUTING

Sam

iptables -L

lists things in the filter table but you’re doing in the nat table.

So, try

iptables -t nat -L
1 Like

Yeah that’s it. The rules are right there and applying.

Thanks!