From ACCEPT to MASQUERADE Tim(othy) Clark (eclipse)

Slides:



Advertisements
Similar presentations
1 Network Address Translation (NAT) Relates to Lab 7. Module about private networks and NAT.
Advertisements

Firewalls and Network Address Translation (NAT) Chapter 7.
IP Masquerading Homes and Businesses: When you only have one IP but you have LOTS of machines.
IUT– Network Security Course 1 Network Security Firewalls.
Ipchains and Iptables Linux operating system natively supports packet-filtering rules: Kernel versions 2.2 and earlier support the ipchains command. Kernel.
© 2007 Cisco Systems, Inc. All rights reserved.ICND2 v1.0—6-1 Access Control Lists Introducing ACL Operation.
CSCI 530 Lab Firewalls. Overview Firewalls Capabilities Limitations What are we limiting with a firewall? General Network Security Strategies Packet Filtering.
1 Network Address Translation (NAT) Relates to Lab 7. Module about private networks and NAT.
Packet Filtering CS-480b Dick Steflik. Stateless Packet Filters A border router configured to pass or reject packets based on information in the header.
Module 10 Linux Gateway (NAT) 10.1 – Introduction 10.2 – Official website and list 10.3 – Two types of NAT 10.4 – Controlling what to NAT 10.5 – How to.
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
Networking Components Chad Benedict – LTEC
Firewalls CS432. Overview  What are firewalls?  Types of firewalls Packet filtering firewalls Packet filtering firewalls Sateful firewalls Sateful firewalls.
CECS 5460 – Assignment 3 Stacey VanderHeiden Güney.
NetFilter – IPtables Firewall –Series of rules to govern what Kind of access to allow on your system –Packet filtering –Drop or Accept packets NAT –Network.
07/11/ L10/1/63 COM342 Networks and Data Communications Ian McCrumRoom 5B18 Tel: voice.
Microsoft Internet Security and Acceleration (ISA) Server 2004 is an advanced packet checking and application-layer firewall, virtual private network.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
Iptables and apache 魏凡琮 (Jerry Wei). Agenda iptables apache.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 9: Access Control Lists Routing & Switching.
Module 12: Routing Fundamentals. Routing Overview Configuring Routing and Remote Access as a Router Quality of Service.
IP Forwarding.
Firewalls A device that screens incoming and outgoing network traffic and allows or disallows traffic based on a set of rules The “device” –Needs at least.
Access Control List (ACL)
1 Firewalls. ECE Internetwork Security 2 Overview Background General Firewall setup Iptables Introduction Iptables commands “Limit” Function Explanation.
1 實驗九:建置網路安全閘道器 教師: 助教:. 2 Outline  Background  Proxy – Squid  Firewall – IPTables  VPN – OpenVPN  Experiment  Internet gateway  Firewall  VPN.
NETWORK SECURITY USING IPTABLES. TOPICS OF DISCUSSION NETWORK TRAFFIC IN PRESENT SCENARIO !! WHY WE NEED SECURITY ? T TYPE OF ATTACKS & WAYS TO TACKLE.
Firewalling With Netfilter/Iptables. What Is Netfilter/Iptables? Improved successor to ipchains available in linux kernel 2.4/2.6. Netfilter is a set.
IPtables Objectives Contents Practicals Summary
Firewall Tutorial Hyukjae Jang Nc lab, CS dept, Kaist.
Le firewall Technofutur. Table des matières Schémas du réseau Routage sans VPN Routage avec VPN Le NAT Le firewall.
CSN09101 Networked Services Week 6 : Firewalls + Security Module Leader: Dr Gordon Russell Lecturers: G. Russell.
1 Network Address Translation (NAT) and Dynamic Host Configuration Protocol (DHCP) Relates to Lab 7. Module about private networks and NAT.
1 Firewalls. ECE Internetwork Security 2 Overview Background General Firewall setup Iptables Introduction Iptables commands “Limit” Function Explanation.
Unit - III. Providing a Caching Proxy Server (1) A caching proxy server is software that stores (caches) frequently requested internet objects such as.
Firewall C. Edward Chow CS691 – Chapter 26.3 of Matt Bishop Linux Iptables Tutorial by Oskar Andreasson.
Linux Operations and Administration Chapter Eight Network Communications.
Introduction to Linux Firewall
Access Control List (ACL) W.lilakiatsakun. Transport Layer Review (1) TCP (Transmission Control Protocol) – HTTP (Web) – SMTP (Mail) UDP (User Datagram.
Firewalls Chien-Chung Shen The Need for Firewalls Internet connectivity is essential –however it creates a threat (from the network) vs.
LINUX® Netfilter The Linux Firewall Engine. Overview LINUX® Netfilter is a firewall engine built into the Linux kernel Sometimes called “iptables” for.
ROUTING AND ROUTING TABLES 2 nd semester
Linux Firewall Iptables.
The Perfect Linux Security Firewalls. Introduction of Linux Firewall Security Linux Firewall is very stable, protect our system from malware, system performance.
Cisco Routers Routers collectively provide the main feature of the network layer—the capability to forward packets end-to-end through a network. routers.
Routing with Linux 'cause you really love the command line
Firewalls. A Firewall is: a) Device that interconnects two networks b) Network device that regulates the access to an internal network c) Program that.
Managing and Directing Network Traffic with Linux
Firewalls Dr. X (Derived from slides by Prof. William Enck, NCSU)
FIREWALL configuration in linux
Firewalls.
Network Address Translation (NAT)
The Linux Operating System
ECE 544: Middlebox lab Abhigyan Sharma.
Network Address Translation (NAT)
Packet Filtering Dick Steflik.
Routing and routing tables
Introducing To Networking
IS3440 Linux Security Unit 6 Using Layered Security for Access Control
New Solutions For Scaling The Internet Address Space
* Essential Network Security Book Slides.
Setting Up Firewall using Netfilter and Iptables
OPS235: Configuring a Network Using Virtual Machines – Part 2
Firewalls By conventional definition, a firewall is a partition made
The “FREE” WiFi by Chandan.
Delivery, Forwarding, and Routing of IP Packets
WireGuard zswu.
Firewalls.
Presentation transcript:

From ACCEPT to MASQUERADE Tim(othy) Clark (eclipse) NAT & IPTables From ACCEPT to MASQUERADE Tim(othy) Clark (eclipse)

NAT IPv4 Hack One external IP for a whole network Used commonly in home routers All external traffic goes through the router Ok so what is a NAT, it is essentially a hack to try and overcome the lack of ipv4 addresses [Bullet], it essentially gives an entire internal network a single external ip address [bullet], it is commonly used with home networks [bullet], so your router has an external ip assigned by your isp and it has an internal ip assigned by itself (commonly 192.168.0.1), so all traffic going through the router to the outside appears to come from the routers external ip, and then the router sorts out the responses and sends them to the right place.[end slide]

IPTABLES Packet Filtering Packet Manipulation Creates firewalls NATs Cool stuff IPTABLES is the network packet filtering [bullet] and manipulation [bullet] tool for linux, it lets users create firewalls[bullet] and create NATs[bullet] and allows lots of other cool stuff[bullet] such as transparent proxying.[end slide]

Command Structure “-A chain” adds rules to a chain IPTABLES –A INPUT –s 137.44.10.0/24 –j DROP “-A chain” adds rules to a chain This is followed by a match And then an action Can match on lost of things Can ACCEPT, DROP or jump to a user defined chain This is an example of an iptables command[eg]The default table is filter so is not necessary to declare it. –A adds rules to the specified chain[bullet], -D removes them, this is followed by a matching condition[bullet] and a jump or action[bullet]. Packets can be matched on lots of different things and in combination[bullet], -s shown, matches by IP or IP range. Common actions are ACCEPT, DROP or a user chain name[bullet], if it is a chain name then this chain is traversed. The example will drop all packets coming from SUCS.[end slide]

Tables, Chains and Rules Tables define basic usage Chains contain rules that are checked till one is executed Different built in chains execute in different paces Rules execute actions on packets that match the condition. Iptables works with tables that contain chains which contain rules. Tables define basic usage and where it is applied, there are filter, nat, mangle and raw table[bullet], im going to talk mostly about the filter table and a brief bit in the nat table. Tables contain chains, they all have some built in chains and you can add custom chains, a chain is a collection of rules that are checked until one is executed[bullet], built in chains are executed on packets in different places such as the input chain in the filter table is execute on packets going into the software of the system[bullet]. Built in chains have a policy, which is executed if no rules are matched. Rules define a condition and an action to do if the condition is matched.[end slide]

Example Traversal Source: 137.44.10.6 –A INPUT –s 137.44.10.0/24 –j DROP –A INPUT –s 137.44.0.0/16 –j ACCEPT –P INPUT DROP DROP Matching Incoming Packet

Example Traversal Source: 137.44.195.83 –A INPUT –s 137.44.10.0/24 –j DROP –A INPUT –s 137.44.0.0/16 –j ACCEPT –P INPUT DROP ACCEPT Matching Matching Incoming Packet Not Matched

Example Traversal Source: 64.233.183.104 –A INPUT –s 137.44.10.0/24 –j DROP –A INPUT –s 137.44.0.0/16 –j ACCEPT –P INPUT DROP Policy DROP Not Matched Matching Incoming Packet Not Matched Matching

Connection Tracking Detects replies to sent packets Matching module NEW is starting a new connection ESTABLISHED is for existing connections RELATED is for new connections related to existing ones Connection tracking is used to track what data is sent and to recognise the replies to data that was sent[bullet], packets can be matched on their status[bullet], they get clisified into 3 catogories, NEW, RELATED and ESTABLISHED. New shows it is a new connection[bullet], ESTABLISHED shows it is part of an already established connection[bullet], and RELATED is staring a new connection but it is related to an existing connection.[bullet] This allows packets to be accepted only in response to outgoing connections creating a firewall.[end slide]

Masquerade Used in the prerouting chain of the nat table Makes NAT work Changes destination and source addressed as appropriate Masquerade uses similar technology to connection tracking to modify data being forwarded, it is used in the prerouting chain of the nat table[bullet], this is what does the NAT[bullet], it changes the destination and source addresses of packets being forwaded as appropriate to make the nat work [bullet]. [end slide]

Example Masq Code Internal interface is eth1 External interface is eth0 Example configuration: iptables –P INPUT DROP iptables -P FORWARD DROP iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT iptables –A FORWARD -i eth1 -j ACCEPT iptables –t nat -A POSTROUTING -o eth0 -j MASQUERADE echo 1 > /proc/sys/net/ipv4/ip_forward Internal interface = eth1 External interface = eth0 (1): Set the policy for the input chain (2): Set the policy for the forward chain (3): Allows existing connections to be forwarded (4): Allows all data from the internal network to be forwarded (5): Enables masquerading for data going to the output interface (6): Enables ipv4 packed forwarding

Useful Bits iptables-save stores the configuration in a file iptables-restore restores the configuration from a file Easily write scripts to restore it iptables has a good manual page The configuration example on the previous slide disappears when you reboot, but you can store it with commands[bullet]. And this can be configured to auto configure itself when linux boots[bullet]. Also iptables has a really good man page[bullet] so if you want to know what you can use to match packets or what else it can do the first place you can look[end of slide]

Any Questions? (Sorry for the time its taken and )[bullet] any questions?