SlideShare a Scribd company logo
Gaurav Mishra
<gmishx@gmail.com>
Linux - 3
Firewall and IPtables
Unrestricted
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
Firewalls
• Firewall is a program used to filter
packets.
• It uses set of preset security rules to
filter packets.
• It is used to restrict access from
unknown or non-trusted sources.
• Firewalls can perform NAT
translations as well.
• Linux systems have firewalls installed
for them.
• Any Linux system can act as a firewall
for a network.
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
IPtables
• The security rules and NAT
translations used by firewall are stored
in IPtables.
• Netfilter is a modular firewall.
• It stores packet filtering and NAT
translations separately.
• Each set of rules to be checked for
packet filtering is called as Chain.
• Modules used are Netfilter are located
at:
▫ /usr/lib/<kernel-
version>/kernel/net/ipv<4/6>/net
filter
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
Packet filtering
• Each rule in a chain contains following
parts:
▫ Protocol (-p)
 TCP, UDP, ICMP or ALL
▫ Source address (-s)
 ip address[/mask][port[:port]]
▫ Destination address (-d)
 ip address[/mask][port[:port]]
▫ Network interface (-i)
 name[+]
▫ Target (-j)
 ACCEPT, DROP, REJECT, QUEUE,
RETURN
▫ State (-m)
 NEW, ESTABLISHED, RELATED,
INVALID, RELATED+REPLY
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
Packet filtering
• Accepting packets only from 192.168.56.102
▫ iptables -A INPUT -j REJECT ! -s 192.168.56.102
• Accepting packets only on port 80, 8080, 22 and 24
▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 80 -j ACCEPT
▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 8080 -j ACCEPT
▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 22 -j ACCEPT
▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 24 -j ACCEPT
▫ sudo iptables -A INPUT -j REJECT
• Accepting packets only on local network
▫ sudo iptables -A INPUT -p all -j REJECT ! -s 192.168.56.1/16
• Preventing new connections on port 22
▫ sudo iptables -A INPUT -p all -m --state NEW -s 0/0 –d 0/0 --dport 22 –j
REJECT
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
NAT operations
• Network Address Translation allows
one system to change the
source/destination address of a packet
and forward it.
• NAT enabled machine remembers the
changes made so it can reverse them
on a reply packet.
• NAT is specially used in networks with
a single IP address exposed.
• NAT enabled routers allows many
machines on a single network to share
the same IP address provided by ISP.
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
NAT translation
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
NAT targets
• SNAT
▫ Modify source address, use --to-source
• DNAT
▫ Modify destination address, use --to-destination
• REDIRECT
▫ Redirect a packet to other destination/port
• MASQUERADE
▫ IP masquerading
• MIRROR
▫ Swap source and destination address
• MARK
▫ Modify Mark field to control message routing
2/24/2018
Gaurav Mishra <gmishx@gmail.com>
NAT chains
• NAT can be divided into two types: Destination NAT and Source NAT
• NAT have following chains:
▫ PREROUTING
 Corresponds to DNAT, arriving packets
▫ POSTROUTING
 Corresponds to SNAT, leaving packets
▫ OUTPUT
 Locally generated packets
• Changing source of packets leaving the system
▫ sudo iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source
192.168.56.101
• Changing destination of packets entering the system
▫ sudo iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination
192.168.56.103
2/24/2018

More Related Content

What's hot

MikroTik & RouterOS
MikroTik & RouterOSMikroTik & RouterOS
MikroTik & RouterOS
Faelix Ltd
 
We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.
DefCamp
 
15 can.ppt
15 can.ppt15 can.ppt
15 can.ppt
keerthana bathini
 
IP anycasting
 IP anycasting IP anycasting
TC Flower Offload
TC Flower OffloadTC Flower Offload
TC Flower Offload
Netronome
 
Tag your Routes Before Redistribution
Tag your Routes Before Redistribution Tag your Routes Before Redistribution
Tag your Routes Before Redistribution
Bangladesh Network Operators Group
 
Router configuration in packet tracer
Router configuration in packet  tracerRouter configuration in packet  tracer
Router configuration in packet tracer
Anabia Anabia
 
CC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
CC-4153, Verizon Cloud Compute and the SM15000, by Paul CurtisCC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
CC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
AMD Developer Central
 
MikroTik MTCNA
MikroTik MTCNAMikroTik MTCNA
MikroTik MTCNA
Ali Layth
 
Common Layer 2 Threats, Attacks & Mitigation
Common Layer 2 Threats, Attacks & MitigationCommon Layer 2 Threats, Attacks & Mitigation
Common Layer 2 Threats, Attacks & Mitigation
NetProtocol Xpert
 
Exploration Lan Switching Chapter2
Exploration Lan Switching Chapter2Exploration Lan Switching Chapter2
Exploration Lan Switching Chapter2
Carmelo de Jesús
 
Router configuration
Router configurationRouter configuration
Router configuration
Claret Malmaceda Castillo
 
Java Abs Network Border Patrol
Java Abs   Network Border PatrolJava Abs   Network Border Patrol
Java Abs Network Border Patrol
ncct
 
Static Routing
Static RoutingStatic Routing
Static Routing
Sachii Dosti
 
Cisco router basic
Cisco router basicCisco router basic
Cisco router basic
Tapan Khilar
 
Software Updates for Connected Devices - OSCON 2018
Software Updates for Connected Devices - OSCON 2018Software Updates for Connected Devices - OSCON 2018
Software Updates for Connected Devices - OSCON 2018
Mender.io
 
MTCNA
MTCNAMTCNA
Usb protocol
Usb protocol Usb protocol
Usb protocol
PREMAL GAJJAR
 
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
Waqas Ahmed Nawaz
 
Alix to APU Conversion - pfSense Hangout October 2014
Alix to APU Conversion - pfSense Hangout October 2014Alix to APU Conversion - pfSense Hangout October 2014
Alix to APU Conversion - pfSense Hangout October 2014
Netgate
 

What's hot (20)

MikroTik & RouterOS
MikroTik & RouterOSMikroTik & RouterOS
MikroTik & RouterOS
 
We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.We will charge you. How to [b]reach vendor’s network using EV charging station.
We will charge you. How to [b]reach vendor’s network using EV charging station.
 
15 can.ppt
15 can.ppt15 can.ppt
15 can.ppt
 
IP anycasting
 IP anycasting IP anycasting
IP anycasting
 
TC Flower Offload
TC Flower OffloadTC Flower Offload
TC Flower Offload
 
Tag your Routes Before Redistribution
Tag your Routes Before Redistribution Tag your Routes Before Redistribution
Tag your Routes Before Redistribution
 
Router configuration in packet tracer
Router configuration in packet  tracerRouter configuration in packet  tracer
Router configuration in packet tracer
 
CC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
CC-4153, Verizon Cloud Compute and the SM15000, by Paul CurtisCC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
CC-4153, Verizon Cloud Compute and the SM15000, by Paul Curtis
 
MikroTik MTCNA
MikroTik MTCNAMikroTik MTCNA
MikroTik MTCNA
 
Common Layer 2 Threats, Attacks & Mitigation
Common Layer 2 Threats, Attacks & MitigationCommon Layer 2 Threats, Attacks & Mitigation
Common Layer 2 Threats, Attacks & Mitigation
 
Exploration Lan Switching Chapter2
Exploration Lan Switching Chapter2Exploration Lan Switching Chapter2
Exploration Lan Switching Chapter2
 
Router configuration
Router configurationRouter configuration
Router configuration
 
Java Abs Network Border Patrol
Java Abs   Network Border PatrolJava Abs   Network Border Patrol
Java Abs Network Border Patrol
 
Static Routing
Static RoutingStatic Routing
Static Routing
 
Cisco router basic
Cisco router basicCisco router basic
Cisco router basic
 
Software Updates for Connected Devices - OSCON 2018
Software Updates for Connected Devices - OSCON 2018Software Updates for Connected Devices - OSCON 2018
Software Updates for Connected Devices - OSCON 2018
 
MTCNA
MTCNAMTCNA
MTCNA
 
Usb protocol
Usb protocol Usb protocol
Usb protocol
 
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
CCNA (R & S) Module 03 - Routing & Switching Essentials - Chapter 3
 
Alix to APU Conversion - pfSense Hangout October 2014
Alix to APU Conversion - pfSense Hangout October 2014Alix to APU Conversion - pfSense Hangout October 2014
Alix to APU Conversion - pfSense Hangout October 2014
 

Similar to Firewall and IPtables

Routing Protocols
Routing Protocols Routing Protocols
Routing Protocols
KhushbirSinghSandhu
 
Networking Basics with Linux
Networking Basics with LinuxNetworking Basics with Linux
Networking Basics with Linux
Henry Osborne
 
Routed networks sydney
Routed networks sydneyRouted networks sydney
Routed networks sydney
Miguel Lavalle
 
CCNA part 5 routing
CCNA part 5 routingCCNA part 5 routing
Firewalld : A New Interface to Your Netfilter Stack
Firewalld : A New Interface to Your Netfilter StackFirewalld : A New Interface to Your Netfilter Stack
Firewalld : A New Interface to Your Netfilter Stack
Mahmoud Shiri Varamini
 
Ocpeu14
Ocpeu14Ocpeu14
Ocpeu14
KALRAY
 
CCNP Route EIGRP Overview
CCNP Route  EIGRP OverviewCCNP Route  EIGRP Overview
CCNP Route EIGRP Overview
Visalini Kumaraswamy
 
CCNP v6 Route: Implementing IP Routing Chapter 2
CCNP v6 Route: Implementing IP Routing Chapter 2CCNP v6 Route: Implementing IP Routing Chapter 2
CCNP v6 Route: Implementing IP Routing Chapter 2
Andy Juan Sarango Veliz
 
pfSense 2.2 Preview - pfSense Hangout November 2014
pfSense 2.2 Preview - pfSense Hangout November 2014pfSense 2.2 Preview - pfSense Hangout November 2014
pfSense 2.2 Preview - pfSense Hangout November 2014
Netgate
 
Routing protocols
Routing protocolsRouting protocols
Routing protocols
Sourabh Goyal
 
Linux securities
Linux securitiesLinux securities
Linux securities
Gaurav Mishra
 
CCCNP ROUTE v6_ch02
CCCNP ROUTE v6_ch02CCCNP ROUTE v6_ch02
Ipv6
 Ipv6  Ipv6
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
Netgate
 
Ccna routing
Ccna routingCcna routing
6978047_2.ppt
6978047_2.ppt6978047_2.ppt
6978047_2.ppt
MeseleBerhanu4
 
Chapter07
Chapter07Chapter07
Chapter07
Muhammad Ahad
 
Ch09 system administration
Ch09 system administration Ch09 system administration
Ch09 system administration
Raja Waseem Akhtar
 
wget, curl and scp
wget, curl and scpwget, curl and scp
wget, curl and scp
Gaurav Mishra
 
It nv51 instructor_ppt_ch5
It nv51 instructor_ppt_ch5It nv51 instructor_ppt_ch5
It nv51 instructor_ppt_ch5
newbie2019
 

Similar to Firewall and IPtables (20)

Routing Protocols
Routing Protocols Routing Protocols
Routing Protocols
 
Networking Basics with Linux
Networking Basics with LinuxNetworking Basics with Linux
Networking Basics with Linux
 
Routed networks sydney
Routed networks sydneyRouted networks sydney
Routed networks sydney
 
CCNA part 5 routing
CCNA part 5 routingCCNA part 5 routing
CCNA part 5 routing
 
Firewalld : A New Interface to Your Netfilter Stack
Firewalld : A New Interface to Your Netfilter StackFirewalld : A New Interface to Your Netfilter Stack
Firewalld : A New Interface to Your Netfilter Stack
 
Ocpeu14
Ocpeu14Ocpeu14
Ocpeu14
 
CCNP Route EIGRP Overview
CCNP Route  EIGRP OverviewCCNP Route  EIGRP Overview
CCNP Route EIGRP Overview
 
CCNP v6 Route: Implementing IP Routing Chapter 2
CCNP v6 Route: Implementing IP Routing Chapter 2CCNP v6 Route: Implementing IP Routing Chapter 2
CCNP v6 Route: Implementing IP Routing Chapter 2
 
pfSense 2.2 Preview - pfSense Hangout November 2014
pfSense 2.2 Preview - pfSense Hangout November 2014pfSense 2.2 Preview - pfSense Hangout November 2014
pfSense 2.2 Preview - pfSense Hangout November 2014
 
Routing protocols
Routing protocolsRouting protocols
Routing protocols
 
Linux securities
Linux securitiesLinux securities
Linux securities
 
CCCNP ROUTE v6_ch02
CCCNP ROUTE v6_ch02CCCNP ROUTE v6_ch02
CCCNP ROUTE v6_ch02
 
Ipv6
 Ipv6  Ipv6
Ipv6
 
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
Advanced OpenVPN Concepts on pfSense 2.4 & 2.3.3 - pfSense Hangout February 2017
 
Ccna routing
Ccna routingCcna routing
Ccna routing
 
6978047_2.ppt
6978047_2.ppt6978047_2.ppt
6978047_2.ppt
 
Chapter07
Chapter07Chapter07
Chapter07
 
Ch09 system administration
Ch09 system administration Ch09 system administration
Ch09 system administration
 
wget, curl and scp
wget, curl and scpwget, curl and scp
wget, curl and scp
 
It nv51 instructor_ppt_ch5
It nv51 instructor_ppt_ch5It nv51 instructor_ppt_ch5
It nv51 instructor_ppt_ch5
 

More from Gaurav Mishra

FOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and AutomationFOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and Automation
Gaurav Mishra
 
FOSSology & GSOC Journey
FOSSology & GSOC JourneyFOSSology & GSOC Journey
FOSSology & GSOC Journey
Gaurav Mishra
 
Block Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchangeBlock Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchange
Gaurav Mishra
 
Block Chain - Introduction
Block Chain - IntroductionBlock Chain - Introduction
Block Chain - Introduction
Gaurav Mishra
 
Backup using rsync
Backup using rsyncBackup using rsync
Backup using rsync
Gaurav Mishra
 
Disk quota and sysd procd
Disk quota and sysd procdDisk quota and sysd procd
Disk quota and sysd procd
Gaurav Mishra
 
Linux User Management
Linux User ManagementLinux User Management
Linux User Management
Gaurav Mishra
 
Apache, cron and proxy
Apache, cron and proxyApache, cron and proxy
Apache, cron and proxy
Gaurav Mishra
 
Linux Run Level
Linux Run LevelLinux Run Level
Linux Run Level
Gaurav Mishra
 

More from Gaurav Mishra (9)

FOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and AutomationFOSSology and OSS-Tools for License Compliance and Automation
FOSSology and OSS-Tools for License Compliance and Automation
 
FOSSology & GSOC Journey
FOSSology & GSOC JourneyFOSSology & GSOC Journey
FOSSology & GSOC Journey
 
Block Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchangeBlock Chain - Merkel and Key exchange
Block Chain - Merkel and Key exchange
 
Block Chain - Introduction
Block Chain - IntroductionBlock Chain - Introduction
Block Chain - Introduction
 
Backup using rsync
Backup using rsyncBackup using rsync
Backup using rsync
 
Disk quota and sysd procd
Disk quota and sysd procdDisk quota and sysd procd
Disk quota and sysd procd
 
Linux User Management
Linux User ManagementLinux User Management
Linux User Management
 
Apache, cron and proxy
Apache, cron and proxyApache, cron and proxy
Apache, cron and proxy
 
Linux Run Level
Linux Run LevelLinux Run Level
Linux Run Level
 

Recently uploaded

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 

Recently uploaded (20)

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 

Firewall and IPtables

  • 1. Gaurav Mishra <gmishx@gmail.com> Linux - 3 Firewall and IPtables Unrestricted 2/24/2018
  • 2. Gaurav Mishra <gmishx@gmail.com> Firewalls • Firewall is a program used to filter packets. • It uses set of preset security rules to filter packets. • It is used to restrict access from unknown or non-trusted sources. • Firewalls can perform NAT translations as well. • Linux systems have firewalls installed for them. • Any Linux system can act as a firewall for a network. 2/24/2018
  • 3. Gaurav Mishra <gmishx@gmail.com> IPtables • The security rules and NAT translations used by firewall are stored in IPtables. • Netfilter is a modular firewall. • It stores packet filtering and NAT translations separately. • Each set of rules to be checked for packet filtering is called as Chain. • Modules used are Netfilter are located at: ▫ /usr/lib/<kernel- version>/kernel/net/ipv<4/6>/net filter 2/24/2018
  • 4. Gaurav Mishra <gmishx@gmail.com> Packet filtering • Each rule in a chain contains following parts: ▫ Protocol (-p)  TCP, UDP, ICMP or ALL ▫ Source address (-s)  ip address[/mask][port[:port]] ▫ Destination address (-d)  ip address[/mask][port[:port]] ▫ Network interface (-i)  name[+] ▫ Target (-j)  ACCEPT, DROP, REJECT, QUEUE, RETURN ▫ State (-m)  NEW, ESTABLISHED, RELATED, INVALID, RELATED+REPLY 2/24/2018
  • 5. Gaurav Mishra <gmishx@gmail.com> Packet filtering • Accepting packets only from 192.168.56.102 ▫ iptables -A INPUT -j REJECT ! -s 192.168.56.102 • Accepting packets only on port 80, 8080, 22 and 24 ▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 80 -j ACCEPT ▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 8080 -j ACCEPT ▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 22 -j ACCEPT ▫ sudo iptables -A INPUT -p all -s 0/0 -d 0/0 --dport 24 -j ACCEPT ▫ sudo iptables -A INPUT -j REJECT • Accepting packets only on local network ▫ sudo iptables -A INPUT -p all -j REJECT ! -s 192.168.56.1/16 • Preventing new connections on port 22 ▫ sudo iptables -A INPUT -p all -m --state NEW -s 0/0 –d 0/0 --dport 22 –j REJECT 2/24/2018
  • 6. Gaurav Mishra <gmishx@gmail.com> NAT operations • Network Address Translation allows one system to change the source/destination address of a packet and forward it. • NAT enabled machine remembers the changes made so it can reverse them on a reply packet. • NAT is specially used in networks with a single IP address exposed. • NAT enabled routers allows many machines on a single network to share the same IP address provided by ISP. 2/24/2018
  • 7. Gaurav Mishra <gmishx@gmail.com> NAT translation 2/24/2018
  • 8. Gaurav Mishra <gmishx@gmail.com> NAT targets • SNAT ▫ Modify source address, use --to-source • DNAT ▫ Modify destination address, use --to-destination • REDIRECT ▫ Redirect a packet to other destination/port • MASQUERADE ▫ IP masquerading • MIRROR ▫ Swap source and destination address • MARK ▫ Modify Mark field to control message routing 2/24/2018
  • 9. Gaurav Mishra <gmishx@gmail.com> NAT chains • NAT can be divided into two types: Destination NAT and Source NAT • NAT have following chains: ▫ PREROUTING  Corresponds to DNAT, arriving packets ▫ POSTROUTING  Corresponds to SNAT, leaving packets ▫ OUTPUT  Locally generated packets • Changing source of packets leaving the system ▫ sudo iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.56.101 • Changing destination of packets entering the system ▫ sudo iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 192.168.56.103 2/24/2018