Linux CentOS, Debian uses iptables to block IP and delete IP

888u

Last update at :2024-02-08,Edit by888u

Linux CentOS, Debian uses iptables to block IP and delete IP

#Add shielded IP

#Ban this IP from accessing the server

iptables -I INPUT -s 1.2.3.4 -j DROP iptables -A INPUT -s 1.2.3.4 -j DROP

#Forbid the server to access this IP

iptables -A OUTPUT -d 1.2.3.4 -j DROP

If you want to block a certain network segment:

iptables -I INPUT -s 1.2.3.0/24 -j DROP

#Clear blocked IP

iptables -t filter -D INPUT -s 1.2.3.4 -j DROP iptables -t filter -D OUTPUT -d 1.2.3.4 -j DROP

#Clear all rules with one click

iptables -F

#View

iptables -L INPUT

or

iptables -L

or

iptables-save (this command will save the rules and execute them automatically next time you boot up)

#Process the number of IP fragments to prevent attacks, allowing 100 per second

iptables -A FORWARD -f -m limit --limit 100/s --limit-burst 100 -j ACCEPT

#Set ICMP packet filtering, allowing 1 packet per second, and limiting the trigger condition to 10 packets

iptables -A FORWARD -p icmp -m limit --limit 1/s --limit-burst 10 -j ACCEPT

Recommended site searches: free hosting in the United States, free Japanese servers, php space application, online personal website generation, free virtual hosting application, IP reverse domain name check, Korean cn2 server, how much does it cost to rent a server for a year, vps hosting, Hong Kong vps Host rental,

Linux CentOS, Debian uses iptables to block IP and delete IP

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码