Iptables -S output coverted to depth-first tree view

I am a noob with OpenWRT and also routing in general. I found the default iptables setup with a default 18.06.2 installation a bit difficult to understand when viewing with iptables -S.

So I wrote a program to convert the output to depth-first tree view, which made it a little bit easier. That can be found in this gist along with before and after data for default 18.06.2.

2 Likes

Note that it's only a part of full dump, which is iptables-save + ip6tables-save.

1 Like
  • Routing has not been mentioned in your inquiry, just firewall
  • You should realize then, that the firewall settings are found at /etc/config/firewall
  • They are written in easily-readable OpenWrt Universal Configuration Interface (UCI) syntax
  • The UCI should be used to enter firewall entries
  • Understand that the UCI in OpenWrt parses the file above - to create the rules you displayed
  • Adding pure iptables commands in any place other than /etc/firewall.user may produce undesired results
  • This is also visible in the GUI at Network > Firewall

BTW, good work on the program!

2 Likes