610 likes | 629 Views
Chapter 4-3 IP header and more. Chapter 4: Network Layer. 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What ’ s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6. 4.5 Routing algorithms Link state Distance Vector
E N D
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing IP header and more
email WWW phone... SMTP HTTP RTP... TCP UDP… IP ethernet PPP… CSMA async sonet... copper fiber radio... Internet Protocol (IP) • Hour Glass Model • Create abstraction layer that hides underlying technology from network application software • Make as minimal as possible • Allows range of current & future technologies • Can support many different types of applications Network applications Network technology IP header and more
Internetwork Design • How do I designate a distant host? • Addressing / naming • How do I send information to a distant host? • What gets sent? • What route should it take? • Must support: • Heterogeneity LAN technologies • Scalability ensure ability to grow to worldwide scale ... ... host host host host host host LAN 1 LAN 2 router router router WAN WAN IP header and more
IP Service • IP supports the following services: • one-to-one (unicast) • one-to-all (broadcast) • one-to-several (multicast) • IP multicast also supports a many-to-many service. • IP multicast requires support of other protocols (IGMP, multicast routing) unicast broadcast multicast IP header and more
IP Datagram Format • 20 bytes ≤Header Size< 24 x 4 bytes = 60 bytes • 20 bytes ≤ Total Length < 216 bytes = 65536 bytes IP header and more
IP Datagram Format • Question: In which order are the bytes of an IP datagram transmitted? • Answer: • Transmission is row by row • For each row: 1. First transmit bits 0-7 2. Then transmit bits 8-15 3. Then transmit bits 16-23 4. Then transmit bits 24-31 • This iscallednetwork byte order or big endian byte ordering. • Note: Many computers (incl. Intel processors) store 32-bit words in little endian format. Others (incl. Motorola processors) use big endian. IP header and more
Little Endian Stores the low-order byte at the lowest address and the highest order byte in the highest address. Base Address+0 Byte0 Base Address+1 Byte1 Base Address+2 Byte2 Base Address+3 Byte3 Intel processors use this order Big Endian Stores the high-order byte at the lowest address, and the low-order byte at the highest address. Base Address+0 Byte3 Base Address+1 Byte2 Base Address+2 Byte1 Base Address+3 Byte0 Motorola processors use big endian. Big endian vs. small endian • Conventions to store a multibyte work • Example: a 4 byte Long Integer Byte3 Byte2 Byte1 Byte0 IP header and more
The IP Protocol(P363 fig. 4.13) • IP Header IP header and more
Fields of the IP Header • Version (4 bits): current version is 4, next version will be 6. • Header length (4 bits): length of IP header, in multiples of 4 bytes • DS/ECN field (1 byte) • This field was previously called as Type-of-Service (TOS) field. The role of this field has been re-defined, but is “backwards compatible” to TOS interpretation • Differentiated Service (DS) (6 bits): • Used to specify service level (currently not supported in the Internet) • Explicit Congestion Notification (ECN) (2 bits): • New feedback mechanism used by TCP IP header and more
Fields of the IP Header • Identification (16 bits): Unique identification of a datagram from a host. Incremented whenever a datagram is transmitted • Flags (3 bits): • First bit always set to 0 • DF bit (Do not fragment) • MF bit (More fragments) Will be explained later Fragmentation IP header and more
Fields of the IP Header • Time To Live (TTL) (1 byte): • Specifies longest paths before datagram is dropped • Role of TTL field: Ensure that packet is eventually dropped when a routing loop occurs Used as follows: • Sender sets the value (e.g., 64) • Each router decrements the value by 1 • When the value reaches 0, the datagram is dropped IP header and more
Fields of the IP Header • Protocol (1 byte): • Specifies the higher-layer protocol. • Used for demultiplexing to higher layers. • Header checksum (2 bytes): A simple 16-bit long checksum which is computed for the header of the datagram. IP header and more
Fields of the IP Header • Options: • Security restrictions • Record Route: each router that processes the packet adds its IP address to the header. • Timestamp: each router that processes the packet adds its IP address and time to the header. • (loose) Source Routing: specifies a list of routers that must be traversed. • (strict) Source Routing: specifies a list of the only routers that can be traversed. • Padding: Padding bytes are added to ensure that header ends on a 4-byte boundary IP header and more
Maximum Transmission Unit • Maximum size of IP datagram is 65535, but the data link layer protocol generally imposes a limit that is much smaller • Example: • Ethernet frames have a maximum payload of 1500 bytes IP datagrams encapsulated in Ethernet frame cannot be longer than 1500 bytes • The limit on the maximum IP datagram size, imposed by the data link protocol is called maximum transmission unit (MTU) • MTUs for various data link protocols: • Ethernet: 1500 FDDI: 4352 • 802.3: 1492 ATM AAL5: 9180 • 802.5: 4464 PPP: negotiated IP header and more
IP Fragmentation • What if the size of an IP datagram exceeds the MTU? • IP datagram is fragmented into smaller units. • What if the route contains networks with different MTUs? • MTUs:FDDI: 4352Ethernet: 1500 • Fragmentation: • IP router splits the datagram into several datagram • Fragments are reassembled at receiver IP header and more
IP Fragmentation • Every network has own Maximum Transmission Unit (MTU) • Largest IP datagram it can carry within its own packet frame • E.g., Ethernet is 1500 bytes • Don’t know MTUs of all intermediate networks in advance • IP Solution • When hit network with small MTU, fragment packets MTU = 2000 host router router MTU = 1500 host MTU = 4000 IP header and more
Reassembly • Where to do reassembly? • End nodes or at routers? • End nodes • Avoids unnecessary work where large packets are fragmented multiple times • If any fragment missing, delete entire packet • Dangerous to do at intermediate nodes • How much buffer space required at routers? • What if routes in network change? • Multiple paths through network • All fragments only required to go through destination IP header and more
Where is Fragmentation done? • Fragmentation can be done at the sender or at intermediate routers • The same datagram can be fragmented several times. • Reassembly of original datagram is only done at destination hosts !! IP header and more
Reassembly IP header and more
What’s involved in Fragmentation? • The following fields in the IP header are involved: Identification When a datagram is fragmented, the identification is the same in all fragments Flags DF bit is set: Datagram cannot be fragmented and must be discarded if MTU is too small MF bit set: This datagram is part of a fragment and an additional fragment follows this one IP header and more
What’s involved in Fragmentation? • The following fields in the IP header are involved: Fragment offset Offset of the payload of the current fragment in the original datagram Total length Total length of the current fragment IP header and more
Example of Fragmentation • A datagram with size 2400 bytes must be fragmented according to an MTU limit of 1000 bytes IP header and more
example total 3800 bytes Data offset = 0/8 = 0 header 3799 1400 2800 bytes 0 header 2 header 3 header 1 1399 2799 3799 1400 2800 bytes 0 fragment1 fragment2 fragment 3 offset = 1400/8 = 175 offset = 2800/8 = 350 offset = 0/8 = 0 IP header and more
Length = 3820, M=0 IP Header IP Data IP Fragmentation Example #1 router host MTU = 4000 IP header and more
3800 bytes Length = 2000, M=1, Offset = 0 Length = 3820, M=0 IP Header IP Data IP Header IP Data Length = 1840, M=0, Offset = 1980 IP Header IP Data 1980 bytes 1820 bytes IP Fragmentation Example #2 MTU = 2000 router router IP header and more
host router Length = 1500, M=1, Offset = 0 Length = 1500, M=1, Offset = 1980 MTU = 1500 IP Header IP Header IP Data IP Data Length = 360, M=0, Offset = 3460 Length = 520, M=1, Offset = 1480 IP Header IP Header IP Data IP Data 1480 bytes 1480 bytes Length = 2000, M=1, Offset = 0 500 bytes 340 bytes IP Header IP Data Length = 1840, M=0, Offset = 1980 IP Header IP Data 1980 bytes 1820 bytes IP Fragmentation Example #3 IP header and more
IP Data IP Data IP Data IP Data Length = 1500, M=1, Offset = 0 IP Header IP Data Length = 520, M=1, Offset = 1480 IP Header IP Data Length = 1500, M=1, Offset = 1980 IP Header IP Data Length = 360, M=0, Offset = 3460 IP Header IP Data IP Reassembly • Fragments might arrive out-of-order • Don’t know how much memory required until receive final fragment • Some fragments may be duplicated • Keep only one copy • Some fragments may never arrive • After a while, give up entire process IP header and more
Determining the length of fragments • To determine the size of the fragments we recall that, since there are only 13 bits available for the fragment offset, the offset is given as a multiple of eight bytes. As a result, the first and second fragment have a size of 996 bytes (and not 1000 bytes). This number is chosen since 976 is the largest number smaller than 1000–20= 980 that is divisible by eight. The payload for the first and second fragments is 976 bytes long, with bytes 0 through 975 of the original IP payload in the first fragment, and bytes 976 through 1951 in the second fragment. The payload of the third fragment has the remaining 428 bytes, from byte 1952 through 2379. With these considerations, we can determine the values of the fragment offset, which are 0, 976 / 8 = 122, and 1952 / 8 = 244, respectively, for the first, second and third fragment. IP header and more
Traceroute and ICMP Source sends series of UDP segments to dest First has TTL =1 Second has TTL=2, etc. Unlikely port number When nth datagram arrives to nth router: Router discards datagram And sends to source an ICMP message (type 11, code 0) Message includes name of router& IP address When ICMP message arrives, source calculates RTT Traceroute does this 3 times Stopping criterion UDP segment eventually arrives at destination host Destination returns ICMP “host unreachable” packet (type 3, code 3) When source gets this ICMP, stops. IP header and more Network Layer 4-33
IP MTU Discovery with ICMP MTU = 2000 • Typically send series of packets from one host to another • Typically, all will follow same route • Routes remain stable for minutes at a time • Makes sense to determine path MTU before sending real packets • Operation • Send max-sized packet with “do not fragment” flag set • If encounters problem, ICMP message will be returned • “Destination unreachable: Fragmentation needed” • Usually indicates MTU encountered host router router MTU = 1500 host MTU = 4000 IP header and more
ICMP Frag. Needed MTU = 2000 MTU = 4000 Length = 4000, Don’t Fragment IP Packet IP MTU Discovery with ICMP MTU = 2000 host router router MTU = 1500 host IP header and more
ICMP Frag. Needed MTU = 1500 MTU = 4000 Length = 2000, Don’t Fragment IP Packet IP MTU Discovery with ICMP MTU = 2000 host router router MTU = 1500 host IP header and more
MTU = 4000 Length = 1500, Don’t Fragment IP Packet IP MTU Discovery with ICMP MTU = 2000 • When successful, no reply at IP level • “No news is good news” • Higher level protocol might have some form of acknowledgement host router router MTU = 1500 host IP header and more
ARP-The Address Resolution Protocol • Situation: Addressing hosts using IP addresses is great, but these addresses are not recognized by the hardware of those hosts. Example: a host on an Ethernet LAN will only read messages encapsulated in frames containing that host’s hardware address. • Problem: How do we find out the hardware (i.e. datalink) address of a host, given its Internet address? IP header and more
ARP-The Address Resolution Protocol 1. Router: Ask each host on the LAN whether they have the requested IP address. This is done by encapsulating the query as an ARP message in a datalink frame, and broadcasting it. IP header and more
How ARP works? IP header and more
ARP-The Address Resolution Protocol 2. Host: Recognizes it is dealing with an ARP message, checks whether it has the requested address, and if so, sends a reply back with its datalink address. Question: how can the host recognize an ARP message? 3. Router: Recognizes a reply ARP message, and (generally) caches the IP address with the datalink address. It can then forward IP datagrams to the correct host, encapsulating them in datalink frames. Question: what should the router do when no one replies? IP header and more
ARP cheat IP header and more
ARP cheat-middle people IP header and more
ARP single-way cheat IP header and more
ARP Man-in-the-Middle Attack,MITM IP header and more
IPv6 Initial motivation:32-bit address space soon to be completely allocated. Additional motivation: header format helps speed processing/forwarding header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowed IP header and more
IPv6 Header • Note: The flow label is used to set up a pseudo connection between source and destination. It identifies a flow for which, for example, bandwidth has been reserved. IP header and more
IPv6 Header (Cont) Priority: identify priority among datagrams in flow Flow Label: identify datagrams in same “flow.” (concept of“flow” not well defined). Next header: identify upper layer protocol for data IP header and more
Other Changes from IPv4 • Checksum:removed entirely to reduce processing time at each hop • Options: allowed, but outside of header, indicated by “Next Header” field • ICMPv6: new version of ICMP • additional message types, e.g. “Packet Too Big” • multicast group management functions IP header and more
IPv6 header vs. IPv4 header IP header and more
IPv6 • Note: A simpler header is almost impossible – further info is provided by next headers. • Note: No checksum, and no fragmentation fields. • IPv6 – Address Space • Big difference: IPv6 uses 16-byte addresses. This is really a lot: 7x1023addresses per square meter. It does allow us to be less efficient with address allocation: 72% is unassigned. IP header and more