1. Önce iptables yedeği
# cp /etc/sysconfig/iptables /var/tmp 80 numaralı portu açıp IP ve LAN adresini belirtmeniz gerekiyor Aşağıdaki üç satırın anlamı: Önce tüm portları kapatın 80 IP segmenti 192.168.1.0/24'te 80 portları açın 211.123.16.123/24 IP segmentinin IP segmentinin 80 portunu açın # iptables -I GİRİR -p tcp --dport 80 -j DROP # iptables -I INPUT -s 192.168.1.0/24 -p tcp --dport 80 -j KABUL EDİN # iptables -I INPUT -s 211.123.16.123/24 -p tcp --dport 80 -j KABUL EDİN Yukarıdaki geçici bir ayardır. 2. O zaman iptables kaydedecek # Hizmet iptables kaydediyor 3. Güvenlik duvarını yeniden başlatın #service iptables yeniden başlatma ===============Aşağıda yeniden basılan bir ================================================ Aşağıda portlar yer alıyor, hepsi bazı IP'ler açılmadan önce engellenmiştir iptables -I INPUT -p tcp --dport 9889 -j DROP iptables -I INPUT -s 192.168.1.0/24 -p tcp --dport 9889 -j ACCEPT NAT iletisi kullanılıyorsa, etki göstermesi için aşağıdakilerle işbirliği yapmayı unutmayın iptables -I FORWARD -p tcp --dport 80 -j DROP iptables -I FORWARD -s 192.168.1.0/24 -p tcp --dport 80 -j KABUL EDİN
Yaygın kullanılan IPTABLES kuralları şunlardır: Sadece e-posta gönderip alabilirsiniz, diğer her şey kapalıdır iptables -I Filter -m mac --mac-source 00:0F:EA:25:51:37 -j DROP iptables -I Filter -m mac --mac-source 00:0F:EA:25:51:37 -p udp --dport 53 -j KABUL ET iptables -I Filter -m mac --mac-source 00:0F:EA:25:51:37 -p tcp --dport 25 -j KABUL EDİN iptables -I Filter -m mac --mac-source 00:0F:EA:25:51:37 -p tcp --dport 110 -j KABUL EDİN
IPSEC NAT Politikası iptables -I PFWanPriv -d 192.168.100.2 -j ACCEPT iptables -t nat -A PREROUTING -p tcp --dport 80 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.2:80 iptables -t nat -A PREROUTING -p tcp --dport 1723 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.2:1723 iptables -t nat -A PREROUTING -p udp --dport 1723 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.2:1723 iptables -t nat -A PREROUTING -p udp --dport 500 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.2:500 iptables -t nat -A PREROUTING -p udp --dport 4500 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.2:4500
FTP sunucusu için NAT iptables -I PFWanPriv -p tcp --dport 21 -d 192.168.100.200 -j ACCEPT iptables -t nat -A PREROUTING -p tcp --dport 21 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.200:21
Sadece belirtilen URL izin verilir iptables -A Filter -p udp --dport 53 -j KABUL ET iptables -A Filter -p tcp --dport 53 -j KABUL ET iptables -A Filter -d www.3322.org -j KABUL EDİN iptables -A Filter -d img.cn99.com -j KABUL EDİN iptables -A Filter -j DROP
Bazı IP portları açık, bazıları kapalıdır iptables -A Filter -p tcp --dport 80 -s 192.168.100.200 -d www.pconline.com.cn -j KABUL ET iptables -A Filter -p tcp --dport 25 -s 192.168.100.200 -j KABUL ET iptables -A Filter -p tcp --dport 109 -s 192.168.100.200 -j KABUL ET iptables -A Filter -p tcp --dport 110 -s 192.168.100.200 -j KABUL ET iptables -A Filter -p tcp --dport 53 -j KABUL ET iptables -A Filter -p udp --dport 53 -j KABUL ET iptables -A Filter -j DROP
Çoklu portlar iptables -A Filtre -p tcp -m multiport --destination-port 22,53,80,110 -s 192.168.20.3 -j RED
Sürekli port iptables -A Filtre -p tcp -m multiport --source-port 22,53,80,110 -s 192.168.20.3 -j REJECT iptables -A Filtre -p tcp --source-port 2:80 -s 192.168.20.3 -j RED
İnternette gezinme süresini belirtin iptables -A Filter -s 10.10.10.253 -m zaman --timestart 6:00 --timestop 11:00 --gün Pzt, Salı, Çarşamba, Perşembe, Cuma, Pazar - j DROP iptables -A Filtre -m saat --saat başlangıç 12:00 --zaman stopu 13:00 --günler Pzt, Salı, Çarşamba, Perşembe, Cuma, Pazar - j KABUL EDİL iptables -A Filtre -m saat --saat 17:30 --zaman stopu 8:30 --günler Pzt, Salı, Çarşamba, Perşembe, Cuma, Pazar - j KABUL EDİL Çoklu port hizmetleri yasaktır iptables -A Filtre -m multiport -p tcp --dport 21,23,80 -j KABUL EDİN
WAN portunu PC'ye göndermeden iptables -t nat -A PREROUTING -i $INTERNET_IF -d $INTERNET_ADDR -j DNAT --to-destination 192.168.0.1
NAT portu 8000'den 192'ye kadar. 168。 100。 80 kişilik 200 port iptables -t nat -A PREROUTING -p tcp --dport 8000 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.200:80
MAIL sunucusunun iletmek istediği port iptables -t nat -A PREROUTING -p tcp --dport 110 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.200:110 iptables -t nat -A PREROUTING -p tcp --dport 25 -d $INTERNET_ADDR -j DNAT --to-destination 192.168.100.200:25
Sadece PING 202 izinlidir. 96。 134。 133. Diğer hizmetler yasaktır iptables -A Filter -p icmp -s 192.168.100.200 -d 202.96.134.133 -j KABUL ET iptables -A Filter -j DROP BT yapılandırmasını devre dışı bırak iptables –A Filter –p tcp –dport 6000:20000 –j DROP QQ güvenlik duvarı yapılandırmasını devre dışı bırakın iptables -A Filter -p udp --dport ! 53 -j DROP iptables -A Filter -d 218.17.209.0/24 -j DROP iptables -A Filter -d 218.18.95.0/24 -j DROP iptables -A Filter -d 219.133.40.177 -j DROP MAC tabanlı olarak, sadece e-posta gönderip alabilir ve diğerlerini reddedebilir iptables -I Filter -m mac --mac-source 00:0A:EB:97:79:A1 -j DROP iptables -I Filter -m mac --mac-source 00:0A:EB:97:79:A1 -p tcp --dport 25 -j KABUL ET iptables -I Filter -m mac --mac-source 00:0A:EB:97:79:A1 -p tcp --dport 110 -j KABUL ET MSN yapılandırmasını devre dışı bırak iptables -A Filter -p udp --dport 9 -j DROP iptables -A Filter -p tcp --dport 1863 -j DROP iptables -A Filter -p tcp --dport 80 -d 207.68.178.238 -j DROP iptables -A Filter -p tcp --dport 80 -d 207.46.110.0/24 -j DROP Sadece PING 202 izinlidir. 96。 134。 133 PING'e diğer genel ağ IP'lerinde izin verilmez iptables -A Filter -p icmp -s 192.168.100.200 -d 202.96.134.133 -j KABUL ET iptables -A Filter -p icmp -j DROP Bir MAC adresinin İnternet'e erişimini yasaklamak: iptables -I Filter -m mac --mac-source 00:20:18:8F:72:F8 -j DROP Bir IP adresine ping gönderme: iptables –A Filter –p icmp –s 192.168.0.1 –j DROP Bir IP adresinin şu adreslere hizmet vermesini yasakla: iptables –A Filter -p tcp -s 192.168.0.1 --dport 80 -j DROP iptables –A Filter -p udp -s 192.168.0.1 --dport 53 -j DROP Sadece belirli hizmetler kabul edilir, bazıları reddedilir (2 kural) iptables -A Filter -p tcp -s 192.168.0.1 --dport 1000 -j KABUL EDİN iptables -A Filter -j DROP IP adresi için port hizmeti yasaktır iptables -A Filter -p tcp -s 10.10.10.253 --dport 80 -j KABUL ET iptables -A Filter -p tcp -s 10.10.10.253 --dport 80 -j DROP MAC adresi için port servisini yasakla iptables -I Filter -p tcp -m mac --mac-source 00:20:18:8F:72:F8 --dport 80 -j DROP Bir MAC adresinin İnternet'e erişimini yasaklamak: iptables -I Filter -m mac --mac-source 00:11:22:33:44:55 -j DROP Bir IP adresine ping gönderme: iptables –A Filter –p icmp –s 192.168.0.1 –j DROP
|