Iptables Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/iptables-examples/
PINTEREST
PINTEREST
INSTAGRAM

Today we will look usage of iptables which is mostly used firewall application for *nix based operating systems. Iptables hook into kernel and inspect for firewall rules.

More detailed info about iptables can get via man pages but we will look mostly used useful examples today. There are tables used for classifying incoming packets. Default one is filter. And there are chains in theses tables.

For example to block all incoming new  connections use following rule. Be aware that allready established connections will be still active. I will look the details of the other options. Here we add (-A) new rule into default tables input chain. Here we assume that default policy of the table filter is DROP.

But if the default policy of filter is not DROP use the following command to change it to DROP.

What if we want to remove the rule we added. It is very simple just change -A parameter to -D which means delete. But if you cannot write the whole command you can use rule numbers to specify rule

Or we list rules with id and than delete rule with this id

If you want to see the outcome of firewall table use this command. Since we have changed default policy of input chain  DROP is seem as DROP but other chains are default ACCEPT.

LEARN MORE  How To Join and Convert Multipart Vmdk Files Into One Qcow2 File?

What if we want to disable from this host to other host ssh or port 22 access. We use OUTPUT chain because the connection is initiated from this host to other host.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/iptables-examples/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.