SlideShare a Scribd company logo
1
IPTABLES LAB
 Allow Source 10.30.30.254 to Destination 10.30.30.5 via SSH
 sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport ssh -j ACCEPT
 sudo iptables –L (To see our policy in the list)
 sudo iptables-save > /etc/sysconfig/iptables (Save config, otherwise policies will be gone after restart)
 sudo systemctl restart iptables.service (Test if policy is permanent after restart)
- After doing a new SSH connection request, we will see our policy is working fine
2
 What if we change our source IP and try again?
Answer: It will be matched with the “INPUT DROP POLICY” and drop our SSH connection request.
3
 Allow DNS, HTTP, HTTPS Source 10.30.30.254 Destination 10.30.30.5
 sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport http -j ACCEPT
 sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport https -j ACCEPT
 sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport 53 -j ACCEPT
 sudo iptables –L (To see our policy in the list)
 sudo iptables-save > /etc/sysconfig/iptables (Save config, otherwise policies will be gone after restart)
 sudo iptables -D INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport 53 -j ACCEPT
“-D” is deleting policy. Now we deleted the DNS access and when we will send “telnet” request to
our BIND server, we will not have a successful connection
But also we didn’t save the config to /etc/sysconfig/iptables so after restarting the iptables service
we expect to see our saved “Allow 53 “ policy
4
 sudo systemctl restart iptables.service (Test if policy is permanent after restart)
 sudo iptables –L
To send the connection request if we have access to our server via 53 port:
 telnet 10.30.30.5 53
Seeing the TCP handshake between our physical machine and BIND Server
1/18/2022
X
Kaan Aslandag
Signed by: www.kaan1.com

More Related Content

PDF
Configuration IPTables On CentOS 8
PDF
Configuration of Smtp Server On CentOS 8
PDF
Configuration of SFTP Server on CentOS 8.pdf
PDF
Firewalld LAB
PDF
Configuration of NTP Server on CentOS 8
PDF
Configuration of BIND DNS Server On CentOS 8
PDF
Configuration Firewalld On CentOS 8
PDF
CentOS Server CLI Configuration (Nmcli & Hosts)
Configuration IPTables On CentOS 8
Configuration of Smtp Server On CentOS 8
Configuration of SFTP Server on CentOS 8.pdf
Firewalld LAB
Configuration of NTP Server on CentOS 8
Configuration of BIND DNS Server On CentOS 8
Configuration Firewalld On CentOS 8
CentOS Server CLI Configuration (Nmcli & Hosts)

What's hot (20)

PDF
CentOS Server Gui Initial Configuration
DOCX
3PAR: HOW TO CHANGE THE IP ADDRESS OF HP 3PAR SAN
PDF
Ftp configuration in rhel7
PDF
TFTP Installation Configuration Guide
PDF
Dhcp
PPSX
Linux02 install SSh
TXT
Server readme
DOCX
Router Commands Overview
PPTX
Linux Commands
DOCX
How to shutdown the Netapp SAN 8.3 and 9.2 version
PDF
How To Install and Configure Salt Master on Ubuntu
PDF
LSOF Command Usage on RHEL 7
PDF
mail server
TXT
Ftpádas
PDF
Basic security & info
PDF
How to Install Configure and Use sysstat utils on RHEL 7
PDF
How to use mmdvm host wif main board
PDF
PDF
VPNIPSec site to site
PPTX
Introduction to linux day1
CentOS Server Gui Initial Configuration
3PAR: HOW TO CHANGE THE IP ADDRESS OF HP 3PAR SAN
Ftp configuration in rhel7
TFTP Installation Configuration Guide
Dhcp
Linux02 install SSh
Server readme
Router Commands Overview
Linux Commands
How to shutdown the Netapp SAN 8.3 and 9.2 version
How To Install and Configure Salt Master on Ubuntu
LSOF Command Usage on RHEL 7
mail server
Ftpádas
Basic security & info
How to Install Configure and Use sysstat utils on RHEL 7
How to use mmdvm host wif main board
VPNIPSec site to site
Introduction to linux day1
Ad

Similar to IPTables Lab (20)

PPT
Iptables in linux
DOCX
How to Install iptable on Debian 12.docx
PPT
Modul 3 Firewalll.ppt
DOCX
25 most frequently used linux ip tables rules examples
DOCX
25 most frequently used linux ip tables rules examples
DOCX
Ccnacommand 140205001152-phpapp01
PDF
Reducing iptables configuration complexity using chains
DOCX
Ccna command
PPTX
Hadoop Cluster - Basic OS Setup Insights
PDF
Athenticated smaba server config with open vpn
PDF
Ccna commands
DOC
Ccna commands
DOC
Ccna commands
PDF
Dev ops on startup environment
PPT
Ip6 tables in linux
PDF
Linux internet server security and configuration tutorial
PDF
Ccna Commands In 10 Minutes
DOCX
Cent os 5 ssh
TXT
Linuxserver harden
PDF
Introduction to firewalls through Iptables
Iptables in linux
How to Install iptable on Debian 12.docx
Modul 3 Firewalll.ppt
25 most frequently used linux ip tables rules examples
25 most frequently used linux ip tables rules examples
Ccnacommand 140205001152-phpapp01
Reducing iptables configuration complexity using chains
Ccna command
Hadoop Cluster - Basic OS Setup Insights
Athenticated smaba server config with open vpn
Ccna commands
Ccna commands
Ccna commands
Dev ops on startup environment
Ip6 tables in linux
Linux internet server security and configuration tutorial
Ccna Commands In 10 Minutes
Cent os 5 ssh
Linuxserver harden
Introduction to firewalls through Iptables
Ad

Recently uploaded (20)

PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
573137875-Attendance-Management-System-original
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Lecture Notes Electrical Wiring System Components
PDF
composite construction of structures.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
Project quality management in manufacturing
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
additive manufacturing of ss316l using mig welding
PPTX
web development for engineering and engineering
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
573137875-Attendance-Management-System-original
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Construction Project Organization Group 2.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Lecture Notes Electrical Wiring System Components
composite construction of structures.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Project quality management in manufacturing
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
R24 SURVEYING LAB MANUAL for civil enggi
additive manufacturing of ss316l using mig welding
web development for engineering and engineering
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Automation-in-Manufacturing-Chapter-Introduction.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
Foundation to blockchain - A guide to Blockchain Tech
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx

IPTables Lab

  • 1. 1 IPTABLES LAB  Allow Source 10.30.30.254 to Destination 10.30.30.5 via SSH  sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport ssh -j ACCEPT  sudo iptables –L (To see our policy in the list)  sudo iptables-save > /etc/sysconfig/iptables (Save config, otherwise policies will be gone after restart)  sudo systemctl restart iptables.service (Test if policy is permanent after restart) - After doing a new SSH connection request, we will see our policy is working fine
  • 2. 2  What if we change our source IP and try again? Answer: It will be matched with the “INPUT DROP POLICY” and drop our SSH connection request.
  • 3. 3  Allow DNS, HTTP, HTTPS Source 10.30.30.254 Destination 10.30.30.5  sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport http -j ACCEPT  sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport https -j ACCEPT  sudo iptables -A INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport 53 -j ACCEPT  sudo iptables –L (To see our policy in the list)  sudo iptables-save > /etc/sysconfig/iptables (Save config, otherwise policies will be gone after restart)  sudo iptables -D INPUT -s 10.30.30.254 -d 10.30.30.5 -p tcp --dport 53 -j ACCEPT “-D” is deleting policy. Now we deleted the DNS access and when we will send “telnet” request to our BIND server, we will not have a successful connection But also we didn’t save the config to /etc/sysconfig/iptables so after restarting the iptables service we expect to see our saved “Allow 53 “ policy
  • 4. 4  sudo systemctl restart iptables.service (Test if policy is permanent after restart)  sudo iptables –L To send the connection request if we have access to our server via 53 port:  telnet 10.30.30.5 53 Seeing the TCP handshake between our physical machine and BIND Server 1/18/2022 X Kaan Aslandag Signed by: www.kaan1.com