Skip to content Skip सामग्री के लिए


How to block an IP address in IPTables in Linux कैसे iptables में लिनक्स में आईपी पता खंड के लिए

लिनक्ससुरक्षा

If you are responsible for a Linux server, security becomes a big concern. यदि आप एक Linux सर्वर के लिए जिम्मेदार हैं, सुरक्षा एक बड़ी चिंता का विषय बन जाता है. Some of the biggest threats to a server's security are DDOS attacks and repeated attempts to enter the server using automates bots. सबसे बड़े खतरों की एक सर्वर सुरक्षा के लिए कुछ DDOS हमले और बार बार प्रयोग सर्वर में प्रवेश का प्रयास कर रहे हैं बॉट automates. There are a number of ways by which you can detect the IP address of a potential intruder. वहाँ तरीके जिसके द्वारा आप एक संभावित घुसपैठ के आईपी पते का पता लगा सकते हैं की एक संख्या हैं. But what do you do after you have located his/her IP address? लेकिन क्या आप के बाद आप अपने / उसका आईपी पता स्थित है? Well, you block it. ठीक है, तुम यह ब्लॉक. Here's how you do it using IPTables which is the firewall that ships with most flavors of Linux. यहाँ कैसे आप इसे iptables का उपयोग कर जो फ़ायरवॉल है कि Linux के सर्वाधिक जायके के साथ जहाज.

If you have just one IP address that you want to block you can use the following method: अगर तुम सिर्फ एक आईपी पता है कि तुम ब्लॉक आप निम्नलिखित विधि का उपयोग कर सकते हैं करना चाहते हैं:

# iptables -I INPUT -s 122.174.12.228 -j DROP # Iptables-मैं निवेश 122.174.12.228-j छोड़ s

This command will add an entry into your iptables configuration file, instructing it to drop any packets that come from the IP 122.172.9.222 . इस कमान अपने iptables विन्यास फाइल में एक प्रविष्टि जोड़ने के लिए, यह किसी भी पैकेट कि आईपी 122.172.9.222 से आई गिरावट को निर्देश दिया जाएगा. If you face numerous attacks you are better of using a slightly more automated method to add the IPs from your ban list. यदि आप कई हमलों आप बेहतर कर रहे हैं एक से थोड़ा अधिक स्वचालित पद्धति का उपयोग करके अपने प्रतिबंध सूची से आईपी जोड़ें चेहरा. To do that create the following script: करना है कि निम्न स्क्रिप्ट बनाने के लिए:

#!/bin/sh #! / bin / श
for i in $(< banned_IPs.cfg) ; do $ में मैं के लिए (<banned_IPs.cfg); करना
iptables -I INPUT -i eth1 -s "$i" -j DROP iptables-मैं-i-eth1 निवेश $ s 'मैं' जम्मू ड्रॉप
done हो गया

Save the script into a file named something like banned_IPs.sh and grant it executable privileges: एक banned_IPs.sh की तरह कुछ और विशेषाधिकारों का नाम अनुदान निष्पादन योग्य फ़ाइल में पटकथा सहेजें:

# chmod +x banned_IPs.sh # Chmod + x banned_IPs.sh

Now create a file called banned_IPs.cfg and enter the list of IP addressed you want to block, each in a new line: अब एक फाइल बना banned_IPs.cfg और आईपी की सूची में प्रवेश किया संबोधित आप में एक नई पंक्ति में, प्रत्येक ब्लॉक करना चाहते हैं:


122.174.12.228 122.174.12.228
129.122.10.23 129.122.10.23
111.154.84.130 111.154.84.130

Now run the script banned_IPs.sh to have the IP addresses you want blocked added to the list of banned IPs in iptables: अब स्क्रिप्ट banned_IPs.sh चलाने के लिए है IP पते तुम iptables में प्रतिबंधित आईपी की सूची में शामिल करना चाहते अवरुद्ध:

# ./banned_IPs.sh #. / Banned_IPs.sh

Posted in पोस्ट में Linux लिनक्स , , Security सुरक्षा . .

Get Simple Help tutorials just like this one in your email inbox every day - for free! बस अपने ईमेल इनबॉक्स के लिए मुफ्त हर दिन - में यह एक तरह सरल सहायता ट्यूटोरियल जाओ! Just enter your email address below: बस नीचे अपना ईमेल पता दर्ज करें:

You can always opt out of this email subscription at any time. तुम हमेशा इस ईमेल सदस्यता से बाहर किसी भी समय विकल्प चुन सकते हैं.

One Response एक उत्तर

Stay in touch with the conversation, subscribe to the बातचीत के साथ संपर्क में रहो, की सदस्यता लें RSS feed for comments on this post आरएसएस के इस पोस्ट पर टिप्पणियों के लिए फ़ीड . .

  1. Teixeira says Teixeira कहते हैं,

    Simple, clear and efficient. सरल, स्पष्ट और कुशल.
    Btw, is there any nice black list website where we can sync the “banned_IPs.cfg” file dailly for example? Btw, कोई अच्छा काली सूची वेबसाइट जहाँ हम सिंक banned_IPs.cfg "" कर सकते हैं उदाहरण के लिए dailly फाइल है? Should be nice…. होना अच्छा ... चाहिए.

    br, br,
    TT टी.टी.



Some HTML is OK कुछ HTML है ठीक है

or, reply to this post via या, इस पोस्ट के माध्यम से जवाब trackback Trackback . .