6

In old sysvinit I would just do service iptables status and see if it was running or not.

But in newer Debian-Jessie I grep for iptables in the list of services and don't see iptables listed anywhere. And when I try to query the status via systemctl status iptables I get an error.

Debian-Jessie: How do you check iptables status?

1 Answer 1

9

Iptables in Linux is implemented as a number of kernel modules. Normally it is configured by some init script - but you can add and remove rules on the fly from the command line. So basically, there are (at least) thee relevant questions:

  • Are the kernel modules loaded?
  • Are any rules applied?
  • Is my firewall script/program "running"?

The old iptables "service" was obsoleted by systemd. I think this project attempts to make a similar "service" available for Debian.

To see if the kernel modules are loaded:

# lsmod | grep ip_tables

To see the effective rules:

# iptables -L

or, if you want to see the NAT rules:

# iptables -t nat -L

In Debian there are a number of firewall packages that can set up the iptables rules for you. (I have not tried any of them, I usually roll out my own when I need it).

apt-cache search firewall | grep firewall | less
2
  • Under Fedora 20/21 with systemd when I list the services systemctl list-unit-files --type=service, I still see iptables and firewalld --> compared to Debian-Jessie when I run the same command I don't see any iptables or firewalld. NOT seeing iptables or some sort of firewall service is what confuses me. Mar 4, 2016 at 12:23
  • is there command to run that that says yes/no, true/false, stopped/running, enabled/disabled? Mar 5, 2016 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.