Lecture 2: Internet Protocol (IP) Prof. Shervin Shirmohammadi SITE, University of Ottawa Prof. Shervin Shirmohammadi CEG 4185 2-1
Network Layer Provides the upper layers with independence from the data transmission and physical networking technologies. Responsible for sending data from source to destination. This includes the nodes in between (and therefore it is not end-to-end) Responsible for requesting network facilities, such as priority, bit-rate, etc Responsible for routing. Prof. Shervin Shirmohammadi CEG 4185 2-2
Internetworking Prof. Shervin Shirmohammadi CEG 4185 2-3
Routing Autonomous System (AS): set of networks and routers operated by a single organization. Interior Router Protocol (IRP): passing routing information within and AS. Exterior Router Protocol (ERP): passing routing information between different ASs. Prof. Shervin Shirmohammadi CEG 4185 2-4
Routing Approaches Distance Vector Routing: each node exchanges information with its neighboring nodes; e.g. Routing Information Protocol (RIP). Link-state Routing: sends link costs of each of its network interfaces to all routers (not just neighboring). Typically used with a Dijksterabased algorithm; e.g., Open Shortest Path First (OSPF). Path-vector Routing: router provides information about which networks can be reached by a given router and the ASs that must be crossed; e.g. Border Gateway Protocol (BGP). Prof. Shervin Shirmohammadi CEG 4185 2-5
TCP/IP Protocol Suite vs. OSI Prof. Shervin Shirmohammadi CEG 4185 2-6
OSI Pros and Cons Bad timing (too much detailed concept before actual applications) Similar to ITU-T standards, it tries to design the perfect world, which is either extremely difficult or not possible. Keep in mind: technology and human understanding of how things work (or should work) changes. Bad implementations/technology (mostly difficult to implement) Bad politics Advantages? Prof. Shervin Shirmohammadi CEG 4185 2-7
TCP/IP Pros and Cons Service, interface, and protocol not distinguished. Not a general model. Host-to-network layer not really a layer. Advantages: The Internet and its architecture have grown in evolutionary fashion from modest beginnings, rather than from a Grand Plan. Others? Everything should be made as simple as possible, but not simpler. Albert Einstein Prof. Shervin Shirmohammadi CEG 4185 2-8
Internet Architecture In a TCP/IP internet, IP routers provide interconnection among physical networks. Computers/equipment that interconnect two or more networks and pass packets from one to the other are called internet router. user s view the inside Prof. Shervin Shirmohammadi CEG 4185 2-9
Internet Protocol (IP) The most-widely used Internetworking protocol. Purpose: to connect all networks together; hence and internetworking protocol. IPv4 the most commonly used version (covered in this course). Prof. Shervin Shirmohammadi CEG 4185 2-10
Internetworking Requirements Design requirements: accommodate differences in constituting networks: 1. Different addressing schemes 2. Different maximum packet size 3. Different network access mechanism 4. Different timeouts 5. Different transmission modes (connection-oriented, connectionless) 6. Error control 7. Flow control Prof. Shervin Shirmohammadi CEG 4185 2-11
IP Header Prof. Shervin Shirmohammadi CEG 4185 2-12
1. Different Addressing Scheme Introduce IP address as a global address All hosts on the Internet must have a unique IP address Exception: techniques such as IP-forwarding allow private IP addresses that might be duplicated somewhere else. Prof. Shervin Shirmohammadi CEG 4185 2-13
IP Address Classes Prof. Shervin Shirmohammadi CEG 4185 2-14
Address Range Prof. Shervin Shirmohammadi CEG 4185 2-15
IP Addresses - Class A 32 bit global internet address Network part and host part Class A Start with binary 0 All 0 reserved (0.x.x.x) 01111111 (127) reserved for loopback (127.x.x.x) Range 1.x.x.x to 126.x.x.x All allocated! Prof. Shervin Shirmohammadi CEG 4185 2-16
IP Addresses - Class B Start 10 Range 128.x.x.x to 191.x.x.x Second Octet also included in network address 2 14 = 16,384 class B addresses (network part) All allocated! Prof. Shervin Shirmohammadi CEG 4185 2-17
IP Addresses - Class C Start 110 Range 192.x.x.x to 223.x.x.x Second and third octet also part of network address 2 21 = 2,097,152 addresses (network part) Only 2 8 = 256 hosts per network! Nearly all allocated Prof. Shervin Shirmohammadi CEG 4185 2-18
Example of IP addresses Prof. Shervin Shirmohammadi CEG 4185 2-19
Subnets and Subnet Masks Allow arbitrary complexity of internetworked LANs within organization. Insulate overall internet from growth of network numbers and routing complexity. To rest of internet, site looks like single network. Prof. Shervin Shirmohammadi CEG 4185 2-20
Subnets and Subnet Masks Each LAN is assigned subnet number. Host portion of address partitioned further into subnet number and host number. Local routers route within subnetted network. Subnet mask indicates which bits are subnet number and which are host number by doing a bitwise AND. Prof. Shervin Shirmohammadi CEG 4185 2-21
Routing Using Subnets Prof. Shervin Shirmohammadi CEG 4185 2-22
2. Different Maximum Size Problem: different networks have different Maximum Transmission Unit (MTU) sizes. What if a packet reaches a network and it exceeds the network s MTU? Solution: Use fragmentation to split large packets into smaller ones. Use reassembly at the destination only to put the fragments together and build the original packet. Prof. Shervin Shirmohammadi CEG 4185 2-23
IP Fragmentation IP re-assembles at destination only! Uses fields in header Data Unit Identifier (ID) Identifies end system originated datagram Source and destination address Protocol layer generating data (e.g. TCP) Identification supplied by that layer Data length Length of user data in octets Offset Position of fragment of user data in original datagram In multiples of 64 bits (8 octets) More flag Indicates that this is not the last fragment Prof. Shervin Shirmohammadi CEG 4185 2-24
Fragmentation Example Prof. Shervin Shirmohammadi CEG 4185 2-25
Dealing with Failure Re-assembly may fail if some fragments get lost Re-assembly time out Assigned to first fragment to arrive If timeout expires before all fragments arrive, discard partial data Prof. Shervin Shirmohammadi CEG 4185 2-26
3. Different Network Access Solved by abstracting networking functions in the Networking layer, and relying on Data Link Layer for networking access. Routers handle the difference in network access mechanism. Prof. Shervin Shirmohammadi CEG 4185 2-27
IP Router Operation Prof. Shervin Shirmohammadi CEG 4185 2-28
Address Mapping Sometimes, in order to reach a destination, there is no need to go trough an IP router. E.g.? In that case, the physical address can be used directly. Prof. Shervin Shirmohammadi CEG 4185 2-29
ARP (Address Resolution Protocol) Prof. Shervin Shirmohammadi CEG 4185 2-30
Reverse ARP Prof. Shervin Shirmohammadi CEG 4185 2-31
4. Different Timeout Problem: different networks use different timeout mechanisms. Solution: Introduce the concept of Datagram Lifetime. Datagrams could loop indefinitely Consumes resources Transport protocol may need upper bound on datagram life Datagram marked with lifetime Time To Live (TTL) field in IP Once lifetime expires, datagram discarded (not forwarded) Hop count Decrement time to live on passing through each router Prof. Shervin Shirmohammadi CEG 4185 2-32
5. Different Transmission Modes Use a connectionless architecture Advantages Flexibility Robust No unnecessary overhead Disadvantages Not guaranteed delivery Not guaranteed order of delivery Reliability is responsibility of upper layers (e.g. TCP) Prof. Shervin Shirmohammadi CEG 4185 2-33
6. Error Control Minimal error control, done only for the header Router should attempt to inform source if packet discarded (using ICMP) e.g. for time to live expiring Not guaranteed delivery May inform high layer protocol Prof. Shervin Shirmohammadi CEG 4185 2-34
7. Flow Control Allows routers and/or stations to limit rate of incoming data Limited in connectionless systems Send flow control packets Requesting reduced flow e.g. ICMP Prof. Shervin Shirmohammadi CEG 4185 2-35
IP Header Prof. Shervin Shirmohammadi CEG 4185 2-36
Header Fields Version (4 bits): currently 4 Internet Header Length (4 bits) Minimum is 5, for 20 octets Header may include options and padding Type of Service (8 bits) rarely used, for differentiated services and congestion notification Total Length (16 bits) of datagram, in octets (header & data) Identification (16 bits) Sequence number Used with addresses and user protocol to identify datagram uniquely Flags (3 bits) Only 2 used; More bit, and Don t Fragment bit Prof. Shervin Shirmohammadi CEG 4185 2-37
Header Fields ( ) Fragmentation offset ( 13 bits) Time to Live (8 bits) Protocol (8 bits) Next higher layer to receive data field at destination Header Checksum (16 bits) Re-verified and recomputed at each router 16 bit ones complement sum of all 16 bit words in header Source Address (32 bits) Destination Address (32 bits) Options (Security, timestamp, ) Padding, to fill to multiple of 32 bits long Prof. Shervin Shirmohammadi CEG 4185 2-38
Data Field Carries upper-layer data. Integer multiple of 8 bits long (octet). Max length of datagram (header plus data) is 65,535 octets. Prof. Shervin Shirmohammadi CEG 4185 2-39
Internet Control Message Protocol Defined in RFC 792. Used for sending control messages between entities: end-hosts interim nodes No data is sent, only control messages (similar to signaling in POTS). Sent directly on top of IP. Has over 40 different messages Prof. Shervin Shirmohammadi CEG 4185 2-40
Common ICMP Messages Full list Prof. Shervin Shirmohammadi CEG 4185 2-41
ICMP example: ping ping is a utility to check whether a given node is alive or not, and what the distance to it is. Named after the sound that a sonar makes. Uses timed ECHO_REQUEST and ECHO_REPLY packets to probe the "distance" to the target machine. Prof. Shervin Shirmohammadi CEG 4185 2-42
ICMP example: tracert tracert is a utility to trace the route between two nodes on the network. You can think of it as a set of ping commands, each with TTL set to 1 hop larger than the previous one. Starts by sending an ICMP Echo request message with destination s IP address with TTL set to 1. The first node receiving the packet decrements the TTL and discards the message, sending an ICMP "TTL exceeded message to the sender. Receipt of this message allows the sender to identify which system is one link away. The sender repeats the above with TTL=2, 3, and so on, until it reaches the target destination. This gives a topological view of the network route from the sender to the destination. Things to consider: Where alternate paths are possible, results may vary. Some Routers are configured to discard ICMP messages, while others process them but do not answer. Such routers hide the path of the network. Prof. Shervin Shirmohammadi CEG 4185 2-43