Login Register






iptables basics filter_list
Author
Message
iptables basics #1
IPTABLES BASICS


Iptables is a basic component of linux, mainly used in firewall applications, such as prohibiting an IP access, or prohibiting some ports to improve the security of the website.

In general, the system will be installed by default. If it is not installed, you can install it yourself.

INSTALLING

centos:
Code:
$ yum install iptables

debian
Code:
$ apt install iptables

USAGE

view if iptables running
Code:
$ service iptables -status

clear all current rules
Code:
$ iptables -F

save the current rule ( note that there is no space between -s )
Code:
$ iptables-save

list showing current rules
Code:
$ iptables -L -n

cut out a single ip address
Code:
$ iptables -A INPUT -s 123.45.67.89 -j DROP

see the entire segment ( class a address ) from 192.0.0.1 to 192.255.255.254, then add the following rules:
Code:
$ iptables -I INPUT -s 192.0.0.0/8 -j DROP

the ip segment ( type b address ) is from 192.168.0.1 to 192.168.255.254, then add the following rules.
Code:
$ iptables -I INPUT -s 192.168.0.0/16 -j DROP

the ip segment ( c class address ) from 192.168.200.1 to 192.168.200.254, then add the following rules.
Code:
$ iptables -I INPUT -s 192.168.200.0/24 -j DROP

show current rules by row list
Code:
$ iptables -L -n --line-numbers

delete the 15th rule
Code:
$ iptables -D INPUT 15

Reply

RE: iptables basics #2
thank you.
your post is very good.

Reply

RE: iptables basics #3
ah nice....I was tempted to buy a cheat book about this kinda thing but this is way easier! Thanks Smile

Reply