# cpan Graph::Easy
# apt-get install libgraph-easy-perl
# apt-get install graphviz
# iptables -L > ipt.save
# cat ipt.save | sed -e "s/Chain \(.*\) (.*)/[Chain\1]/g" | sed "/\(target\|DNAT\|ACCEPT\|MASQUERADE\|SNAT\|DROP\|RETURN\|REJECT\).*/d" | sed -e "s/^\([^ ]*\) .*/[\1]/g" | sed "/^$/d" | awk -v ORS=, '{print $1}' | sed -e "s/\],\[Chain/] [Chain/g" | sed -e "s/\[Chain\([^ ,]*\),/[\1---->/g" | sed -e "s/\(.*\),/\1/g" | sed -e "s/Chain//g" | sed -e "s/\(.*\)---->/\1/g" | graph-easy
# cat ipt.save | sed -e "s/Chain \(.*\) (.*)/[Chain\1]/g" | sed "/\(target\|DNAT\|ACCEPT\|MASQUERADE\|SNAT\|DROP\|RETURN\|REJECT\).*/d" | sed -e "s/^\([^ ]*\) .*/[\1]/g" | sed "/^$/d" | awk -v ORS=, '{print $1}' | sed -e "s/\],\[Chain/] [Chain/g" | sed -e "s/\[Chain\([^ ,]*\),/[\1---->/g" | sed -e "s/\(.*\),/\1/g" | sed -e "s/Chain//g" | sed -e "s/\(.*\)---->/\1/g" | graph-easy -as dot | dot -Tpng -o ipt.png