• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / Ip tables / ufw / firewall d commands for block port ip rate limiting

Ip tables / ufw / firewall d commands for block port ip rate limiting

Table of Contents

Toggle
    • Ip tables explained very fast
  • Firewalld:

Ip tables explained very fast

Used to filter the network traffic to avoid DDoS attack.
rate limiting
Blocking ports
Targets
Drop: block traffic
Accept: allow
Reject: block with a message to end-user.
Chains:
Input:
forward:
output:
sudo iptables -A/-I chain_name -s source_ip -p
Options
-s source big the packet ipaddress
-j action to take
-p protocol name TCP/udp, – -dport= dportnumber
-P change rule / policy
-D deleting the rule
-a append end of the file
sudo iptables -A
-i  append rule start of the file
sudo iptables -I
Ex:
sudo iptables -A INPUT -s 192.168.1.3 -p tcp –dport 22 -j ACCEPT
note: ip table ignores the last /2nd rule if first or top rule matches with connection. Top to bottom approach.
Ip tables block ip address rule example
sudo iptables -A/-I chain_name -s source_ip -j action_to_take
iptables -A INPUT -s 192.168.1.3 -j DROP
To list the rules
sudo iptables -L
To clear rules
sudo iptables -F
Deleting rule from iptables
sudo iptables -D chain_name rule_number
sudo iptables -D INPUT 1

Firewalld:

default in redhat family CentOS, fedora
part of systemd
firewalld uses zones and services instead of chain and rules
make sure stop iptables before installing firewalld
sudo yum install firewalld firewall-config -y
sudo apt-get install firewall-applet
Commands
sudo firewall-cmd –get-active-zones
sudo firewall-cmd –get-zones
sudo firewall-cmd –get-default-zone
sudo firewall-cmd –get-services
sudo systemctl status firewalld
add port, delete port using firewalld but I like ufw.
sudo service iptables options
,(stop / start / restart/ reload)
sudo /etc/init.d/iptables options
sudo service ufw options
Ufw vs iptables
Ufw is new interface for iptables easy to understand
If you add/change rule with ufw. It automatically changes the iptable rules.
Block port scanning
sudo iptables -A block-scan -j DROP
Check open ports in your server
SMTP/Mail port: 25
 block it if you use email
Ftp:21 (also block it )
SFTP&ssh 22(necessary)
port: 80 web,443ssl,3306mysql
selinux

Primary Sidebar

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners 🚀
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy