IP Internet Protocol
IP TCP UDP ICMPIGMP ARP PPP Ethernet
The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection RIP, OSPF, BGP IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router “signaling” Transport layer: TCP, UDP Link layer physical layer Network layer
IP Internet Protocol RFC-791 Unreliable Connectionless Dispatch packet to upper protocol Fragmentation & Assembly Routing
IP datagram format ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier Internet checksum time to live 32 bit source IP address IP protocol version number header length (bytes) max number remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes) upper layer protocol to deliver payload to head. len type of service “type” of data flgs fragment offset upper layer 32 bit destination IP address Options (if any) E.g. timestamp, record route taken, specify list of routers to visit. how much overhead with TCP? 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead
Flags & Fragment Bit 0: reserved, must be zero Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment. Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments. Flags : 3 bits DFMF Fragment Offset: 13 bits Unit : 8 octets (64 bits)
IP Fragmentation and Reassembly ID =x offset =0 fragflag =0 length =4000 ID =x offset =0 fragflag =1 length =1500 ID =x offset =185 fragflag =1 length =1500 ID =x offset =370 fragflag =0 length =1040 One large datagram becomes several smaller datagrams Example 4000 byte datagram MTU = 1500 bytes 1480 bytes in data field offset = 1480/8
Protocol number IPPROTO_ICMP 1 IPPROTO_IGMP 2 IPPROTO_GGP 3 IPPROTO_TCP 6 IPPROTO_PUP 12 IPPROTO_UDP 17 IPPROTO_IDP 22 IPPROTO_RSVP 46
Header Checksum How to calculate ? checksum field = 0 sum of 16-bit words checksum = 1’s complement of sum How to verify ? receiver calculate the checksum should be 0xffff (?, 0x0000)
Fragmentation MTU:Maximum Transmission Unit Ethernet : 1500 FDDI : 4352 IEEE 802.3/802.2 : 1492 Path MTU smallest MTU of any data link that packets traverse between the two hosts
IP Addressing: introduction IP address: 32-bit identifier for host, router interface interface: connection between host/router and physical link router’s typically have multiple interfaces host may have multiple interfaces IP addresses associated with each interface =
IP addressing: CIDR CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of address subnet part host part /23
IP addresses: how to get one? Q: How does host get IP address? hard-coded by system admin in a file Wintel: control-panel->network->configuration- >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from a server “plug-and-play”
IP routing routing daemon route command netstat command routing table IP output input queue Destination? no UDPTCP yes
Routing Principles RouteDatagram(Datagram, RoutingTable) extract destination IP address, D, from the datagram and compute the network prefix, N; If N matches any directly connected network address deliver datagram to destination D over that network else if the table contains a host-specific route for D send data gram to next-hop specified in table else if the table contains a route for network N send datagrram to next-hop specified in table else if the table contains a default route send datagram to the default router specified in table else declare a routing error;
Simple Routing Table netstat -rn Destination Gateway Flags Refcnt Use Interface UGH 0 0 emd UH 1 0 lo0 default UG 0 0 emd U emd0