Cách chặn ip theo quốc gia truy cập vps với firewall trên centos 7

Cách chặn ip theo quốc gia truy cập vps với firewall trên centos 7, 2 rm_ratings 2 rm_ratings
4.75/5 - Có 2 đánh giá
Ngày đăng:
Ngày cập nhật:
Lượt xem:2633

Sử dụng lệnh tại xuống danh sách ip theo các quốc gia:

wget http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz
tar -vxzf all-zones.tar.gz

Chặn tạo 1 backlist:

 firewall-cmd --permanent --new-ipset=blacklist --type=hash:ip

Chặn quốc gia ví dụ đây là chặn china. Mỗi nước có 1 mã khác nhau chặn nước khác thì tham khảo tại ipdeny.com.

firewall-cmd --permanent --ipset=blacklist --add-entries-from-file=./cn.zone

 

Bài viết liên quan