Компјутерски Мрежи NAT & ICMP



Similar documents
IP addressing and forwarding Network layer

Network Address Translation (NAT)

CS 457 Lecture 19 Global Internet - BGP. Fall 2011

Network layer: Overview. Network layer functions IP Routing and forwarding

IP addressing. Interface: Connection between host, router and physical link. IP address: 32-bit identifier for host, router interface

Internet Protocol: IP packet headers. vendredi 18 octobre 13

Network layer" 1DT066! Distributed Information Systems!! Chapter 4" Network Layer!! goals: "

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

VLAN und MPLS, Firewall und NAT,

Savera Tanwir. Internet Protocol

21.4 Network Address Translation (NAT) NAT concept

Proxy Server, Network Address Translator, Firewall. Proxy Server

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Subnetting,Supernetting, VLSM & CIDR

Technical Support Information Belkin internal use only

2. IP Networks, IP Hosts and IP Ports

Appendix A: Configuring Firewalls for a VPN Server Running Windows Server 2003

Transport and Network Layer

Internet Control Protocols Reading: Chapter 3

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

IP - The Internet Protocol

Internet Firewall CSIS Internet Firewall. Spring 2012 CSIS net13 1. Firewalls. Stateless Packet Filtering

About Firewall Protection

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Virtual Private Networks

Chapter 12 Supporting Network Address Translation (NAT)

Classful IP Addressing. Classless Addressing: CIDR. Routing & Forwarding: Logical View of a Router. IP Addressing: Basics

Virtual private network. Network security protocols VPN VPN. Instead of a dedicated data link Packets securely sent over a shared network Internet VPN

Troubleshooting Tools

Lecture Computer Networks

Ethernet. Ethernet. Network Devices

Outline. CSc 466/566. Computer Security. 18 : Network Security Introduction. Network Topology. Network Topology. Christian Collberg

High Performance VPN Solutions Over Satellite Networks

Unix System Administration

Chapter 4 Firewall Protection and Content Filtering

04 Internet Protocol (IP)

IP Address Classes (Some are Obsolete) Computer Networking. Important Concepts. Subnetting Lecture 8 IP Addressing & Packets

PowerLink Bandwidth Aggregation Redundant WAN Link and VPN Fail-Over Solutions

CSCE 465 Computer & Network Security

Internet Protocols Fall Lectures 7-8 Andreas Terzis

IP address format: Dotted decimal notation:

Firewall Defaults and Some Basic Rules

NAT and Firewall Traversal with STUN / TURN / ICE

Network Address Translation (NAT) Adapted from Tannenbaum s Computer Network Ch.5.6; computer.howstuffworks.com/nat1.htm; Comer s TCP/IP vol.1 Ch.

NETWORK LAYER/INTERNET PROTOCOLS

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Firewall Defaults, Public Server Rule, and Secondary WAN IP Address

8.2 The Internet Protocol

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

INTRODUCTION TO FIREWALL SECURITY

What is a DoS attack?

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

Chapter 4 Network Layer

Gary Hecht Computer Networking (IP Addressing, Subnet Masks, and Packets)

Basic Network Configuration

FIREWALLS. Firewall: isolates organization s internal net from larger Internet, allowing some packets to pass, blocking others

ICS 351: Today's plan. IP addresses Network Address Translation Dynamic Host Configuration Protocol Small Office / Home Office configuration

APNIC elearning: IPSec Basics. Contact: esec03_v1.0

NAT & IP Masquerade. Internet NETWORK ADDRESS TRANSLATION INTRODUCTION. NAT & IP Masquerade Page 1 of 5. Internal PC

NAT (Network Address Translation)

Network Address Translation (NAT) Good Practice Guideline

Netfilter / IPtables

Protecting the Home Network (Firewall)

Firewalls and VPNs. Principles of Information Security, 5th Edition 1

Virtual Private Networks

Internet Infrastructure Measurement: Challenges and Tools

Smart Tips. Enabling WAN Load Balancing. Key Features. Network Diagram. Overview. Featured Products. WAN Failover. Enabling WAN Load Balancing Page 1

13 Virtual Private Networks 13.1 Point-to-Point Protocol (PPP) 13.2 Layer 2/3/4 VPNs 13.3 Multi-Protocol Label Switching 13.4 IPsec Transport Mode

Digi Connect WAN Application Helper NAT, GRE, ESP and TCP/UPD Forwarding and IP Filtering

Network Layer IPv4. Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS. School of Computing, UNF

Internet Packets. Forwarding Datagrams

Ch 6: Networking Services: NAT, DHCP, DNS, Multicasting, NTP

Network Address Translation (NAT) Virtual Private Networks (VPN)

Lab 2. CS-335a. Fall 2012 Computer Science Department. Manolis Surligas

Guideline for setting up a functional VPN

Chapter 4 Network Layer

DHCP, ICMP, IPv6. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley DHCP. DHCP UDP IP Eth Phy

Networks: IP and TCP. Internet Protocol

How To Set Up An Ip Firewall On Linux With Iptables (For Ubuntu) And Iptable (For Windows)

Chapter 8 Network Security

Network Layer: and Multicasting Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

How do I get to

MikroTik RouterOS Workshop Load Balancing Best Practice. Warsaw MUM Europe 2012

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

Security in IPv6. Basic Security Requirements and Techniques. Confidentiality. Integrity

Instructor Notes for Lab 3

Packet filtering and other firewall functions

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

Internet Peering, IPv6, and NATs. Mike Freedman V Networks

RARP: Reverse Address Resolution Protocol

Introduction to Firewalls

Network Layer: Address Mapping, Error Reporting, and Multicasting

Chapter 8 Security Pt 2

MULTI WAN TECHNICAL OVERVIEW

Scaling the Network: Subnetting and Other Protocols. Networking CS 3470, Section 1

Transcription:

Компјутерски Мрежи NAT & ICMP Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc

Internet AS Hierarchy Inter-AS border (exterior gateway) routers Intra-AS interior (gateway) routers 2

Private Network Private IP network is an IP network that is not directly connected to the Internet IP addresses in a private network can be assigned arbitrarily. Not registered and not guaranteed to be globally unique Generally, private networks use addresses from the following experimental address ranges (non-routable addresses): 10.0.0.0 10.255.255.255 172.16.0.0 172.31.255.255 192.168.0.0 192.168.255.255 3

Private Addresses H1 H2 H3 H4 10.0.1.2 10.0.1.3 10.0.1.2 10.0.1.3 Private network 1 10.0.1.1 10.0.1.1 Private network 1 R1 Internet 128.195.4.119 128.143.71.21 R2 213.168.112.3 H5 4

NATs Network address translation = local, LAN-specific address space translated to small number of globally routable IP addresses Motivation: scarce address space cost: about $9k/year for up to 262,000 addresses prevent home broadband users from running servers at home security: prevent unsolicited inbound requests avoid renumbering if provider changes most small/mid-sized LANs inherit address space from ISP 5

Prevalence of NATs Claim: 50% of broadband users are behind NATs All Linksys/D-Link/Netgear home routers are NATs Measurement: for Quake III users, about 17-25% using NAT (May/June 2001) 6

NAT types All use net-10/8 (10.*.*.*) or 192.168/16 (172.16/12 also available) Address translation Address-and-port translation (NAPT) most common form today, still called NAT one external (global) IP address 7

Network Address Translation: Motivation A local network uses just one public IP address as far as outside world is concerned Each device on the local network is assigned a private IP address rest of Internet 138.76.29.7 local network (e.g., home network) 192.168.1.0/24 192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers 8 Datagrams with source or destination in this network have 192.168.1/24 address for source, destination (as usual)

Network Address Translation (NAT) NAT is a router function where IP addresses (and possibly port numbers) of IP datagrams are replaced at the boundary of a private network NAT is a method that enables hosts on private networks to communicate with hosts on the Internet NAT is run on routers that connect private networks to the public Internet, to replace the IP address-port pair of an IP packet with another IP address-port pair. 9

Network Address Translation: Advantages No need to be allocated range of addresses from ISP: - just one public IP address is used for all devices need a small number of IP addresses can change ISP without changing addresses of devices in local network can change addresses of devices in local network without notifying outside world Devices inside local net not explicitly addressable, visible by outside world (a security plus) 10

NAT: Network Address Translation Implementation: NAT router must: outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)... remote clients/servers will respond using (NAT IP address, new port #) as destination addr. remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table 11

NAT: Network Address Translation 2: NAT router changes datagram source addr from 192.168.1.2, 3345 to 138.76.29.7, 5001, updates table 12 2 NAT translation table WAN side addr LAN side addr 138.76.29.7, 5001 192.168.1.2, 3345 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 138.76.29.7 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3 3: Reply arrives dest. address: 138.76.29.7, 5001 192.168.1.1 S: 192.168.1.2, 3345 D: 128.119.40.186, 80 1 S: 128.119.40.186, 80 D: 192.168.1.2, 3345 4 1: host 192.168.1.2 sends datagram to 128.119.40.186, 80 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 192.168.1.2, 3345 Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc. 192.168.1.2 192.168.1.3 192.168.1.4

NAT: Network Address Translation 16-bit port-number field: 60,000 simultaneous connections with a single LAN-side address! NAT is controversial: routers should process up to only layer 3 violates end-to-end argument NAT possibility must be taken into account by app designers, e.g., P2P applications address shortage should instead be solved by having more addresses --- IPv6! 13

IPv4 vs. IPv6 ver head. len 16-bit identifier time to live type of service protocol flgs total length fragment offset Internet checksum 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, typically a TCP or UDP segment) 14

Translation Modes Dynamic Translation (IP Masquerading) large number of internal users share a single external address Static Translation a block external addresses are translated to a same size block of internal addresses Load Balancing Translation a single incoming IP address is distributed across a number of internal servers Network Redundancy Translation multiple internet connections are attached to a NAT Firewall that it chooses and uses based on bandwidth, congestion and availability. 15

Dynamic Translation (IP Masquerading ) Also called Network Address and Port Translation (NAPT) Individual hosts inside the Firewall are identified based on each connection flowing through the firewall. Since a connection doesn t exist until an internal host requests a connection through the firewall to an external host, and most Firewalls only open ports only for the addressed host only that host can route back into the internal network IP Source routing could route back in; but, most Firewalls block incoming source routed packets NAT only prevents external hosts from making connections to internal hosts. Some protocols won t work; protocols that rely on separate connections back into the local network Theoretical max of 2 16 connections, actual is much less 16

IP masquerading 17

Static Translation Map a range of external address to the same size block of internal addresses Firewall just does a simple translation of each address Port forwarding - map a specific port to come through the Firewall rather than all ports; useful to expose a specific service on the internal network to the public network 18

Load Balancing A firewall that will dynamically map a request to a pool of identical clone machines often done for really busy web sites each clone must have a way to notify the Firewall of its current load so the Firewall can choose a target machine or the firewall just uses a dispatching algorithm like round robin Only works for stateless protocols (like HTTP) 19

Load balancing of servers 20

Network Redundancy Can be used to provide automatic fail-over of servers or load balancing Firewall is connected to multiple ISP with a masquerade for each ISP and chooses which ISP to use based on client load kind of like reverse load balancing a dead ISP will be treated as a fully loaded one and the client will be routed through another ISP 21

Problems with NAT NAT causes problems with: protocols that require a separate back-channel protocols that encrypt TCP headers embed TCP address info specifically use original IP for some security reason 22

Services that NAT has problems with H.323, CUSeeMe, VDO Live video teleconferencing applications Xing Requires a back channel Rshell used to execute command on remote Unix machine back channel IRC Internet Relay Chat requires a back channel PPTP Peer-to-Peer Tunneling Protocol SQLNet2 Oracle Database Networking Services FTP Must be RFC-1631 compliant to work ICMP sometimes embeds the packed address info in the ICMP message IPSec used for many VPNs IKE Internet Key Exchange Protocol ESP IP Encapsulating Security Payload 23

Hacking through NAT Static Translation offers no protection of internal hosts Internal Host Seduction internals go to the hacker e-mail attachments Trojan Horse virus peer-to-peer connections hacker run porn and gambling sites solution = application level proxies State Table Timeout Problem hacker could hijack a stale connection before it is timed out very low probability but smart hacker could do it Source Routing through NAT if the hacker knows an internal address they can source route a packet to that host solution is to not allow source routed packets through the firewall 24

Concerns about NAT Performance: Modifying the IP header by changing the IP address requires that NAT boxes recalculate the IP header checksum Modifying port number requires that NAT boxes recalculate TCP checksum Fragmentation Care must be taken that a datagram that is fragmented before it reaches the NAT device, is not assigned a different IP address or different port numbers for each of the fragments. 25

Concerns about NAT End-to-end connectivity: NAT destroys universal end-to-end reachability of hosts on the Internet. A host in the public Internet often cannot initiate communication to a host in a private network. The problem is worse, when two hosts that are in two different private networks need to communicate with each other. 26

Concerns about NAT IP address in application data: Applications that carry IP addresses in the payload of the application data generally do not work across a private-public network boundary. Some NAT devices inspect the payload of widely used application layer protocols and, if an IP address is detected in the application-layer header or the application payload, translate the address according to the address translation table. 27

NAT and FTP Normal FTP operation 28

NAT and FTP NAT device with FTP support 29

NAT and FTP FTP in passive mode and NAT. 30

Dealing with dual NATs 31

ICMP Internet Control Message Protocol Handles special Internet control functions Responsibilities: Reporting unreachable destinations Reporting IP packet header problems Reporting routing problems Reporting echoes (pings) 32

ICMP Protocol for error detection and reporting tightly coupled with IP, unreliable ICMP messages delivered in IP packets ICMP functions: Announce network errors Announce network congestion Assist troubleshooting Announce timeouts 33

ICMP MSG IP header Source, Destination Address, TTL,... Message type examples: ICMP MSG Message type, Code, Checksum, Data 0 (8) echo request (reply) 3 destination unreachable 4 source quench 11 time exceeded 34 Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc.

35 Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc.

Specific uses of ICMP Echo request/reply Can be used to check if a host is alive Address mask request/reply Learn the subnet mask Destination unreachable Invalid address and/or port Source quench choke packet TTL expired Routing loops, or too far away 36

Ping Uses ICMP echo request/reply Source sends ICMP echo request message to the destination address Echo request packet contains sequence number and timestamp Destination replies with an ICMP echo reply message containing the data in the original echo request message Source can calculate round trip time (RTT) of packets If no echo reply comes back then the destination is unreachable 37

Ping (cont d) A R1 R2 R3 B Echo request Time Echo reply 38 Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc.

Traceroute Traceroute records the route that packets take A clever use of the TTL field When a router receives a packet, it decrements TTL If TTL=0, it sends an ICMP time exceeded message back to the sender To determine the route, progressively increase TTL Every time an ICMP time exceeded message is received, record the sender s (router s) address Repeat until the destination host is reached or an error message occurs 39

Traceroute (cont d) A TTL=1, Dest = B, port = invalid R1 R2 R3 Te = Time exceeded Pu = Port unreachable B Te (R1) TTL=2, Dest = B Time TTL=3, Dest = B Te (R2) Te (R3) TTL=4, Dest = B Pu (B) 40 Riste Stojanov, M.Sc., Aleksandra Bogojeska, M.Sc., Vladimir Zdraveski, B.Sc.