The commands listed below are some tools that we use often, but many more exist, and you should check the man page and documentation for more details and information. The ipchains tool is used for the firewall administration of the Linux system. We can use it to set up a firewall rules file, as we are doing in this book. Once firewall rules have been created we can play with its many commands to maintain, and inspect its rules in the Linux kernel.
To list all rules in the selected chain, use the command:
[root@deep] /# ipchains -L
This command will list all rules in the selected chain. If no chain is selected, all chains are listed.
To list all input rules in the selected chain, use the command:
[root@deep] /# ipchains -L input
This command will list all input rules we have configured in the selected chain.
To list all output rules in the selected chain, use the command:
[root@deep] /# ipchains -L output
This command will list all output rules we have configured in the selected chain.
To list all forward rules in the selected chain, use the command:
[root@deep] /# ipchains -L forward
This command will list all forward rules in the selected chain. This of course works only if you have configured Masquerading on your server. for gateway servers in general.
To list all masquerades rules in the selected chain, use the command:
[root@deep] /# ipchains -ML
This option allows viewing of the currently masqueraded connections. You must have configured Masquerading on your server for this command to work, once again, only for gateway servers.
To list all rules in numeric output in the selected chain, use the command:
[root@deep] /# ipchains -nL
This command will list all rules in numeric output. All the IP addresses and port numbers will be printed in numeric format.