420 likes | 559 Views
IT 605 Computer Networks. Prof. A. Sahoo KReSIT, IIT Bombay. Network layer. Need: Hide type of subnet Ethernet, Token Ring, FDDI ... Hide topology of subnets Provides: Uniform addressing Packet delivery. IP characteristics. IP can run on Ethernet (CSMA/CD) FDDI (token ring)
E N D
IT 605 Computer Networks Prof. A. Sahoo KReSIT, IIT Bombay
Network layer • Need: • Hide type of subnet • Ethernet, Token Ring, FDDI ... • Hide topology of subnets • Provides: • Uniform addressing • Packet delivery
IP characteristics • IP can run on • Ethernet (CSMA/CD) • FDDI (token ring) • telephone trunks (SONET or PDH) • wireless links (CSMA/CA) • satellite links (ALOHA) • other technologies like X.25, ISDN • underlying technology can be upgraded without affecting TCP/IP
Network layer functions • Internetworking • uniform addressing scheme • Routing • choice of appropriate paths from source to destination • Congestion Control • avoid overload on links/routers
Addressing • Address: byte-string that identifies a node; usually unique • physical address: device level • network address: network level • logical address: application level
Addressing • unicast: node-specific • broadcast: all nodes on a network • multicast: some subset of nodes on the network
Addressing • Addresses need to be globally unique, so they are hierarchical • Another reason for hierarchy: aggregation • reduces size of routing tables • at the expense of longer routes
IP addressing • Internet Protocol (IP) • connectionless packet delivery and “best-effort” quality of service • Every host interface has its own IP address • Routers have multiple interfaces, each with its own IP address
223.1.1.1 223.1.2.1 223.1.2.9 223.1.1.4 223.1.1.2 223.1.2.2 223.1.1.3 IP addressing example 11011111 00000001 00000001 00000001 223 1 1 1
IPv4 addresses • Logical address at network layer • 32 bit address space • Network number, Host number • boundary identified by a subnet mask • can aggregate addresses within subnets • Machines on the same "network" have same network number
IP address notation • Dotted decimal notation • 144.16.111.2 (Class B) • 202.54.44.120 (Class C) • Special Conventions • All 0s -- this host • All 1s -- limited broadcast
Address classes • Class A addresses - 8 bits network number • Class B addresses - 16 bits network number • Class C addresses - 24 bits network number
Address classes • Distinguished by leading bits of address • leading 0 => class A (first byte < 128) • leading 10 => class B (first byte in the range 128-191) • leading 110 => class C (first byte in the range 192-223)
class 1.0.0.0 to 127.255.255.255 A network 0 host 128.0.0.0 to 191.255.255.255 B 192.0.0.0 to 239.255.255.255 C multicast address 1110 network host 110 240.0.0.0 to 247.255.255.255 D network 10 host 32 bits IP addresses
IP address issues • Inefficient: wasted addresses • Inflexible: fixed interpretation • Not scalable: • Number of networks is growing • Not enough network numbers
IP addressing schemes • Sub-netting: Create sub networks within an address space • CIDR: Variable interpretations for the network number • DHCP: Dynamic host configuration • Ipv6: 128 bit address space
Sub-netting • Breaks larger network to many smaller networks • Reduces the broadcast domain (hence network traffic within a subnet) • Simplifies network management (smaller network => simpler management) • To create subnetwork bits from the host portion of the IP address is taken and used to define subnets.
Subnet mask • For subnet scheme to work, every machine on the network must know which part of the host address will be used as subnet mask. • Accomplished by assigning subnet mask to each machine • When no subnetting : use default subnet mask e.g. • Class A : 255.0.0.0 • Class B : 255.255.0.0 • Class C : 255.255.255.0
Subnetting class C address • Only 8 bits are available for hosts : possible subnet masks are: • 10000000 = 128 • 11000000 = 192 • 11100000 = 224 • 11110000 = 240 • 11111000 = 248 • 11111100 = 252 • 11111110 = 254
Subnetting class C address • Cannot have only 1 bit for subnetting (as per RFC) • Also need at least 2 bits for hosts (with 1 bit, you cannot have a valid host address, since the bit will be used up for network id and broadcast id) • Hence only valid subnet masks are from 192 to 252. • Subnet id cannot be all zero or all ones e.g. if subnet id is 192 (11000000), then only subnet id (01000000) and (10000000) are allowed.
Subnetting class C address • Example Subnet id 01000000 (64) • The subnet id : 01000000 = 64 • First valid host id : 01000001 = 65 • Last valid host id : 01111110 = 126 • Broadcast address : 01111111 = 127
Classless Inter Domain Routing (CIDR) • Medium sized networks choose class B addresses, leading to wasted space • allow ways to represent a set of class C addresses as a block, so that class C space can be used • use a CIDR mask • RFC 1518 and 1519
IP header • Source andDestination IP addressesof 4 bytes each • Version number: IPv4, next IPv6 • IHL: header length, can be max. 60 bytes. • 20 byte fixed part and a variable length optional part • Total length: max. 65 535 bytes presently (header + data)
IP header • Type of Service (ToS): to be used for providing quality of service • TTL (Time to Live): reduced by one at each router. Packet is dropped at the router which decrements TTL to 0.Prevents indefinite looping • Checksum: over header, NOT data
IP header • Protocol: 1=ICMP, 6=TCP, 17=UDP • RFC 1700 for well known protocols • Identification, 3-bit flags and fragment offset (4 bytes) fields used for fragmentation and reassembly of packets • DF: “Don’t fragment” bit. • MF: More fragments bit.
32-bit IP address ARP RARP 48-bit Ethernet address Address Resolution Protocol (ARP) RFC 1010 • Address resolution provides mapping between IP addresses and datalink layer addresses • point-to-point links don’t use ARP, have to be configured manually
ARP request/reply; cache • ARP requests are broadcasts • “Who owns IP address x.x.x.x.?”. • ARP reply is unicast • ARP cacheis created and updated dynamically • arp –a displays entries in cache • Every machine broadcasts its mapping when it boots
Reverse Address Resolution Protocol (RARP, RFC 906) • Diskless clients request RARP servers • DHCP for dynamic allocation • BOOTP is another such protocol
IP forwarding at a Host • Destination on my net? • If yes, • use ARP and deliver directly • If not, • give to default gateway
IP forwarding at a Gateway • Am I the destination IP? • If yes, • deliver packet to higher layer • If not, • which interface to forward on? • consult Routing Tables to decide
ICMP (Internet Control Message) • Unexpected events are reported to the source by routers, using ICMP • ICMP messages are of two types: query, error • ICMP messages are transmitted by IP datagrams (layered above IP) • ICMP messages, if lost, are not retransmitted
Example ICMP messages • “destination unreachable”(type 3) • can’t find destination network or protocol • “time exceeded”(type 11) • expired lifetime (TTL reaches 0): symptom of loops or congestion . . .
Example ICMP messages • redirect • advice sending host of a better route • echo request,echo-reply(query) • testing if destination is reachable and alive • timestamp request, timestamp-reply • sampling delay characteristics
ICMP header • 8-byte header • 15 values for the type field identify the particular ICMP message • Code values are then used to further specify the error condition 16-bit checksum 8-bit type 8-bit code (contents depend on type and code)
ICMP types TypeCodedescription 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header
MTU: maximum transmission unit • Maximum packet size usable for an IP packet • Ethernet = 1500 • FDDI = 4352 • X.25 = 576 • Frame Relay = 1600 or more • ATM with AAL5 = 9180 • Hyper channel (bet. CPU and disk) 65535 • PPP = 296 to 1500
Path MTU discovery • Source sets DF bit on a large datagram to estimate Path MTU • When MTU exceeds that of any link, corresponding router sends an ICMP “Destination Unreachable” • Source reduces path MTU estimate to smaller value
length =1500 length =4000 length =1040 length =1500 ID =x ID =x ID =x ID =x fragflag =0 fragflag =1 fragflag =0 fragflag =1 offset =0 offset =0 offset =1480 offset =2960 IP fragmentation & reassembly One large datagram becomes several smaller datagrams
Ping • Used to test • destination reachability • compute round trip time • count the # of hops to destination • Sample output: Reply from 164.107.144.3: 48 bytes in 47 msec. TTL: 253
Traceroute • Exploit TTL and ICMP • Send the packet with time-to-live = 1 (hop) • The first router discards the packet and sends an ICMP “time-to-live exceeded message” • Send the packet with time-to-live = 2 (hops) etc…