170 likes | 359 Views
CS4550 Computer Networks II IP : internet protocol, part 2 : packet formats, routing, routing tables, ICMP read feit chapter 6. IP packet format. 0. 3 4. 15 16. 31. 7 8 10. source IP address. total length. vers. TOS. HLEN. pre. identification. fragment offset. flags. TTL.
E N D
CS4550 Computer Networks IIIP : internet protocol,part 2 : packet formats, routing, routing tables, ICMPread feit chapter 6
IP packet format 0 3 4 15 16 31 7 8 10 source IP address total length vers. TOS HLEN pre. identification fragment offset flags TTL protocol header checksum destination IP address options, (if any) DATA
IP packet - explanation • version -- currently 4; next - 6. • HLEN - header length; 20 to 60 bytes. • total length - packet length in bytes. • precedence (3 bits) - designed for priority, but no standard procedure for this; little used. • TOS - type of service • TTL - time to live (die). Standard specified seconds, but in practice - router hops.
IP packet - explanation • ID - numbers each datagram sent by a host. ( fragmentation/reassembly) • flags - 3 bits. DF, don’t fragment; MF, more fragments. (1st bit unused=0). • frag offset - ( fragmentation/reassembly) • protocol - indicates TCP, UDP, etc. • header checksum - done on header only; recomputed at each hop.
IP routing • routing mechanism - the mechanics of routing; simply, IP routs packets according to a routing table, in memory. • routing policy - how the paths in the networking are calculated- i.e., how the entries in the table are determined. Two separate procedures. • mechanism - differs slightly, depending on whether in a host or a router; simpler for hosts.
IP routing • basic IP routing mechanism: given an IP DA (destination IP address), 1. search table for complete IP DA; if found, send to next hop indicated. 2. search table for network ID; if found, send to next hop indicated. 3. search for default entry; if found, send to next hop indicated. 4. discard the packet.
IP routing : in a host • IP (in host) receives packets to send from TCP, UDP, ICMP, IGMP. upon receipt of a packet to send, IP will 1. check mask (determine net/host parts). 2. if destination directly connected (point-to-point link/ same subnet), then send packet to it. 3. otherwise, send packet to the default router (routing table).
IP routing : in a host • fundamental difference : a host never forwards a packet; IP packets received not for this host are discarded. note : if sending to a host on same subnet (e.g. ethernet), the MAC address corresponds to the IP DA; if sending to default router, the MAC/hardware DA is the router’s, while the IP DA is that of the final destination.
IP routing : in a host TCP, UDP, etc. routing table yes get next hop this IP DA or broadcast packet? no bit bucket input queue IP (host) NW interface
IP routing : in routers Same basic algorithm as stated, but : • routing tables bigger, generally ; • more overhead in maintaining routing tables, exchanging information with other routers; • more network interfaces, generally ; usually at least 2 (hosts may have only 1) • forward packets received onto other routers. (fundamental difference)
IP routing : in routers TCP, UDP, etc. routing table yes get next hop this IP DA or broadcast packet? no input queue IP (router) NW interfaces
IP routing tables • series of entries(non standard) typically(F 8.1) destination - IP address of distant location (either network or host) route mask - AND with packet destination to get matching route destination gateway(router) - IP address of router to send the packet to route metric - metric to use for shortest route calculation, often hop count interface - the outgoing interface for this route; (e.g., ethernet, a direct link, etc. ) Route Age - how many seconds since last update
ICMP : internet control message protocol • required & essential companion protocol to IP • purpose : to provide a tool for notifying routers / hosts of problems (e.g., router down, packet discarded, etc.) • ICMP messages wrapped in IP packets with protocol = 1 • ICMP protocol specifies that messages “should” or “may” be sent; doesn’t require every error be reported
ICMP • sends error messages to report problems on internets, such as • destination unreachable • time exceeded ...{ dead packet :-) } • parameter problem (in IP header) • source quench (router/host is congested) • redirect (host sent a packet to wrong local router)
ICMP • ICMP message NOT sent when --- • routing/delivering ICMP messages • for broadcast/multicast packets • datagram fragments except 1st • source address not unique (e.g., 0.0.0.0)
ICMP message contents“destination unreachable” example • type field (3) • code (some error information) • checksum • IP header and 1st 8 data bytes • other information according to the code field