DataCommChapter 6 Part 1

download DataCommChapter 6 Part 1

of 63

Transcript of DataCommChapter 6 Part 1

  • 8/14/2019 DataCommChapter 6 Part 1

    1/63

    1

    Chapter 6

    Internetworking Protocol

    Main reference: Copyright The McGraw-Hill Companies.

  • 8/14/2019 DataCommChapter 6 Part 1

    2/63

    2

    Part 1

    6.16.1 InternetworkingInternetworking

    6.26.2 Internet ProtocolInternet Protocol

    6.36.3 IPv4 vs.IPv6IPv4 vs.IPv6

  • 8/14/2019 DataCommChapter 6 Part 1

    3/63

    3

    6.1: INTERNETWORKING6.1: INTERNETWORKING

    Internetworking is connecting networks together to Internetworking is connecting networks together to

    make an internetwork or an internet.make an internetwork or an internet.

  • 8/14/2019 DataCommChapter 6 Part 1

    4/63

    4

    Links between two hosts

    Physical & data link layers operate locally

    Problem: When data arrive at the interface f1 of S1, how does S1 know that

    Interface f3 is the outgoing interface?

    To solve this problem, the network layer was designed.

  • 8/14/2019 DataCommChapter 6 Part 1

    5/63

    5

    Network layer in an internetwork

    The network layer is responsible for host-to-host delivery and for routing the packets

    through the routers or switches.

  • 8/14/2019 DataCommChapter 6 Part 1

    6/63

    6

    Network layer at the source, router, and destination

    Creating a packet from the data comingfrom another protocol.

    Checking its routing to find the routing

    information.

    Address verification: ensure the destinationaddress on the packet is the same in the host.

    Fragmentation: waits for all fragments,

    reassembles them and then delivers the

    reassembled packet to the transport layer.

  • 8/14/2019 DataCommChapter 6 Part 1

    7/63

    7

    Network layer at the source, router, and destination (continued)

    Responsible for routing the packet

    The internet, at the network layer is a switched-packet network.

  • 8/14/2019 DataCommChapter 6 Part 1

    8/63

    8

    Switching at the network layer in the Internet uses

    the datagram approach to packet switching.

    Note

  • 8/14/2019 DataCommChapter 6 Part 1

    9/63

    9

    Communication at the network layer in the

    Internet is connectionless.

    Note

  • 8/14/2019 DataCommChapter 6 Part 1

    10/63

    10

    6.2: Internet Protocol6.2: Internet Protocol

    TheThe ISO adopted a connectionless internet service whichISO adopted a connectionless internet service which

    is based on the internet protocol developed foris based on the internet protocol developed for ARPANET, which grows steady into its existing shape ARPANET, which grows steady into its existing shape

    today: Internet.today: Internet.

    The internet protocol is one of the protocol associatedThe internet protocol is one of the protocol associatedwith the complete protocol suite used with the Internetwith the complete protocol suite used with the Internet:TCP/IP, which includes transport and application:TCP/IP, which includes transport and applicationprotocols used for commercial and research works.protocols used for commercial and research works.

    IP provides a connectionless, or datagram serviceIP provides a connectionless, or datagram servicebetween end systems.between end systems.

  • 8/14/2019 DataCommChapter 6 Part 1

    11/63

    11

    The Internet Protocol version 4 (The Internet Protocol version 4 (IPv4IPv4 ) is the ) is the

    delivery mechanism used by the TCP/IP protocols.delivery mechanism used by the TCP/IP protocols.

  • 8/14/2019 DataCommChapter 6 Part 1

    12/63

    12

    Position of IPv4 in TCP/IP protocol suite

    Unreliable a best-effort delivery service: provides no error control or flow control.If reliability if important, it must be paired with a reliable protocol s.a. TCP.

    Connectionless protocol for packet switching network that uses datagram approach.

    Each datagram is handled independently and it can follow different route to a destination.

  • 8/14/2019 DataCommChapter 6 Part 1

    13/63

    13

    IP Addressing: IPv4

    An IP address is a numeric identifier that uniquely defines a host on the

    Internet.

    It consists of 32 bits [in IPv4], normally written as 4 octets [dotted decimalformat], and composed of a network identifier [netid] and a host identifier

    [hostid].

    A router is connected to more than one network, hence it needs one IP

    address for each interface, as shown below:

  • 8/14/2019 DataCommChapter 6 Part 1

    14/63

  • 8/14/2019 DataCommChapter 6 Part 1

    15/63

    15

    Network Classes

    Address is coded to allow a variable allocation of bits to specify network

    and host.

    This allows flexibility in assigning addresses to hosts and allows a mix of

    network sizes on an internet.

    Three principles network classes:Class A: Few network, each with many hosts

    Class B: Medium number of networks, each with medium no. of hosts

    Class C: Many networks, each with few slots

    It is possible to mix all three classes of addresses on the same internetwork.

  • 8/14/2019 DataCommChapter 6 Part 1

    16/63

    16

    Class A

    The first bit of zero defining the class as A.

    The first byte is the netid, defining 27 - 2 reserved addresses = 126

    networks [network addresses with a first byte of 0 (binary

    00000000) and 127 (01111111) are reserved].

    The other 3 bytes [24 bits] gives the hostid.

    Hence, each network can have up to 224 - 2 reserved addresses =16,777,214 hosts

    ARPANET and only few large commercial networks are given

    these Class A addresses.

    For normal organization, Class B addresses are used.

  • 8/14/2019 DataCommChapter 6 Part 1

    17/63

    17

    Class B

    The two leftmost bits are 10 to identify the class as B.

    The first 2 bytes define the netid and the remaining 2 bytes for hostid.Since class B network addresses begin with a binary 10, the range of

    The 1st byte number is 128 to 191 [binary 10000000 to 10111111].

    Combining with the 2nd byte number, there are a total of 214 = 16,384

    possible Class B addresses.

    Each network can have up to 216 - 2 reserved addresses = 65,534 hosts

  • 8/14/2019 DataCommChapter 6 Part 1

    18/63

    18

    Class C

    The first three bits of 110 indicates the address class as C.

    First three octets are assigned for netid and the last octet for hostid.The first decimal number ranges from 192 to 223 [binary 11000000 to

    11011111].

    The total number of Class C network is thus 221 = 2,097,152.

    However, each of the network can only have a maximum of 28 2

    reserved address = 254 host addresses.

  • 8/14/2019 DataCommChapter 6 Part 1

    19/63

    19

    Class D and E

    There is no netid or hostid in both classes.

    Class D is used for multicasting.

    Class E is reserved by Internet for special use.

  • 8/14/2019 DataCommChapter 6 Part 1

    20/63

    20

    Network Classes

    Classes can also be distinguished in decimal notation by observing the first byte:

    1 to 126 Class A address128 to 191 Class B address

    192 to 223 Class C address

    224 to 239 Class D address

    240 to 255 Class E address

    Generally, addresses should never begin with 0, 127 or any number above 223

    (reserved).

    Addresses violating these rules are sometimes known as Martian Address, sincethese addresses are not used on earth.

  • 8/14/2019 DataCommChapter 6 Part 1

    21/63

    21

    Special Addresses

    Some addresses are reserved for special purposes.

    A network defines itself by a network address in which the hostid is set to allzeroes.

    The IP address of 0.0.0.0 is used for default network.

    IP address with netid of 127 is used as the loopback address [used by the

    host computer to send a message back to itself].

    The hostid with all 1s is used to broadcast

    message to all hosts on a specific network.

    In addition, the IP address of 255.255.255.255

    can also be used for broadcasting on the local

    network.

    8

  • 8/14/2019 DataCommChapter 6 Part 1

    22/63

    22

    Special Addresses (cont )

    These special addresses are summarized in the table below:

  • 8/14/2019 DataCommChapter 6 Part 1

    23/63

    23

    Subnetting

    Subnetting is a process of dividing a large network into smaller

    subnetworks or subnets connected together by routers.

    If an organization has a large number of computers, it would be more

    convenient to implement subnetting.

  • 8/14/2019 DataCommChapter 6 Part 1

    24/63

    24

    Subnetting (cont )

    Benefits

    Reduced network traffic: most traffic will stay on the local network,

    only packets destined for other networks will pass through routers; thiswill optimize the network performance.

    Simplified management: it is easier to identify and isolate networkproblems in a group of smaller networks than within a large one.

    Example: A network with Class B address of 158.108.X.X

  • 8/14/2019 DataCommChapter 6 Part 1

    25/63

    25

    Subnetting (cont )

    An organization has been given a Class C address of 198.228.120.X

    Part of the fourth octet can be used to indicate the subnetwork and the host

    This division has no significance outside of the organization; an outsiderwould treat all datagrams addressed to 198.228.120.X the same way.

    Outside networks will not look at the fourth octet of the address.

  • 8/14/2019 DataCommChapter 6 Part 1

    26/63

    26

    Subnetting (cont )

    There is only one gateway attached to the local site network that performs

    internet-wide routing (communicate with outside networks).

    For a single netid with a number of associated subnetworks, the hostid part

    consists of 2 subfieds: subnetid and hostid,

    In subnetting, bits are stolen from the hostid to create the subnetid, as shown

    below.

  • 8/14/2019 DataCommChapter 6 Part 1

    27/63

    27

    Subnetting (cont )

    In the example, 6 bits are stolen from the hostid for the subnetid

    Netid - defines a site

    Subnetid - defines a subnetwork within a site

    Hostid - identifies a host in the subnetwork

  • 8/14/2019 DataCommChapter 6 Part 1

    28/63

    28

    Masking

    Masking is a process of extracting subnetwork address from an IP address

    using a 32-bit mask.

    The part of the mask containing 1s represents the netid and subnetid

    The part of the mask containing 0s identifies the hostid.

    To obtain the subnet address, a bitwise-AND operation on the IP address

    and the subnet mask is performed. The effect of the subnet mask is to erase the portion of the host field that

    refers to an actual host on the subnet.

    What remains is the network number and the subnet number.

  • 8/14/2019 DataCommChapter 6 Part 1

    29/63

    29

    Masking (cont ..)

    Consider a local complex consisting of 3 LANs and 2 routers

    To the rest of the internet, this complex is a single network

    with Class C address of 192.228.17.X

  • 8/14/2019 DataCommChapter 6 Part 1

    30/63

    30

    Masking (cont ..)

  • 8/14/2019 DataCommChapter 6 Part 1

    31/63

    31

    Masking (cont ..)

    Both routers R1 and R2 are configured with a subnet mask of

    255.255.255.224. If a datagram with the destination address 192.228.17.57

    arrives at R1, R1 applies the subnet mask to determine the destination subnet

    address and the host:

    Hence, the datagram will be routed to LAN X which has subnet no. 1

    (192.228.17.32) and received by station B (host number 25).

  • 8/14/2019 DataCommChapter 6 Part 1

    32/63

    32

    Masking (cont ..)

    Maximum number of subnets in a site-wide network:

    2 no. of masked bits corresponding to the subnetid - 2 special address

    Maximum number of hosts per subnet:

    2 no. of unmasked bits - 2 special addresses

    For each of the subnetid and hostid, all zeroes and all ones is not allowed

    [reserved]

  • 8/14/2019 DataCommChapter 6 Part 1

    33/63

    33

    Masking (cont ..)

    Subnet interpretation:

    IP address

    Subnet mask

    130.122.34.3

    255.255.255.192

    10000010.01111010.00100010.00000011

    11111111.11111111.11111111.11000000

    Bitwise AND of IP address and

    subnet mask (resultant network /

    subnet number )

    10000010.01111010.00100010.00000000

    = 130.122.34.0

    Subnet number 10000010.01111010.00100010.00000000

    Host number 00000000.00000000.00000000.00000011

    136

    3

  • 8/14/2019 DataCommChapter 6 Part 1

    34/63

    34

    IPv4 datagram format

    Packets in the IPv4 layer are called datagrams.

    A variable length packet consists of header and data.

    The header contains information essential to routing and delivery.

    It is a customary in TCP/IP to show the header in 4-byte sections.

  • 8/14/2019 DataCommChapter 6 Part 1

    35/63

    35

    Service type or differentiated services

    1) Precedence

    A 3-bit subfield (0-7)

    Defines the priority of thedatagram in issues such as

    congestion

    2) TOS bits

    A 4-bit subfield with each bit

    having a special meaning.

    Only 1 bit is set at a time

    1) Codepoint

    When the 3 rightmost bits are 0s,

    the 3 leftmost are interpreted asthe precedence bits.

    When the 3 rightmost bits are not

    all 0s, the 6 bits define 64 services

    based on the priority assignment

    by the Internet or local authorities.

  • 8/14/2019 DataCommChapter 6 Part 1

    36/63

    36

    The precedence subfield was part of version 4,

    but never used.

    Note

  • 8/14/2019 DataCommChapter 6 Part 1

    37/63

    37

    Types of service

    Bit patterns and their interpretations for 5 different type of services

  • 8/14/2019 DataCommChapter 6 Part 1

    38/63

    38

    Default types of service

    Application programs can request a specific type of service.

  • 8/14/2019 DataCommChapter 6 Part 1

    39/63

    39

    Values for codepoints

    LocalXXXX112

    Temporary or experimentalXXXX013

    InternetXXXXX01

    Assigning AuthorityCodepointCategory

  • 8/14/2019 DataCommChapter 6 Part 1

    40/63

    40

    The total length field defines the total length of the

    datagram including the header.

    Note

  • 8/14/2019 DataCommChapter 6 Part 1

    41/63

    41

    Encapsulation of a small datagram in an Ethernet frame

    There are occasions in which the datagram is not the only thing encapsulated

    in a

    frame; it may be that padding has been added.

    E.g.:

  • 8/14/2019 DataCommChapter 6 Part 1

    42/63

    42

    Protocol field and encapsulated data

    The 8-bit field defined the higher-level protocol that uses the services of the IPv4 layer.

    A IPv4 datagram can encapsulate data from several higher-level protocol s.a TCP,UDP etc.

    Since the IPv4 protocol carriers data from different other protocols, the value of

    this field helps in receiving network layer know to which protocol the data belong.

  • 8/14/2019 DataCommChapter 6 Part 1

    43/63

    43

    Protocol values

  • 8/14/2019 DataCommChapter 6 Part 1

    44/63

    44

    An IPv4 packet has arrived with the first 8 bits as shown:

    01000010

    The receiver discards the packet. Why?

    Solution

    There is an error in this packet. The 4 leftmost bits(0100) show the version, which is correct. The next

    4 bits (0010) show an invalid header length (2 4 =

    8). The minimum number of bytes in the headermust be20. The packet has been corrupted in

    transmission.

    Example 1

  • 8/14/2019 DataCommChapter 6 Part 1

    45/63

    45

    In an IPv4 packet, the value of HLEN is 1000 in binary.

    How many bytes of options are being carried by this packet?

    Solution

    The HLEN value is 8, which means the totalnumber of bytes in the header is 8 4, or 32 bytes.

    The first 20 bytes are the base header, the next 12

    bytes are the options.

    Example 2

  • 8/14/2019 DataCommChapter 6 Part 1

    46/63

    46

    In an IPv4 packet, the value of HLEN is 5, and the value of

    the total length field is 0x0028. How many bytes of data are

    being carried by this packet?

    Solution

    The HLEN value is 5, which means the totalnumber of bytes in the header is 5 4, or 20 bytes

    (no options). The total length is 40 bytes, which

    means the packet is carrying20bytes of data (40 20).

    Example 3

    Note: Length of data = total length - header length

  • 8/14/2019 DataCommChapter 6 Part 1

    47/63

    47

    An IPv4 packet has arrived with the first few hexadecimal

    digits as shown.

    0x45000028000100000102 . . .How many hops can this packet travel before being dropped?

    The data belong to what upper-layer protocol?

    SolutionTo find the time-to-live field, we skip 8 bytes. The

    time-to-live field is the ninth byte, which is 01. This

    means the packet can travel only one hop. The protocol field is the next byte (02), which means

    that the upper-layer protocol is IGMP.

    Example 4

  • 8/14/2019 DataCommChapter 6 Part 1

    48/63

    48

    Fragmentation

    A datagram can travel through different networks.

    Each router decapsulates the IPv4 datagram from the frame it receives, process it

    and then encapsulates it in another frame.

    Maximum Transfer Unit (MTU) is the maximum number of bytes that a data

    link protocol can encapsulate. MTUs vary from protocol to protocol.

    Fragmentation is the division of a datagram into smaller units to accommodate

    the MTU of a data link protocol.

  • 8/14/2019 DataCommChapter 6 Part 1

    49/63

    49

    Maximum transfer unit (MTU)

    Maximum Transfer Unit (MTU) is the maximum number of bytes that

    a data link protocol can encapsulate.

  • 8/14/2019 DataCommChapter 6 Part 1

    50/63

    50

    MTUs for some networks

    MTUs vary from protocol to protocol.

  • 8/14/2019 DataCommChapter 6 Part 1

    51/63

    51

    Fields related to fragmentation

    Identification: identifies a datagram originating from the source host.

    Fragmentation offset: shows the relative position of this fragmentwith respect to the whole datagram.

    Flags

  • 8/14/2019 DataCommChapter 6 Part 1

    52/63

    52

    Flags used in fragmentation

    1st bit : reserved bitD or 2nd bit: do not fragment bit

    M or 3rd bit: the more fragment bit

  • 8/14/2019 DataCommChapter 6 Part 1

    53/63

    53

    Fragmentation example

    Detailed fragmentation example

  • 8/14/2019 DataCommChapter 6 Part 1

    54/63

    54

    Detailed fragmentation example

  • 8/14/2019 DataCommChapter 6 Part 1

    55/63

    55

    A packet has arrived with an M bit value of 0. Is this the

    first fragment, the last fragment, or a middle fragment? Do

    we know if the packet was fragmented?

    Solution

    If the M bit is 0, it means that there are no morefragments; the fragment is the last one. However,

    we cannot say if the original packet was

    fragmented or not. A non-fragmented packet isconsidered the last fragment.

    Example 5

  • 8/14/2019 DataCommChapter 6 Part 1

    56/63

    56

    A packet has arrived with an M bit value of 1. Is this the

    first fragment, the last fragment, or a middle fragment?

    Do we know if the packet was fragmented?

    Solution

    If the M bit is 1, it means that there is at least onemore fragment. This fragment can be the first one

    or a middle one, but not the last one. We dont

    know if it is the first one or a middle one; we need more information (the value of the fragmentation

    offset).

    Example 6

  • 8/14/2019 DataCommChapter 6 Part 1

    57/63

    57

    A packet has arrived with an M bit value of 1 and a

    fragmentation offset value of 0. Is this the first fragment,

    the last fragment, or a middle fragment?

    Solution

    Because the M bit is 1, it is either the first fragmentor a middle one. Because the offset value is 0, it is

    the first fragment.

    Example 7

    E l 8

  • 8/14/2019 DataCommChapter 6 Part 1

    58/63

    58

    A packet has arrived in which the offset value is 100. What

    is the number of the first byte? Do we know the number of

    the last byte?

    Solution

    To find the number of the first byte, we multiply theoffset value by 8. This means that the first byte

    number is 800. We cannot determine the number of

    the last byte unless we know the length.

    Example 8

    Example 9

  • 8/14/2019 DataCommChapter 6 Part 1

    59/63

    59

    A packet has arrived in which the offset value is 100, the

    value of HLEN is 5, and the value of the total length field is

    100. What are the numbers of the first byte and the lastbyte?

    Solution

    The first byte number is 100 8 = 800. The totallength is 100 bytes, and the header length is 20

    bytes (5 4), which means that there are 80 bytes in

    this datagram. If the first byte number is 800, thelast byte number must be 879.

    Example 9

    6 3: IPv66 3: IPv6 vsvs IPv4IPv4

  • 8/14/2019 DataCommChapter 6 Part 1

    60/63

    60

    6.3: IPv66.3: IPv6 vsvs IPv4IPv4

    The network layer protocol in the TCP/IP protocolThe network layer protocol in the TCP/IP protocol

    suite is currently IPv4. Although IPv4 is well suite is currently IPv4. Although IPv4 is well

    designed, data communication has evolved since designed, data communication has evolved since

    the inception of IPv4 in the 1970s.the inception of IPv4 in the 1970s.

  • 8/14/2019 DataCommChapter 6 Part 1

    61/63

    61

    IPv4 has some deficiencies that make it unsuitable for theIPv4 has some deficiencies that make it unsuitable for the

    fastfast--growing Internetgrowing Internet:

    Long term problem in the Internet: address depletion

    The Internet must accommodate real-time audio and video transmission.

    It requires minimum delay strategies and reservation of resources not

    provided in the IPv4 design.

    The Internet must accommodate encryption and authentication of data

    for some application. No encryption or authentication is provided byIPv4.

    IPv4 vs. IPv6

  • 8/14/2019 DataCommChapter 6 Part 1

    62/63

    62

    IPv6 has some advantages over IPv4IPv6 has some advantages over IPv4:

    Larger address space Better header format

    New options

    Allowance for extension

    Support for resource allocation.

    Support for more security

    IPv4 vs. IPv6

  • 8/14/2019 DataCommChapter 6 Part 1

    63/63

    63

    Transition From IPv4 to IPv6Transition From IPv4 to IPv6

    Because of the huge number of systems on the Internet, thetransition from IPv4 to IPv6 cannot happen suddenly. It

    takes a considerable amount of time before every system in

    the Internet can move from IPv4 to IPv6. The transition

    must be smooth to prevent any problems between IPv4 andIPv6 systems.