What is the difference between iptables -S and iptables -L
up vote
0
down vote
favorite
The help information doesn't seem to be very informative:
--list -L [chain [rulenum]]
List the rules in a chain or all chains
--list-rules -S [chain [rulenum]]
Print the rules in a chain or all chains
The only difference is in the choice of word: "list" vs. "print".
THe manual is a bit more detailed but still doesn't help:
-L, --list [chain]
List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
rules get listed by
iptables -t nat -n -L
Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
iptables -L -v
-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
default).
Seems to me that -S
is actually more detailed and printed out the exact ports that I allowed with a --dports
argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?
networking iptables firewall
add a comment |
up vote
0
down vote
favorite
The help information doesn't seem to be very informative:
--list -L [chain [rulenum]]
List the rules in a chain or all chains
--list-rules -S [chain [rulenum]]
Print the rules in a chain or all chains
The only difference is in the choice of word: "list" vs. "print".
THe manual is a bit more detailed but still doesn't help:
-L, --list [chain]
List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
rules get listed by
iptables -t nat -n -L
Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
iptables -L -v
-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
default).
Seems to me that -S
is actually more detailed and printed out the exact ports that I allowed with a --dports
argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?
networking iptables firewall
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
The help information doesn't seem to be very informative:
--list -L [chain [rulenum]]
List the rules in a chain or all chains
--list-rules -S [chain [rulenum]]
Print the rules in a chain or all chains
The only difference is in the choice of word: "list" vs. "print".
THe manual is a bit more detailed but still doesn't help:
-L, --list [chain]
List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
rules get listed by
iptables -t nat -n -L
Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
iptables -L -v
-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
default).
Seems to me that -S
is actually more detailed and printed out the exact ports that I allowed with a --dports
argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?
networking iptables firewall
The help information doesn't seem to be very informative:
--list -L [chain [rulenum]]
List the rules in a chain or all chains
--list-rules -S [chain [rulenum]]
Print the rules in a chain or all chains
The only difference is in the choice of word: "list" vs. "print".
THe manual is a bit more detailed but still doesn't help:
-L, --list [chain]
List all rules in the selected chain. If no chain is selected, all chains are listed. Like every other iptables command, it applies to the specified table (filter is the default), so NAT
rules get listed by
iptables -t nat -n -L
Please note that it is often used with the -n option, in order to avoid long reverse DNS lookups. It is legal to specify the -Z (zero) option as well, in which case the chain(s) will be atom‐
ically listed and zeroed. The exact output is affected by the other arguments given. The exact rules are suppressed until you use
iptables -L -v
-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all chains are printed like iptables-save. Like every other iptables command, it applies to the specified table (filter is the
default).
Seems to me that -S
is actually more detailed and printed out the exact ports that I allowed with a --dports
argument. But why is that the case? I don't think the word "print" automatically suggests a higher level of details than "list"?
networking iptables firewall
networking iptables firewall
asked 2 days ago
xji
322110
322110
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
The difference is the output format. The -S
option produces in the the fashion of iptables-save
. And this can be reused with iptables-apply
,iptables-restore
. (Check their man
pages entries for details.) So you can think of the difference as:
-L
is for reference, to get a clue of what's there
-S
is for reusable output, which is for machine parsing
If you think the -S
option gives more details, then you should learn other iptables
parameters that provide more details in combination with -L
.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
The difference is the output format. The -S
option produces in the the fashion of iptables-save
. And this can be reused with iptables-apply
,iptables-restore
. (Check their man
pages entries for details.) So you can think of the difference as:
-L
is for reference, to get a clue of what's there
-S
is for reusable output, which is for machine parsing
If you think the -S
option gives more details, then you should learn other iptables
parameters that provide more details in combination with -L
.
add a comment |
up vote
4
down vote
accepted
The difference is the output format. The -S
option produces in the the fashion of iptables-save
. And this can be reused with iptables-apply
,iptables-restore
. (Check their man
pages entries for details.) So you can think of the difference as:
-L
is for reference, to get a clue of what's there
-S
is for reusable output, which is for machine parsing
If you think the -S
option gives more details, then you should learn other iptables
parameters that provide more details in combination with -L
.
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
The difference is the output format. The -S
option produces in the the fashion of iptables-save
. And this can be reused with iptables-apply
,iptables-restore
. (Check their man
pages entries for details.) So you can think of the difference as:
-L
is for reference, to get a clue of what's there
-S
is for reusable output, which is for machine parsing
If you think the -S
option gives more details, then you should learn other iptables
parameters that provide more details in combination with -L
.
The difference is the output format. The -S
option produces in the the fashion of iptables-save
. And this can be reused with iptables-apply
,iptables-restore
. (Check their man
pages entries for details.) So you can think of the difference as:
-L
is for reference, to get a clue of what's there
-S
is for reusable output, which is for machine parsing
If you think the -S
option gives more details, then you should learn other iptables
parameters that provide more details in combination with -L
.
answered 2 days ago
Tomasz
9,13052964
9,13052964
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486932%2fwhat-is-the-difference-between-iptables-s-and-iptables-l%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown