Skip to content

HalilDeniz/IptablesConfiguration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bash Script for Managing iptables Rules

This Bash script allows users to easily manage iptables rules on a Linux system. It prompts users to set default policies, handle traffic from specific IP addresses, and specify which connection types and ports to allow. The script provides a simple and interactive way to configure iptables firewall rules.

Usage

  1. Clone or download the script to your Linux system.
  2. Make the script executable:
    chmod +x iptables-configuration.sh
  3. Run the script as root:
    sudo ./iptables-configuration.sh
  4. Follow the prompts to set default policies, handle traffic from specific IP addresses, and specify allowed connection types and ports.

Features

  • Set default input policy (ACCEPT/DROP).
  • Set loopback traffic policy (ACCEPT/DROP).
  • Handle traffic from a specific IP address (ACCEPT/DROP).
  • Specify allowed connection types (TCP/UDP/ALL).
  • Specify ports or port ranges to allow.

Requirements

  • Linux operating system.
  • Bash shell.

Examples

Example 1: Allow HTTP and HTTPS traffic
./iptables-configuration.sh

Set default input policy: ACCEPT
Set loopback traffic policy: ACCEPT
Handle traffic from a specific IP: no
Specify connection types: TCP
Specify ports or port ranges to allow: 80 443
Example 2: Allow SSH traffic from a specific IP address
./iptables-configuration.sh

Set default input policy: DROP
Set loopback traffic policy: ACCEPT
Handle traffic from a specific IP: yes
Enter the IP address: 192.168.1.100
Do you want to accept or drop traffic from this IP? (ACCEPT/DROP): ACCEPT
Specify connection types: TCP
Specify ports or port ranges to allow: 22
Example 3: Allow all traffic from a specific IP address
./iptables-configuration.sh

Set default input policy: DROP
Set loopback traffic policy: ACCEPT
Handle traffic from a specific IP: yes
Enter the IP address: 192.168.1.100
Do you want to accept or drop traffic from this IP? (ACCEPT/DROP): ACCEPT
Specify connection types: ALL
Specify ports or port ranges to allow: 

Troubleshooting

If you encounter any issues or errors while using iptables-configuration, feel free to join our Discord server for assistance: Join Discord Server

Contact Information

License

This project is licensed under the MIT License - see the LICENSE file for details.