I'm trying to see a list of all the rules in IPtables in a Debian 7 server. when I try:
iptables -L -n
I only get one rule (which I entered 5 minutes ago).
I have many others, for port 80, mysql and others which all work, but I can't see them anywhere.
Any idea how could that be done? Thanks
/* edit */
I'm adding some input I get from the different commands
iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
When I try
iptables -L -v -n --line-n
Chain INPUT (policy ACCEPT 43535 packets, 58M bytes)
num pkts bytes target prot opt in out source destination
1 126 56529 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:443 state ESTABLISHED
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 30151 packets, 7365K bytes)
num pkts bytes target prot opt in out source destination
iptables-save
# Generated by iptables-save v1.4.14 on Thu Oct 23 08:58:32 2014
*raw
:PREROUTING ACCEPT [17972:25607074]
:OUTPUT ACCEPT [12416:1953400]
COMMIT
# Completed on Thu Oct 23 08:58:32 2014
# Generated by iptables-save v1.4.14 on Thu Oct 23 08:58:32 2014
*mangle
:PREROUTING ACCEPT [19071:27028289]
:INPUT ACCEPT [19071:27028289]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [13114:2110189]
:POSTROUTING ACCEPT [13114:2110189]
COMMIT
# Completed on Thu Oct 23 08:58:32 2014
# Generated by iptables-save v1.4.14 on Thu Oct 23 08:58:32 2014
*security
:INPUT ACCEPT [19514:27565428]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [13405:2178341]
COMMIT
# Completed on Thu Oct 23 08:58:32 2014
# Generated by iptables-save v1.4.14 on Thu Oct 23 08:58:32 2014
*nat
:PREROUTING ACCEPT [141:11461]
:INPUT ACCEPT [141:11461]
:OUTPUT ACCEPT [11:1030]
:POSTROUTING ACCEPT [11:1030]
COMMIT
# Completed on Thu Oct 23 08:58:32 2014
# Generated by iptables-save v1.4.14 on Thu Oct 23 08:58:32 2014
*filter
:INPUT ACCEPT [43596:58181078]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [30216:7394285]
-A INPUT -i eth0 -p tcp -m tcp --sport 443 -m state --state ESTABLISHED -j ACCEP T
COMMIT
# Completed on Thu Oct 23 08:58:32 2014
iptables -L
outputs. Otherwise it just sounds like you have made a mistake and are not adding the rules properly, which would explain the problem. I've never seen any inconsistencies fromiptables -L
. – goldilocks Oct 23 '14 at 13:08PREROUTING
andPOSTROUTING
built-in chains,iptables -L
is not able to give you any detail about these chains. Howeveriptables-save -c
will give you all rules availiable including e.g counters and so on. – Valentin Bajrami Oct 23 '14 at 13:19