Network Layer 1(3.11).ppt

Embed Size (px)

Citation preview

  • 8/11/2019 Network Layer 1(3.11).ppt

    1/46

    13/10/2014

    Computer Networks

    Network Layer

  • 8/11/2019 Network Layer 1(3.11).ppt

    2/46

  • 8/11/2019 Network Layer 1(3.11).ppt

    3/46

    Physical

    layer

    Data link

    layer

    Physical

    layer

    Data link

    layer

    End system

    a

    Networklayer

    Physical

    layer

    Data link

    layer

    Physical

    layer

    Data link

    layer

    Transport

    layer

    Transport

    layer

    Messages

    Messages

    Segments

    End system

    b

    Network

    service

    Network

    service

    Network

    layer

    Networklayer

    Networklayer

  • 8/11/2019 Network Layer 1(3.11).ppt

    4/46

    13/10/2014

    Position of the network layer

    piece of the network layer in each and every host and router inthe network

    unlike upper layers

  • 8/11/2019 Network Layer 1(3.11).ppt

    5/46

    13/10/2014

    Network layer

    Responsible for the delivery of individual packets

    from source host to destination host Major duties

    Internetworking making that all the physical networks look like a single network

    Addressing uniquely& universally define the connection of a node in thenetwork

    Routing packet transport through the network via different routes

    Packetizing Transport layer data (segments) encapsulation Fragmenting

    Breaking an arbitrary size datagrams into smaller pieces

    In some networkconnection setup

  • 8/11/2019 Network Layer 1(3.11).ppt

    6/46

    13/10/2014

    Internetworking

    Internetwork made out of 4 LANs and 1 WAN

    network-to-network data transmission

    router

  • 8/11/2019 Network Layer 1(3.11).ppt

    7/46

    13/10/2014

    Links in an internetworking

    How does router S1knows that data arrived at f1have to besent out on f3?

    Soln, Introduce network layer

  • 8/11/2019 Network Layer 1(3.11).ppt

    8/46

    13/10/2014

    General Functionality of Network layerat the source

    creates both destination and source address

    checksum maker

  • 8/11/2019 Network Layer 1(3.11).ppt

    9/46

    13/10/2014

    General Functionality of Network layerat the router

    fragmentation

    optional

  • 8/11/2019 Network Layer 1(3.11).ppt

    10/46

    13/10/2014

    General Functionality of Network

    layer

    at the destinationaddress verificationerror detection

    reassembly

  • 8/11/2019 Network Layer 1(3.11).ppt

    11/46

    We interested in

    The network layer of the Internet Communication at the network layer in the

    Internet is connectionless

    ie no connection setup

    13/10/2014

    forwardingtable

    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

    ARP / RARPAddress mapping

  • 8/11/2019 Network Layer 1(3.11).ppt

    12/46

    13/10/2014

    Internet Protocol (IP)

    Connection-less unreliable protocol with

    the best-effort delivery service (why?)

    Best effort: no error correction or flow control

    Use error detection: discard the corrupted

    packet

    Combined with TCP if reliability is

    important

  • 8/11/2019 Network Layer 1(3.11).ppt

    13/46

    13/10/2014

    IPv4 datagram format(352)

    header + data

    2^16-1 in bytes

    used in

    fragmentation

    max. number

    of hops

    TCP, UDP,

    ICMPused for

    testing and

    debugging

    Types of

    services

  • 8/11/2019 Network Layer 1(3.11).ppt

    14/46

    IPv4 datagram format

    Protocol8 bits, used in destination host,indicates the specific destination protocol

    to which the IP datagram is delivered

    13/10/2014

  • 8/11/2019 Network Layer 1(3.11).ppt

    15/46

    IPv4 datagram format

    Header Checksum16 bits, aidsdetecting bit error in IP datagram

    Covers only header

    Not dataWhy?

    eg- calculation

    13/10/2014

  • 8/11/2019 Network Layer 1(3.11).ppt

    16/46

    IPv4 datagram format Source Address32 bit value defines the

    IP address of sending host

    Destination Address32 bit value

    defines the IP address of the receiving host

    13/10/2014

  • 8/11/2019 Network Layer 1(3.11).ppt

    17/46

    IPv4 datagram format Optionscan vary up to 40bytes, used for

    network testing, debugging

    13/10/2014

  • 8/11/2019 Network Layer 1(3.11).ppt

    18/46

    IP Fragmentation & Reassembly Each network links have MTU (max. transfer unit) - largest possible

    link-level frame. different link types, different MTUs

    13/10/2014

    Network

    Layer

    Data Link

    Layer

  • 8/11/2019 Network Layer 1(3.11).ppt

    19/46

    IP Fragmentation & Reassembly large IP datagram divided

    (fragmented) within net one datagram becomes several

    datagrams

    reassembled only at final

    destination

    IP header bits used to identify,and order related fragments

    fragmentation:in:one large datagram

    out:3 smaller datagrams

    reassembly

    Identification- 16 bit, identify a datagram

    originating from the source host

    Flag3 bits

    Offset13 bits, shows relative position of thefragment to the whole datagram,

    Measured in 8 bytes

  • 8/11/2019 Network Layer 1(3.11).ppt

    20/46

    IP Fragmentation & Reassembly -example Original Datagram

    4000 byte data 20 byte header

    MTU

    1400 byte (1stlevel)

    800 byte (2ndlevel)

    13/10/2014

  • 8/11/2019 Network Layer 1(3.11).ppt

    21/46

    13/10/2014

    Network layer

  • 8/11/2019 Network Layer 1(3.11).ppt

    22/46

    13/10/2014

    Addressing

    Hosts and routers connected to the

    network through an interface

    A host has one interface only

    A router has one interface for each

    network it interconnects

    receives packet from one link on one interface

    and forwards it to another link on another

    interface

    IP address is associated with an interface

    rather than with a host or a router

  • 8/11/2019 Network Layer 1(3.11).ppt

    23/46

    13/10/2014

    Addressing Need to uniquely identify each device on the Internet

    analogy with the telephone system

    two devices on the Internet (should) never have the same address

    IP address

    32 bit address (IPv4)

    128 bit address (IPv6)

  • 8/11/2019 Network Layer 1(3.11).ppt

    24/46

    13/10/2014

    Addressing (cntd)

    Dotted-decimal notation

    128.11.3.1

    128.11.3.2

    128.11.3.3

    128.11.3.4128.11.2.1

    128.11.4.21

    128.11.2.21

    128.11.4.5128.11.4.2

    128.11.2.22

    interface

    address

  • 8/11/2019 Network Layer 1(3.11).ppt

    25/46

    13/10/2014

    Addressing

    1. Classful

    2. Classless

  • 8/11/2019 Network Layer 1(3.11).ppt

    26/46

    13/10/2014

    Classful (IP) addressing

    Based on the first few bits we can determine the class of address

    0-127

    128-191

    192-223

    224-239

    240-255

    unicast

    addresses

    multicast add.

    reserved add.

  • 8/11/2019 Network Layer 1(3.11).ppt

    27/46

    13/10/2014

    Netid & hostid

    Class A:128 blocks with 16 777 216 addresses each -> wasted!

    Class B: 16 368 blocks with 65 536 addresses each -> wasted!

    Class C: 2 097 152 blocks with 256 addresses each -> not enough

    Class D: 1 block

    Class E:1 block

    Classful addressing offers inefficient use of the address space

    Example: Class B65K addresses may be assigned to an organizationwith 2K hosts

  • 8/11/2019 Network Layer 1(3.11).ppt

    28/46

    13/10/2014

    Network address

    Defines the network itself (cannot be assigned to a host)

    Properties

    all host id are 0s

    defines the networkto the rest of the Internet

    What is the networkdefinition now (from IP add. perspective)?

  • 8/11/2019 Network Layer 1(3.11).ppt

    29/46

    13/10/2014

    A simple internet with classful add.

    Token Ring LAN

    What is the network

    address? What class?

    What is the netid?

    Ethernet LAN

    Ethernet LAN

  • 8/11/2019 Network Layer 1(3.11).ppt

    30/46

    13/10/2014

    Subnetting

    Dividing networks into smaller parts more levels of hierarchy

    Hierarchy in addressing Network (site)

    subnetwork

    host

    Example: Department basedhost grouping at the University

    The outside world sees one network only

    connection

    hierarchy in

    telephony(040) 247 1000

    area code exchange

  • 8/11/2019 Network Layer 1(3.11).ppt

    31/46

    13/10/2014

    Subnetting (cntd)

    3 hierarchy levels

    Site

    Subnet

    Host

    Add i

  • 8/11/2019 Network Layer 1(3.11).ppt

    32/46

    13/10/2014

    Addressing-mask-

    Routing is based on both networkand subnetwork addresses

    Analogy: Parcel delivery> zip code and street address How can a router find the network or the subnetwork address to

    route the packet? 1. Use default mask

    2. Use a subnet mask

    Default mask: 32-bit binary number ANDed with the address in

    the block1. if the bit in the mask = 1, then retain the bit in the address

    2. if the bit in the mask 1, then put 0

    Class In BinaryIn Dotted-

    Decimal

    Using

    Slash

    A 11111111 00000000 00000000 00000000 255.0.0.0 /8

    B 11111111 11111111 00000000 00000000 255.255.0.0 /16

    C 11111111 111111111 11111111 00000000 255.255.255.0 /24

    numberof 1s

  • 8/11/2019 Network Layer 1(3.11).ppt

    33/46

    13/10/2014

    Addressing-mask-

    Example:A router outside an organization receives a packet withthe destination 190.240.7.91. How it finds the networkaddress to route the packet?

    Solution:1. First byte of the address defines a class. Class B.2. The default mask for class B is 255.255.0.0. The router

    ANDs this with the packet address to get 190.240.0.0.

    3. The router looks in the routing table to forward thepacket to the appropriate network.

    Q: How to find a destination within the network?

    Add i

  • 8/11/2019 Network Layer 1(3.11).ppt

    34/46

    13/10/2014

    Addressing

    - subnet mask -

    A router inside an organization receives a packet with thedestination 190.240.7.91. How it finds the subnetwork address to

    route the packet?

    Solution:

    1. Assume the subnet mask is /19.

    2. The router applies the mask to the address 190.240.7.91.

    Obtained subnet address is: 190.240.32.0.

    3. The router looks in the routing table to find how to route the

    packet to a destination.

  • 8/11/2019 Network Layer 1(3.11).ppt

    35/46

    13/10/2014

    Addressing

    1. Classful

    2. Classless

  • 8/11/2019 Network Layer 1(3.11).ppt

    36/46

    13/10/2014

    Classless addressing

    Solving problems with classful addressing: 256 < the number of IP addresses < 16 777 216

    what if one needs at home 2 addresses only? 254 wasted?

    Solution: Classless addressing

    addresses provided by an Internet Service Provider (ISP)

    ISP divides blocks of addresses into groups of 2, 4, 8, 16

    Variable-length blocks that belong to no class

    the number of address block must be a power of 2

    Classless InterDomain Routing (CIDR)(359 page)

  • 8/11/2019 Network Layer 1(3.11).ppt

    37/46

    13/10/2014

    Analogy

    Give an analogy for the network host-to-

    host delivery that requires point-to-point

    delivery?

  • 8/11/2019 Network Layer 1(3.11).ppt

    38/46

    13/10/2014

    Obtaining a network address

    To obtain a block of IP addressesadministrator might first contact its ISP

    ISP gives it the block from the larger

    block already allocated to ISPExample (subnetting):

    ISPs block 200.23.16.0/20 11001000 00010111 00010000 00000000

    Organization 0 200.23.16.0/23 11001000 00010111 00010000 00000000

    Organization 1 200.23.18.0/23 11001000 00010111 00010010 00000000

    Organization 2 200.23.20.0/23 11001000 00010111 00010100 00000000

    .

    .

    Organization 7 200.23.30.0/23 11001000 00010111 00011110 00000000

  • 8/11/2019 Network Layer 1(3.11).ppt

    39/46

    13/10/2014

    An example

    single network prefix is used to advertise multiple networks:route aggregation

    200.23.16.0/23

    200.23.18.0/23

    200.23.20.0/23

    200.23.30.0/23

    ISP 1

    ISP 2

    The Internet

    send me anything with address

    beginning 200.23.16.0/20

    send me anything with address

    beginning 199.31.16.0/16

    organization 0

    organization 1

    organization 2

    organization 7

  • 8/11/2019 Network Layer 1(3.11).ppt

    40/46

    13/10/2014

    An example (cntd)

    200.23.16.0/23

    200.23.18.0/23

    200.23.20.0/23

    200.23.30.0/23

    ISP 1

    ISP 2

    send me anything with address

    beginning 200.23.16.0/20

    send me anything with address

    beginning 199.31.16.0/16 or

    200.23.30.0/23

    organization 0

    organization 1

    organization 2

    organization 7

    The Internet

  • 8/11/2019 Network Layer 1(3.11).ppt

    41/46

    13/10/2014

    Some rules for IP addressing

    1. The first address in the block can be found by setting the 32-nrightmost bits in the binary notation of the address to 0s.

    Example: what is the first address in the block if one of the

    addresses is 205.16.37.39/28?

    A: 11001101 00010000 00100101 00100111

    11001101 00010000 00100101 00100000 -> 205.16.37.322. The last address in the block can be found by setting the

    rightmost 32-nbits to 1s.

    what is the last address in the block if one of the addresses is

    205.16.37.39/28?

    A: 11001101 00010000 00100101 0010011111001101 00010000 00100101 00101111 -> 205.16.37.47

    3. The number of addresses in the block is 232-n

    For the value of n=28 the number of addresses is 16.

  • 8/11/2019 Network Layer 1(3.11).ppt

    42/46

    13/10/2014

    Exercise

    An ISP is granted a block of addresses starting with 190.100.0.0/16

    (How many addresses are available?). The ISP needs to distribute

    these addresses to 3 groups of customers:

    1. 1stgroup: 64 customers; each needs 256 addresses

    2. 2ndgroup: 128 customers; each needs 128 addresses

    3. 3rdgroup: 128 customers; each needs 128 addresses

    Design the sub-blocks and find out how many addresses are

    available after these allocations.

  • 8/11/2019 Network Layer 1(3.11).ppt

    43/46

    13/10/2014

    Solution

    Group1: 256 addresses-> 8 bits-> 32-8=24 bits forthe mask 1stcustomer: 190.100.0.0/24190.100.0.255/24

    2ndcustomer: 190.100.1.0/24190.100.1.255/24

    64thcustomer: 190.100.63.0/24190.100.63.255/24

    Total: 64x256=16 384

    Group2: 128 addresses->7 bits-> 32-7=25 mask bits 1stcustomer: 190.100.64.0/25190.100.64.127/25

    2ndcustomer: 190.100.64.128/25190.100.64.255/25

    128thcustomer: 190.100.127.128/25190.100.127.255/25

    Total: 128x128=16 384

  • 8/11/2019 Network Layer 1(3.11).ppt

    44/46

    13/10/2014

    Obtaining a host address

    Manual configuration put an IP address in the file

    Dynamic Host Configuration Protocol (DHCP)

    IP assigned automatically host learns about its subnet mask and IP of both theDNS server & the first-hop router

    very useful when hosts are frequently joining &leaving network

    dormitories, classrooms, libraries

    address assigned on a temporarily basis 2000 hosts in total; 400 hosts on line -> 512 IP addresses

    are sufficient

  • 8/11/2019 Network Layer 1(3.11).ppt

    45/46

    13/10/2014

    DHCP

    a client-server protocol client: typically a newly arriving host

    arriving DHCP

    client

    223.1.1.1

    223.1.1.2

    223.1.1.3

    223.1.1.4 223.1.2.9

    223.1.3.1 223.1.3.2

    223.1.3.27 223.1.2.2

    223.1.2.1

    223.1.2.5DHCP server

  • 8/11/2019 Network Layer 1(3.11).ppt

    46/46

    DHCP (cntd)(479 page)

    Host knows neither the IP address of the network itwants to attach to, nor the IP add. of the DNS server

    1. DHCP server discovery

    broadcast DHCP discovery message (sent within UDP on

    port 67)

    destination address 255.255.255.255

    source address 0.0.0.0

    2. DHCP server offers

    proposed IP address, network mask, IP address leas time

    3. DHCP request4. DHCP ACK