Network-Layer: IPv4 (Internet Protocol) RFC 791. Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly.

Презентация:



Advertisements
Похожие презентации
Network-Layer: IPv4 (Internet Protocol) RFC 791. Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly.
Advertisements

Network-Layer: IPv4 (Internet Protocol) RFC 791. Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Constructing Network Addresses Calculating Subnet Masks.
© 2003, Cisco Systems, Inc. All rights reserved. CSPFA Chapter 9 Routing.
Copyright 2003 CCNA 1 Chapter 8 Routing Fundamentals and Subnets By Your Name.
Copyright 2003 CCNA 1 Chapter 9 TCP/IP Transport and Application Layers By Your Name.
© 2005 Cisco Systems, Inc. All rights reserved. INTRO v Module Summary TCP/IP is the most widely used networking protocol, with functions that can.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Connecting Networks Exploring the IP Packet Delivery Process.
© 2006 Cisco Systems, Inc. All rights reserved. ICND v Managing IP Traffic with ACLs Scaling the Network with NAT and PAT.
© 2006 Cisco Systems, Inc. All rights reserved. ICND v Managing IP Traffic with ACLs Introducing ACLs.
Copyright 2003 CCNA 2 Chapter 17 TCP/IP Suite Error and Control Messages By Your Name.
© 2006 Cisco Systems, Inc. All rights reserved. BSCI v Implementing Multicast IGMP and Layer 2 Issues.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Operating and Configuring Cisco IOS Devices Configuring a Router.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Connecting Networks Exploring How Routing Works.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v BGP Overview Understanding BGP Path Attributes.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Constructing Network Addresses Classifying Network Addressing.
Copyright 2003 CCNA 4 Chapter 11 Scaling IP Addresses By Your Name.
© 2006 Cisco Systems, Inc. All rights reserved. BSCI v Implementing IPv6 Implementing Dynamic IPv6 Addresses.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Customer-to-Provider Connectivity with BGP Connecting a Multihomed Customer to Multiple Service.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Using Outbound Route Filtering.
Транксрипт:

Network-Layer: IPv4 (Internet Protocol) RFC 791

Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly

IP in TCP/IP Stack Media Access Control (Ethernet, Token Ring, FDDI, X.25, PPP, etc.) User Datagram Protocol (UDP) RFC 768 ~ connectionless transport ~ Transmission Control Protocol (UDP) RFC 793 ~ connection-oriented transport ~ Upper-Layer Protocols ~ such as SNMP, telnet, FTP, HTTP, POP3, etc. ~ Upper Transport Network Data Link ARP Internet Control Messaging Protocol (ICMP) RFC 792 Internet Protocol version 4 (IPv4) RFC 791 RARP

Unique addressing allows communication between end stations Path choice is based on location Location is represented by an address UNIX Host Company A Company B Introduction to TCP/IP Addresses Internet

IP Addresses IP addresses are logical addresses (not physical) Every host must have a unique IP address. IP addresses are assigned by a central authority (Internet Corporation for Assigned Names and Numbers -- ICANN) 32 bits Decimal: Binary: HEX: C Е. 28 Includes a network ID and a host ID.

IP Address Classes 1 – 126 Range of first octet:

Special adresses network address (адрес сети) limited broadcast (пакет с таким адресом назначения должен рассылаться всем узлам, находящимся в той же сети, что и источник этого пакета) broadcast (пакет, имеющий такой адрес рассылается всем узлам сети с заданным номером) Loopback interface: – Network Network

Broadcast Addresses (Directed broadcast) (Local network broadcast) X

Private networks A: B: – C: – Reserved for automatic private addressing (DHCP): –

NAT: Network Address Translation Motivation: local network uses just one IP address as far as outside word is concerned: –no need to be allocated range of addresses from ISP: - just one IP address is used for all devices –can change addresses of devices in local network without notifying outside world –can change ISP without changing addresses of devices in local network –devices inside local net not explicitly addressable, visible by outside world (a security plus).

NAT: Network Address Translation S: , 3345 D: , : host sends datagram to , 80 NAT translation table WAN side addr LAN side addr , , 3345 …… S: , 80 D: , S: , 5001 D: , : NAT router changes datagram source addr from , 3345 to , 5001, updates table S: , 80 D: , : Reply arrives dest. address: , : NAT router changes datagram dest addr from , 5001 to , 3345

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 address, port #) stored in NAT table –incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #)

IP Addressing: Solutions Subnetting Variable Length Subnet Mask (VLSM) Supernetting Classless InterDomain Routing (CIDR)

Network prefix and extended network prefix

Subnetting Граница подсети может приходиться на любой из 32 бит в IP адресе Задается маской подсети / network + subnet host This network Directed broadcast Netmask

Network Addressing without Subnets

Network Addressing with Subnets / / / /24

Decimal Equivalents of Bit Patterns = = = = = = = =

IP addressing: CIDR Classfull addressing: –inefficient use of address space –e.g., class B net allocated enough addresses for 65K hosts, even if only 2K hosts in that network CIDR: Classless InterDomain Routing –network portion of address of arbitrary length –address format: a.b.c.d/x, where x is # bits in network portion of address network part host part /23

Hierarchical addressing: route aggregation Send me anything with addresses beginning / / / /23 Fly-By-Night-ISP Organization 0 Organization 7 Internet Organization 1 ISPs-R-Us Send me anything with addresses beginning / /23 Organization Hierarchical addressing allows efficient advertisement of routing information: ISPs-R-Us has a more specific route to Organization 1

CIDR Classless Inter-domain Routing Employ supernetting information in IP routers Advertise smaller CIDR blocks Decreases the routing table size

IP Datagrams

IP packet structure 16-bit total packet length 16-bit identification TOS 4-bit ver 4-bit IHL 13-bit Fr offset flags 3-bit DATA Header checksumTTLProtocol Source address Destination address Options (+padding) Version.Current protocol version is 4. IHL - IP header length. IHL is quantity of 32-bit words in IP header. This field has 4-bit length => maximum header length is 60 bytes TOS - type of service contain of a 3-bit precedence bits (ignored), 4 TOS bits, and unused bit which must be 0. 4 TOS bits: minimize delay maxm,ize throughput maximize reliability minimize monetary cost Only 1 of these 4 bits can be turned on TPL - total packet length is total IP packets length in bytes (IP Header + DATA). Then maximum length of IP packet is bytes. IDENTIFICATION - this field is used when IP need fragment fatagrams. Identification identifies each datagram and is incremented each time a datagram is sent Well see meaning of this field when we talk about fragmentation FLAGS and FRAGMENT OFFEST see also when we talk about fragmentation

IP packet structure DATA 16-bit total packet length 16-bit identification TOS 4-bit ver 4-bit IHL 13-bit Fr offset flags 3-bit Header checksumTTLProtocol Source address Destination address Options (+padding) TTL - time-to-live sets an upper limit of routers through which a datagram can pass. This field is decremented each time when datagram pass the router. When this field became 0 a datagram is dropped by router and ICMP message is sent to datagrams sender PROTOCOL - this field identifies DATA portion of datagram (which protocol is encapsulated into IP datagram). HEADER CHECKSUM is calculated for IP header only. SOURCE and DESTINATION addresses is senders and receivers IP addresses. OPTIONS is a variable-length field which contain some options. Well discuss some of them later. The option field always end on a 32-bit boundary. PAD bytes (value is 0) are added if necessary. DATA is data.

Options (Variable length) type : fc Flag copy indicates whether (1) or not (0) the option field is to be copied when the datagram is fragmented. class0 control 1 reserved 2 debugging and measurement length Counts the length (in bytes) of the option, including the type and length fields. option data Contains data relevant to the option. 0 End of option list. (class0) 1 No operation. (class0) 3 Loose source routing. (class0) 4 Internet time stamp (class2) 7 Record route. (class0) 9 Strict source routing. (class0) option number

Options, detail Record route (number 7, class0) Strict source routing (number 9,class0) Loose source routing (number 3, class0) Internet time stamp (number 4,class2) flag: 0 Time stamps only, stored in consecutive 32-bit words. Pointer+4 1 Each time stamp is preceded by the IP address of the registering module. Pointer+ 8 2 The IP address fields are pre-specified, and an IP module only registers when it finds its own address in the list. time stamp: A 32-bit time stamp recorded in milliseconds since midnight UT (GMT)

Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly

Network-Layer Protocol Operations Each router provides its services to support upper-layer functions X Y A B C Application Presentation Session Transport Network Data Link Physical Application Presentation Session Transport Network Data Link Physical A B C X Y Network Data Link Physical Network Data Link Physical Network Data Link Physical

IP reframing (forwarding) Destination MAC Source MAC Type 0x0800 DATA IP datagram CRC Packet:

Routing table (Examples) UNIX: Destination Gateway Genmask Flags Metric Iface U 0 eth U 0 eth U 0 eth U 0 lo UG 0 eth0 Win2000: Network Destination Netmask Gateway Interface Metric

Routing Algorithm Extract destination IP address, D, and compute the network prefix, N 1.If N matches direct network connection Then resolving D to a MAC address, encapsulating the datagram, and send it 2.Else if host-specific route found Then send the datagram 3.Else if entry exists for network N, send it 4.Else if entry exists for default route, send it 5.Else routing error

Making the Route Decision Host match? Network match? Default gateway? Destination GatewayFlagsInterface UH Int UG A UG B UG A Default UG ( ) B Host 1.1 Host AB Router

Правила маршрутизации Поиск совпадающего адреса хоста. Поиск совпадающего адреса сети. Поиск пункта по умолчанию.

Ethernet and loopback device drivers

Functions of a router

Processing an IP datagram in an IP module

Routing table: sources Initialization of interfaces in process of the booting /8 Directly connected network Default Or re-configure of the interface #ifconfig eth netmask broadcast up Static routes #route add –net netmask eth1 C:>route add mask metric 1 if 2 ICMP-redirects Dynamic routes on router only; from routing daemon (routed, gated, zebra, etc); routing protocols RIP,OSPF, etc

Gateway Redirect ICMP: Internet Control Message Protocol Dynamic host route entry added to senders route table / /24 Router #1 Ping Router #2 Internet IP datagram 1 IP datagram 2 IP datagram 1 ICMP Redirect route add -host gateway

Routed versus Routing Protocol Routed protocol used between routers to direct user traffic Examples: IP, IPX Routing protocol used only between routers to maintain tables Examples: RIP, OSPF, BGP Network Protocol Destination Network Protocol Name Exit Port to Use

Key Functions of the Network Layer Global Addressing Routing Fragmentation and reassembly

IP Fragmentation & Reassembly В сети имеются сегменты с разным типом среды передачи => разные MTU (Max. Transfer Unit) Большие IP дейтаграммы делятся (fragmented) для передачи по участкам сети с малым MTU –Сборка (reassembly) производится только в пункте конечного назначения –Поле IP-заголовка Identification используется для идентификации фрагментов, принадлежащих исходной дейтаграмме fragmentation: in: one large datagram out: 3 smaller datagrams reassembly MTU Ethernet Hader IP HeaderTCP HeaderDATAEternet Trailer MSS

IP packet structure 16-bit total packet lengthTOS 4-bit ver 4-bit IHL DATA Header checksumTTLProtocol Source address Destination address Options (+padding) bit identification flags 3-bit 13-bit Fr offset

Fragmentation: IP Header 16-bit: Identification3-bit: Flags13-bit: Fragment offset 0DFMF Identification: Уникальный номер для каждой дейтаграммы назначается отправителем. Все фрагменты дейтаграммы будут иметь тот же номер идентификации. Flags: 0 Reserved DF Don't Fragment: 0 – фрагментация разрешена, 1 – фрагментация запрещена MF More Fragments: 0 - последний фрагмент этой дейтаграммы, 1 – не последний фрагмент. Fragment Offset: Смещение фрагмента. Устанавливается при фрагментации, используется при сборке. Указывает на какой позиции в поле данных исходной дейтаграммы находится фрагмент. Ед.измерения 64 bit => минимальный размер фрагмента = 8 байт

IP Fragmentation