900 likes | 1.15k Views
CMSC506. IP. IP. Internet Protocol Address Resolution Protocol (ARP) Reverse Address Resolution Protocol (RARP) Internet Control Message Protocol (ICMP). Internet Protocol. What service does it provide? Potential problems IP packet header IP routing
E N D
CMSC506 IP
IP • Internet Protocol • Address Resolution Protocol (ARP) • Reverse Address Resolution Protocol (RARP) • Internet Control Message Protocol (ICMP)
Internet Protocol • What service does it provide? • Potential problems • IP packet header • IP routing • Subnet addressing and masks • Special case of IP addresses
IP: What service does it provide? • End-to-end connectivity over a network • Connectionless: no state maintained about • successive packets (flows) • Unreliable: packets may get lost or thrown • away, or received out of order
Potential Problems • Packets may be received with bit errors • Packets may be lost • Packets may be misrouted, going to • the wrong destination, or getting stuck in • “cycles”.
IP: Packet Header Payload
IP: Packet Header Header Payload • Source address • Destination address • Version: Currently IPV4, also IPV6 • Header Length: # of 32 bit words in the • header • Total Length (16 bit number): in bytes • Max packet size = 65535 bytes
IP: Packet Header • 8-bit Type of Service (TOS) • 3-bit precedence field & D,T,R • TOS bits: • Minimize delay • Maximize throughput • Maximize reliability • Minimize monetary cost • Unused bit set to 0
IP: Packet Header • 8-bit Time to Live (TTL): It’s decremented • every time the packet is forwarded • 16-bit Checksum: Error detection for • the header only. 16-bit ones complement • 8-bit Protocol Field: identifies the protocol • that the IP packet is servicing (TCP, • UDP, ICMP,...)
IP: Packet Header • 16-bit Identification: Normally increments • by one each time a datagram is sent • 13-bit fragmentation offset in 64-bit chunks • 3-bits of flags • Don’t Fragment (DF) • More Fragments (MF) • Unused = 0
IP: Packet Header • Options • Security and handling restrictions • Record route (have each router record • its IP address) • Time stamp (have each router record • its IP address and time) • Loose source routing • Strict source routing • Padding is zeros
IP Routing Destinations • Host sends packet to • Directly connected dest • OR a router Packet Host Router
IP Routing • Is it for me? • Forward according • to routing table Packet Host/Route • Routing Table Entry • Dest IP address • IP address of next-hop router • Flags • Interface to pass packet to Interfaces Ethernet
IP Routing • Actions taken for routing • Search routing table for an entry that exactly • matches the complete destination IP address. • If found then forward accordingly • Default: send according to default entry
IP Routing: Addressing Address hierarchy net id host id Class A, B, C. net id subnet id host id
Subnet A campus network consisting of LANs for various departments
Net Net Subnet Subnet Subnet Subnet Subnet Subnet IP Routing: Addressing Hierarchy
IP Routing: Addressing Example Hierarchical Address: Host id: 2540 Dole Street Subnet id: 96822 Net id: USA Advantage is it can reduce routing complexity
IP Routing: Addressing Post Office Routing Table Destination Address Next PO USA 96822 1234 Dole Street A USA 96822 4567 E-W Center Rd A USA 96822 8901 Univ. Ave A USA 96817 xxx D USA 12485 xxx G JPN xxx H GBR xxx N
IP Routing: Addressing • Routing Table Look Up • Find an exact, complete match of IP dest addr • If unsuccessful then find a match of subnet id • If unsuccessful then find a match of net id • Go to default
IP Routing: Masks Subnet id entry in Routing Table net id, subnet id mask net id subnet id 00000000 Mask 1111111111111111111111100000000 Finding a match Yes, then a match IP dest addr Bit-wise AND =?
IP Routing: Masks Net id entry in Routing Table net id Finding a match Compare net id in table with net id of IP dest addr of packet
IP Routing • Actions taken for routing • Search routing table for an entry that exactly • matches the complete destination IP address. • If unsuccessful then search for a subnet id • match (using masks). • If unsuccessful then search for net id • Default: send according to default entry
netid subnetid hostid Description IP: Special Case IP Addresses 0 0 Host on this net 0 hostid Specify host on this net 127 anything Loopback address -1 -1 Limited broadcast netid -1 Net directed broadcast netid subnetid -1 Subnet-directed broadcast netid -1 -1 All-subnets-directed broadcast to netid
Uniqueness of IP address • Connectionless service? • Layered approach? • What about Non TCP/UDP protocol? • Some use IP address as a test in payload such as FTP, internet telephony protocol H.323 • We have limit on port number too. • IPv6?
Neighbor Greeting: ARP and RARP End nodes and routers find out their neighbors Point-to-point link Network E R Configured with IP address and mask for each link
Neighbor Greeting: ARP and RARP End nodes attached via LANs E4 Network R1 R2 E3 Ethernet E1 E2
Neighbor Greeting: ARP and RARP End nodes attached via LANs R1 Ethernet E1 E2 Ethernet packet dst addr src addr rest of the packet ???
Neighbor Greeting: ARP R1 ARP request broadcast “E1 where are you?” E1 E2 ARP reply: “I am here (give ethernet address)” R1 E1 E2
Neighbor Greeting: ARP Proxy ARP Router responding to ARP messages for another node Proxy R Gratuitous ARP: Request to your own IP address 1. Detect another node with the same IP address 2. Update ARP cache entries if hardware addr changes
Neighbor Greeting: RARP S RARP server RARP request broadcast “What’s my IP address (give ethernet address) ?” E1 E2 Doesn’t know IP addr Look up IP address RARP reply: “Your IP address is xxxx” S E1 E2
Neighbor Greeting: ARP and RARP Ethernet packet Header Payload • Header • Ethernet dst and src addresses • Ethernet frame type = 0x0806 for ARP request • or reply • = 0x0805 for RARP request or • or reply
Neighbor Greeting: ARP and RARP • Payload • Hardware type = 1 for ethernet • Protocol type = 0x800 for IP • Length in octets of layer 2 address = 6 for ethernet • Length in octets of layer 3 address = 4 for IP • Operation • 1 = ARP request • 2 = ARP reply • 3 = RARP request • 4 = RARP reply
Neighbor Greeting: ARP and RARP • Payload • Sender layer 2 address • Sender layer 3 address • Target layer 2 address • Target layer 3 address
Neighbor Greeting: ARP and RARP R1 Ethernet E1 E2 ARP Cache IP dest Ethernet physical addr Time outs flush cache of old entries
Internet Control Message Protocol: ICMP • For the control plane • Uses IP packets • Deals with connectivity • Errors • Redirection
Internet Control Message Protocol: ICMP IP Header ICMP Message 8-bit Type 8-bit Code 16-bit Checksum
Internet Control Message Protocol: ICMP type Description 0 echo reply (ping reply) 3 destination unreachable 4 source quench 5 redirect 8 echo request (ping request) 9 router advertisement 10 router solicitation 11 time exceeded: Time-to-live = 0
Internet Control Message Protocol: ICMP type Description 12 Parameter problem: IP header bad or required option missing 13 Time stamp request 14 Time stamp reply 15 Information request (obsolete) 16 Information reply (obsolete) 17 address mask request 18 address mask reply
type code (0) checksum identifier sequence number 32-bit subnet mask ICMP: Address Mask Request and Reply • It’s used by diskless systems to obtain their • subnet mask Used to match requests with replies
ICMP: Time Stamp Request and Reply It’s used to get the current time (# ms since midnite) type code (0) checksum identifier sequence number 32-bit originate time stamp req sent req recvd 32-bit receive time stamp 32-bit transmit time stamp reply sent
ICMP: Port Unreachable Error Node Z dst src Can’t forward to X for some reason X Y Tells Y that there’s a problem with forwarding to X at Z Header ICMP Y Z dst src
ICMP: Port Unreachable Error • Reasons why a packet can’t be forwarded: • Network or host can’t be reached because • Not in routing table • Administrative or TOS prohibited • Must fragment but packet indicates no fragmentation • Source route failed • Ports or protocol are unavailable
ICMP: Port Unreachable Error ICMP unreachable message type(3) code checksum Unused (must be 0) IP header (including options) + first 8 bytes of original IP datagram data First 8 bytes of original IP datagram includes src & dst port numbers for UDP and TCP headers
More on IP Packets: Options 0 15 16 31 Vers HL TOS Total Length Identification Flags Offset TTL Protocol Header Checksum Source Address Destination Address Options Data
More on IP Packets: Options • Options field is at most 40 bytes • Record Route Option • Timestamp Option • Source Routing