3 The Internet Protocol -IP The Internet (IP) ProtocolIPv4 addressingMoving a datagram from source to destinationDatagram formatIP fragmentationICMP: Internet Control Message ProtocolDHCP: Dynamic Host Configuration ProtocolNAT: Network Address TranslationRouting
4 The Internet Network Layer Transport layer: TCP, UDPIP protocoladdressing conventionsdatagram formatpacket handling conventionsRouting protocolspath selectionRIP, OSPF, BGPNetworklayerforwardingtableICMP protocolerror reportingrouter “signaling”Link layerphysical layer
5 IP Addressing IP address: 32-bit identifier for host, router interface IP address: 32-bit identifier for host, router interfaceinterface: connection between host/router and physical linkrouter’s typically have multiple interfaceshost may have multiple interfacesIP addresses associated with each interface=223111
6 IP Addressing IP address: network part (high order bits)host part (low order bits)What’s a network ? (from IP address perspective)device interfaces with same network part of IP addresscan physically reach each other without intervening routerLANnetwork consisting of 3 IP networks(for IP addresses starting with 223,first 24 bits are network address)
7 IP Addressing How to find the networks? How to find the networks?Detach each interface from router, hostcreate “islands of isolated networksInterconnectedsystem consistingof six networks
8 IP Addresses – Class Full given the notion of “network”, let’s re-examine IP addresses:“class-full” addressing:classtoAnetworkhostBto10networkhosttoC110networkhosttoD1110multicast address32 bits
9 IP Addressing: CIDR Classful addressing: inefficient use of address space, address space exhaustione.g., class B net allocates enough addresses for 65K hosts, even if we only have 2K hosts in that networkCIDR: Classless InterDomain Routingnetwork portion of address of arbitrary lengthaddress format: a.b.c.d/x, where x is # bits in network portion of addressnetworkparthostpart/23
10 IP Subnet Basic concept: A subset of a class A, B or C network.IP addresses that do not use subnets consists ofA network portion, andA host portion.Represents a static two-level hierarchical addressing model.
11 IP Subnet (cont) IP subnets introduces a third level of hierarchy. A network portionA subnet portionA host portionAllow more efficient (and structured) utilization of the addresses.Uses network masks.usually handled together as networkbut with substructure
12 CIDR – IntroductionThe size of the global routing tables have grown very fast in recent years.Caused routers to become saturated.CIDR is a new concept to manage IP networks.Classless Inter Domain Routing.No concept of class A, B, C networks.Reduces sizes of routing tables.
13 CIDR - Basic IdeaAn IP address is represented by a prefix, which is the IP address of the network.It is followed by a slash, followed by a number M.M: number of leftmost contiguous bits to be used for the network mask.Example: / 18
14 CIDR - RulesThe number of addresses in each block must be a power of 2.The beginning address in each block must be divisible by the number of addresses in the block.A block that contains 16 addresses cannot have beginning address asBut the address is possible !
16 Network masksNetwork mask is applied to a class A network ;Mask = series of contiguous 1’s followed by a series of contiguous 0’sNETWORKHOST
17 Natural MasksProvide a mechanism to split the IP address into:A network portion – 10;A host portion – ;IP Address:Mask:Network Host
18 Natural masks Class A, B and C addresses Natural Masks Have fixed division of network and host portionsCan be expressed as masksNatural MasksClass A:Class B:Class C:
19 Subnets out of masks Masks are very flexible. How? Advantage gained: Using masks, networks can be divided into smaller subnets.How?By extending the network portion of the address into the host portion.Advantage gained:We can create a large number of subnets from one network.Can have less number of hosts per network.
21 Subnetting Basic concept The same network can be configured with different masks.Can have subnets of different sizes.Allows better utilization of available addresses.
22 Example Suppose we are assigned a Class C network 18.104.22.168 To be divided into three subnets.Corresponding to three departments.With 110, 45 and 50 hosts respectivelyD1110D245D350
23 Example (cont) - Options X(binary)# of Subnets# of Hosts128219246422483224016248252254Network too smallRules:First IP address = Network AddressLast IP address = Broadcast Address
24 How does one get IP Addresses ? Q: How does a network get the network part of IP addr?A: it gets allocated from the portion of its provider ISP’s address spaceISP's block /20Organization /23Organization /23Organization /23… … ….Organization /23
26 Private Addreses Not routed in Internet Why ? Name IP address range number of IPsclassful descriptionlargest CIDR blockdefined in24-bit block–16,777,216single class A/8RFC 1597 (obsolete), RFC 191820-bit block–1,048,57616 contiguous class Bs/1216-bit block–65,536256 contiguous class Cs/16Not routed in InternetWhy ?
28 Datagram: from source to destination forwarding table in ADest NetMaskNxt RouterMetric12IP datagram:miscfieldssourceIP addrdestdataABEdatagram remains unchanged, as it travels source to destinationAddresses are fields of interest here
29 Datagram: from source to destination forwarding table in AmiscfieldsdataDest NetMaskNxt RouterMetric12Starting at A, send IP datagram addressed to B:look up net. address of B in forwarding tablefind B is on same net. as Alink layer will send datagram directly to B inside link-layer frameB and A are directly connectedABE
30 Datagram: from source to destination forwarding table in AmiscfieldsdataDest NetMaskNxt RouterMetric12Starting at A, dest. E:look up network address of E in forwarding tableE on different networkA, E not directly attachedrouting table: next hop router to E islink layer sends datagram to router inside link-layer framedatagram arrives atcontinued…..ABE
31 Datagram: from source to destination forwarding table in routermiscfieldsDest NetMaskNxt RMetricInterface-1dataArriving at , destined forlook up network address of E in router’s forwarding tableE on same network as router’s interfacerouter, E directly attachedlink layer sends datagram to inside link-layer frame via interfacedatagram arrives at !!! (hooray!)ABE
32 IP Datagram 32 bits IP protocol version number header length (bytes) total datagramlength (bytes)header length(bytes)head.Len(4)type ofService(8)Ver(4)Length(16)forfragmentation/reassembly“type” of data13 bit fragmentoffset(13)16-bit identifier(16)Flgs(3)max numberremaining hops(decremented ateach router)time toLive(8)upperlayer Prot(8)Header Internetchecksum(16)DF+MF32 bit source IP address(32)32 bit destination IP address(32)upper layer protocolto deliver payload toOptions (if any)E.g. timestamp,record routetaken, specifylist of routersto visit.how much overhead?20 bytes of IP= 20 bytes + upper layer (TCP/UDP) + app layer overheaddata(variable length,typically a TCPor UDP segment)
33 Fragmentation/Reassembly network links have MTU (max.transfer size) - largest possible link-level frame.different link types, different MTUslarge IP datagram divided (“fragmented”) within netone datagram becomes several datagrams“reassembled” only at final destinationIP header bits used to identify, order related fragmentsfragmentation:in: one large datagramout: 3 smaller datagramsreassembly
35 NAT – Network Address Translation rest ofInternetlocal network(e.g., home network)10.0.0/24All datagrams leaving localnetwork have same single source NAT IP address: ,different source port numbersDatagrams with source ordestination in this networkhave /24 address forsource, destination (as usual)
36 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 devicescan change addresses of devices in local network without notifying outside worldcan change ISP without changing addresses of devices in local networkdevices inside local net not explicitly addressable, visible by outside world (a security plus).
37 NAT – Network Address Translation NAT translation tableWAN side addr LAN side addr1: hostsends datagram to, 80, , 3345…… ……S: , 3345D: , 801S: , 80D: , 33454S: , 5001D: , 802S: , 80D: , 500134: NAT routerchanges datagramdest addr from, 5001 to , 33453: Reply arrivesdest. address:, 5001
38 NAT – Network Address Translation 16-bit port-number field:60,000 simultaneous connections with a single LAN-side address!NAT is controversial:routers should only process up to layer 3violates end-to-end argumentNAT possibility must be taken into account by app designers, e.g., P2P applicationsaddress shortage should instead be solved by IPv6
39 UDP Checksum – for the entire datagram (header + data) UDPChecksum – for the entire datagram (header + data)Length >=8 – entire datagram
42 ICMPUsed by hosts, routers, gateways to communication network-level informationerror reporting: unreachable host, network, port, protocolecho request/reply (used by ping)Network-layer “above” IP:ICMP msgs carried in IP datagramsICMP message: type, code plus first 8 bytes of IP datagram causing error
43 ICMP Type Code description 0 0 echo reply (ping) dest. network unreachabledest host unreachabledest protocol unreachabledest port unreachabledest network unknowndest host unknownType Code descriptionsource quench (congestioncontrol - not used)echo request (ping)route advertisementrouter discoveryTTL expiredbad IP header