![]() |
|
iptables basics - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Computers (https://sinister.li/Forum-Computers) +--- Forum: Networking (https://sinister.li/Forum-Networking) +--- Thread: iptables basics (/Thread-iptables-basics) |
iptables basics - euma3us - 08-03-2019 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 iptablesdebian Code: $ apt install iptablesUSAGE view if iptables running Code: $ service iptables -statusclear all current rules Code: $ iptables -Fsave the current rule ( note that there is no space between -s ) Code: $ iptables-savelist showing current rules Code: $ iptables -L -ncut out a single ip address Code: $ iptables -A INPUT -s 123.45.67.89 -j DROPsee 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 DROPthe 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 DROPthe 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 DROPshow current rules by row list Code: $ iptables -L -n --line-numbersdelete the 15th rule Code: $ iptables -D INPUT 15RE: iptables basics - gogreendv - 09-18-2019 thank you. your post is very good. RE: iptables basics - Nork0i - 09-23-2019 ah nice....I was tempted to buy a cheat book about this kinda thing but this is way easier! Thanks
|