Netfilter is a built-in Linux tool that manipulates and controls network packets, primarily used for creating firewalls. It intercepts packets at various hooks and allows users to set rules using the iptables command-line utility to determine which packets to allow or block. An example command demonstrates how to drop incoming packets from a specific IP range on a designated network interface.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
Netfilter
Netfilter is a built-in Linux tool that manipulates and controls network packets, primarily used for creating firewalls. It intercepts packets at various hooks and allows users to set rules using the iptables command-line utility to determine which packets to allow or block. An example command demonstrates how to drop incoming packets from a specific IP range on a designated network interface.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Netfilter
Linux ka Powerful Network Packet Tool
Netfilter ek powerful tool hai jo Linux operating system me built- in hai. Ye basically network packets ko manipulate aur control karne ka framework provide karta hai. Simple words me, jab bhi data internet se aapke computer par aata hai ya jata hai, wo packets me travel karta hai. Netfilter in packets ko beech me pakad kar check kar sakta hai aur unko modify, block ya forward kar sakta hai. Netfilter ka main use firewall banane me hota hai. Firewall kya hai? Firewall ek security system hai jo decide karta hai ki konsa network traffic allow karna hai aur konsa block karna hai. Netfilter me kuch special "hooks" hote hain - ye aise points hain jahan packets ko intercept kiya ja sakta hai: Prerouting (jab packet system me enter karta hai) Local in (local system ke liye packets) Forward (dusre destination ke liye forward hone wale packets) Local out (system se bahar jane wale packets) Postrouting (system se exit karne wale packets) Linux me iptables ek command line tool hai jo Netfilter ke sath use hota hai. Isse aap rules set kar sakte hain ki konse packets allow karne hain aur konse block karne hain. Example ke liye, agar aap ye command use karte hain:
iptables -A INPUT -i eth0 -s 192.168.0.0/24 -m netfilter --
netfilter-name example --action drop Iska matlab hai ki eth0 interface par se aane wale packets jo 192.168.0.0/24 range ke IPs se aa rahe hain, unko drop kar dena hai. iptables - This is the command-line utility used to configure the netfilter firewall rules in Linux. -A INPUT - The -A flag means "append" and it's adding this new rule to the end of the INPUT chain. The INPUT chain processes all packets that are destined for the local system. -i eth0 - The -i flag specifies the input interface. Here, "eth0" is the network interface (typically the first Ethernet adapter) through which the packet must be arriving for this rule to match. -s 192.168.0.0/24 - The -s flag specifies the source IP address or network. In this case, it's matching any packet coming from the IP address range 192.168.0.0 to 192.168.0.255 (the "/24" represents the subnet mask). -m netfilter - The -m flag loads a specific match module. Here, it's loading the "netfilter" module which provides additional matching capabilities. --netfilter-name example - This is a parameter for the netfilter module that gives this particular rule a name ("example"). This can be helpful for identifying and managing rules. --action drop - This tells the netfilter module what action to take when a packet matches this rule. In this case, "drop" means the packet will be silently discarded without sending any response back to the sender. In summary, this rule will drop all incoming packets that arrive on the eth0 interface from any IP address in the 192.168.0.0/24 range, and it labels this rule as "example" for easy reference.