Skip to content

Instantly share code, notes, and snippets.

@pedro0311
Created January 28, 2025 22:32
Show Gist options
  • Select an option

  • Save pedro0311/58f5dc720043b8b7ae8e6166b8dbdc4e to your computer and use it in GitHub Desktop.

Select an option

Save pedro0311/58f5dc720043b8b7ae8e6166b8dbdc4e to your computer and use it in GitHub Desktop.
Script useful for showing iptables/routing/dnsmasq settings
#!/bin/sh
echo
echo "######################## Filter (default) table: #######################"
iptables -t filter -vnL --line-numbers
echo
echo "######################## Nat table: ########################"
iptables -t nat -vnL --line-numbers
echo
echo "######################## Mangle table: ########################"
iptables -t mangle -vnL --line-numbers
echo
echo "######################## Raw table: ########################"
iptables -t raw -vnL --line-numbers
#echo
#echo "######################## Security table: ########################"
#iptables -t security -vnL --line-numbers
echo
echo "######################## All rules in all tables printed ########################"
echo
echo
echo "######################## Routing: ########################"
echo ip route show:
ip route show
echo
echo ip addr show:
ip addr show
echo
echo ip rule show:
ip rule show
echo
echo ip neigh show:
ip neigh show
echo
echo tc -d qdisc show:
tc -d qdisc show
echo
echo ip netstat -rn:
netstat -rn
echo
echo route -n:
route -n
echo
echo "######################## All routing printed ########################"
echo
echo
echo "######################## dnsmasq, etc: ########################"
echo
cat /etc/dnsmasq.conf
echo
cat /etc/dnsmasq.ipset
echo
cat /etc/resolv.conf
echo
cat /etc/resolv.dnsmasq
echo
echo "######################## All dnsmasq,etc printed ########################"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment