Sie sind auf Seite 1von 17

CCN Module 3 Part C Notes - NETWORK LAYER

Anitha S Sastry, Dept of ECE, GAT

Network Layer
 Network Layer is primarily responsible for Routing function of the subnet.
 The network layer ensures that each packet is delivered from the source to
the destination.
 When two systems are attached to different networks (links) with connecting
devices between the networks (links), there is often a need for the network
layer to accomplish source-to-destination delivery.

Network Layer Services:


The network layer in the TCP/IP protocol suite provides services to the
transport layer and receives services from the data link layer.

Services:

1) Packetizing
2) Routing and Forwarding
3) Security
4) Error control
5) Flow control
6) Congestion control
7) Quality of Service(QOS)

Packetizing:
 The main duty of the network layer is packetizing.
 Encapsulating the payload (data received from upper layer) in a network
layer packet at the source and de capsulation of the payload from the
network- layer packet at the destination.
 The source host receives the payload from an upper-layer protocol, adds a
header that contains the source & destination addresses and other
information that is required by the network-layer protocol and delivers the
packet to the data-link layer.
 The destination host receives the network-layer packet from its data-link
layer, decapsulates the packet, and delivers the payload to the
corresponding upper-layer protocol.
Routing and Forwarding:
 Network layer primarily is responsible for routing function.
 It ensures each packet is delivered from the source to destination host.
 Routers connect a combination of networks having more than one route
between the nodes.
 Various routing protocols are used to chose the best route or the route with
the shortest path to the destination.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 Forwarding another function of network layer that helps carry the data
from source to destination.
 The router makes the decision w r t the routing table prepared by the
routing protocol at every node.
 The router uses the destination address in the network layer header to
forward the packet based on decision making/forwarding/routing table.
 A simple example is as shown below:

Error Control:
 Error control at the network layer will be inefficient as the large packet in
the network layer may be fragmented at each router.
 It uses ICMP to provide error control.

Flow Control:

 It is not a direct service of network layer.


 It is associated with the buffers in the transport layer.
 Another level of flow control is require to facilitate the service.

Congestion Control:
 It is a requirement of the network layer .
 To control the inflow of the datagram to the network.
Quality of Service(QOS):
 Internet is useful for data, text, audio, video and multimedia
communication.
 QOS is an important parameter in real time.
 However, to keep the network layer untouched, these provisions are mostly
implemented in the upper layer.
Security:
 With the usage of Internet as a global service, Security is a major concern.
 The security in the Internet is provided by IPSec, a part of the IP.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

Packet Switching
 A router is a switch and switching occurs at the network layer
 Packet Switching is used at the network layer.
 Circuit switching is used in physical layer.
 There are two approaches of packet switching:
1) Datagram approach for connectionless service.
2) Virtual Circuit approach for connection oriented service.

Datagram approach for connectionless service:


 Since Internet is a connectionless service, each packet is considered
independently for delivery from source to destination
 The switching is done by routers.
 Routing information is in the header of each packet with source and
destination address.
 A connectionless packet switched network is as shown below:

Virtual Circuit approach for connection oriented service:


 A logical connection is setup before any packet is sent.
 With virtual or logical connection, all packets follow the same path.
 The header contains the source and destination address.
 A virtual circuit identifier defines the virtual path the packet has to follow.
 A flow label is added to record the path.
 The virtual circuit process is as shown below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

IPV4 Address
 Communication in the network layer is a host- to – host communication,
with a unique global addressing method.
 IP is the heart of the TCP/IP protocol suite.
 It provides connectionless and best effort delivery service to the transport
layer.
 IP version 4 (IPV4) is 32 bits long.
 It is globally unique and defines the connection of the host to the Internet.
 No two devices can have the same address at the same time in the Internet.
Address Space:
 Total number of addresses available in the protocol is the address space.
 IPV4 has 32 bit long address and the corresponding address space is 232.
 Address can have two types of notations:
1) Binary notation:
IPV4 has 4 octets or byte address.
For example: 00110111 00011111 01110101 00000100
2) Dotted Decimal Notation:
This notation is preferred as it is compact and easy to read.
For example: 00110111 00011111 01110101 00000100
55 . 31 . 117 . 4
 Each number in the dotted decimal format can have values from 0 to 255.
Types of Addressing:
1) Classful Addressing and
2) Classless addressing / Classless Interdomain Routing(CIDR)
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

Classful Addressing:

 Each host and the router has an IP address and has a 2 level hierarchy.
1) Network ID-netid
2) Host ID-hostid
 The network ID identifies the network the host is connected to.
 This is assigned by the Internet Network Information Center(Internet NIC) to
avoid conflicts.
 The host ID identifies the network connection to the host rather than th
actual host.
 IPV4 is using Classful addressing mechanism since inception.
 There are 5 different classes of address: A, B, C, D and E as shown in the
diagram below.
 The first few bits give the information of the class of the address.

Range of the Network and Host ID:


 The 16 bit source addresses range from 0.0 to 255.255.
 Therefore, the range for 32 bit net and host ID will be 128.0.0.0 to
191.255.255.255.
 The ranges are as shown in the table below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 In Classful addressing, it can be seen that a large part of the available


address space is not utilized properly.
Subnetting/ Subnet Addressing:
 IP addressing scheme has some drawbacks.
 Like management of large number of hosts for the local administrator in a
large organization will be a huge task.
 Subnet Addressing adds another hierarchical level allowing the network to
be split into several parts for internal use.
 Subnet mask for Class B is shown below as an example:

 Subnetting is not visible outside the network.


 If the subnet has 1000 host address, the router in the IP addressing need
1000 entries for each host, but in subnetting the number of entries will only
be one giving the address of the network of the subnet.
Subnet Mask:
 Forwarding of a packet with a destination IP address by the router is made
simple by the use of Subnet Mask.
 Ex: 150.100.12.176 → 10010110 01100100 00001100 10110000
Subnet mask → 11111111 11111111 11111111 11111111
Subnet Mask in dotted format is 255.255.255.0.
 The router determines the subnet number by performing a binary AND
operation between the IP address and the subnet mask.
 AND operation of 150.100.12.176 and 255.255.255.0 leads to 150.100.12.0.
 This address is used to forward the packet to the correct subnetwork inside
the organization.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 A host connected to this subnet must have an IP address between


150.100.12.0 and 150.100.12.255.

Advantage of Classful Addressing

Although classful addressing had several problems and became obsolete, it had
one advantage: Given an address, we can easily find the class of the address
and, since the prefix length for each class is fixed, we can find the prefix length
immediately. In other words, the prefix length in classful addressing is inherent
in the address; no extra information is needed to extract the prefix and the
suffix.

Classless addressing / Classless Interdomain Routing(CIDR)


 Due to the exponential increase in the growth of the Internet users, the IP is
having several problems like:
1) Dividing the IP address space into different classes.
2) The classes B addresses of IP are running out.
3) The number of entries in the routing table
 Motivation for classless addressing: During the 1990s, Internet Service
Providers (ISPs) came into prominence.
 An ISP is an organization that provides Internet access for individuals, small
businesses, and midsize organizations that do not want to create an
Internet site and become involved in providing Internet services (such as
electronic mail) for their employees.
 An ISP is granted a large range of addresses and then subdivides the
addresses (in groups of 1, 2, 4, 8, 16, and so on), giving a range of addresses
to a household or a small business.
 The customers are connected via a dial-up modem, DSL, or cable modem to
the ISP.
 Each customer needs some IPv4 addresses. In 1996, the Internet authorities
announced a new architecture called classless addressing.
 In classless addressing, variable-length blocks are used that belong to no
classes.
 We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses,
and so on.
 In classless addressing, the whole address space is divided into variable
length blocks.

Fig:Variable-length blocks in classless addressing


CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 Since the overwhelming requirement of the address spaces the Classful


address space is lifted leading to CIDR/ (/n) notation.
 CIDR routes packets according to the higher order bits of IP address.

 A routing table in CIDR can have 32bit IP address and 32 bit Mask as in the
table below:

 CIDR has three level hierarchy achieved by :


i) First byte or quad → Continental
ii) Second Byte or Quad → Regional
iii) Third Level → Local using a technique called Summarization.
 Ex: 202 . 40 . 101 . XXXX. YYYY YYYY
ASIA BENGALURU Subnet 13 bits left for host address
Subnet Address Address in the subnet213 or 8192
Block Allocation
 Issue in classless addressing is block allocation.
 The ultimate responsibility of block allocation is given to a global authority
called the Internet Corporation for Assigned Names and Numbers (ICANN).
 ICANN does not normally allocate addresses to individual Internet users.
 It assigns a large block of addresses to an ISP (or a larger organization that
is considered an ISP in this case).
 For the proper operation of the CIDR, two restrictions need to be applied to
the allocated block.
1. The number of requested addresses, N, needs to be a power of 2. The reason
is that N = 232 − n or n = 32 − log2N. If N is not a power of 2, we cannot have
an integer value for n.
2. The requested block needs to be allocated where there is an adequate
number of contiguous addresses available in the address space. However, there
is a restriction on choosing the first address in the block. The first address
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

needs to be divisible by the number of addresses in the block. The reason is


that the first address needs to be the prefix followed by (32 − n) number of 0s.
The decimal value of the first address is then

Problem/ Example(Important)
A classless address is given as 167.199.170.82/27. We can find the above
three pieces of information as follows. The number of addresses in the network
is 232 − n = 25 = 32 addresses.

The first address can be found by keeping the first 27 bits and changing the
rest of the bits to 0s.
Address: 167.199.170.82/27 10100111 11000111 10101010 01010010
First address: 167.199.170.64/27 10100111 11000111 10101010 01000000
The last address can be found by keeping the first 27 bits and changing the
rest of the bits to 1s
Address: 167.199.170.82/27 10100111 11000111 10101010 01011111
Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111

Dynamic Host Configuration Protocol (DHCP)

 DHCP an application layer protocol to help TCP/IP at the network Layer.


 Address assignment can be done automatically with DHCP.
 It has widespread usage in the Internet.
 It is a client-server protocol.
DHCP Message Format:
 In DHCP, a client sends the request message and server responds with a
message.
 The message format of DHCP is as shown in the diagram below.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 Various fields in the format are:


1) OPCODE:Operation code-request(1), reply(2).
2) HType: Hardware Type
3) HLen: Length of Hardware address.
4) HCount: Maximum number of Hops of packet travel.
5) Transaction ID: Client sets the integer and the server repeats.
6) Client IP Address: Set 0 if it is not known.
7) Your IP address: Client address sent by the server
8) Server IP Address: Broadcast IP address If the client does not know it.
9) Gateway IP address: Address of default router.
10) Server address:64 byte domain name of the server.
11) Boot file name: 128 byte file name having extra information.
12) Options: 64 byte field with dual purpose. It carries additional
information or specific vendor information.
It has three fields as shown in the diagram below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 It has one byte tag field, one byte length field and a variable length value
field.
 It has 8 types of messages: DHCP, DHCPDISCOVER, DHCPOFFER,
DHCPREQUEST, DHCPDECLINE, DHCPACK,DHCPNACK, DHCPRELEASE,
DHCPINFORM.

DHCP Operation:

 There are four parts of operation of DHCP:


 The joining host creates a DHCPDISCOVER message with only the
transaction ID field set to a random number.
 DHCP servers respond with DHCPOFFER message containing your address
field with offered address, the server address field with server IP address,
and the lease time to keep the IP address by the host.
 The joining host selects the best of the offers and sends a DHCPREQUEST
message to the selected server.
 The selected server responds with the DHCPACK or DHCPNACK message.
 DHCP uses two well known ports (68 and 67) instead of one well known port
and ephemeral port.
 The reason for choosing the well-known port 68 instead of an ephemeral
port for the client is that the response from the server to the client is
broadcast.
 Error control is needed in DHCP.
 It uses unreliable UDP
 DHCP uses: a) UDP with checksum and b)Timer and retransmission policy.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

DHCP Transition states:


The operation in DHCP is represented as a FSM and depicted as below:

 To begin with the DHCP client is in the initializing state.


 When the client gets an offer after broadcasting a discover message, the
client goes to the selecting state.
 It can select from many offers.
 The client goes to the requesting state.
 With the ACK received, the client goes to bound state.
 When 50% of lease time is over, it goes to renewing state.
 When not renewed and 75% of the lease time has elapsed, the client goes to
rebinding state.
 The client uses renewal time 50%, rebinding time 75%, and expiry time
100%.
Network Address Resolution/ Translation(NAT):

 A technology that can provide the mapping between the private and
universal addresses, and at the same time support virtual private networks
is Network Address Translation (NAT).
 NAT - Network address translation tries to solve the problem of ever
expanding number of users to the Internet.
 The technology allows a site to use a set of private addresses for internal
communication and a set of global Internet addresses (at least one) for
communication with the rest of the world.
 It also senses if a single user operates on more than one IP address.
 The Internet authorities have reserved three sets of address as private
address as given in the table below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 The private addresses are unique inside the organization and any
organization can use them without permission.
 A router needed which runs the NAT software.

Address Translation
 All of the outgoing packets go through the NAT router, which replaces the
source address in the packet with the global NAT address.
 All incoming packets also pass through the NAT router, which replaces the
destination address in the packet (the NAT router global address) with the
appropriate private of address translation.
Translation Table
 The reader may have noticed that translating the source addresses for an
outgoing packet is straightforward.
 But how does the NAT router know the destination address for a packet
coming from the Internet?
 There may be tens or hundreds of private IP addresses, each belonging to
one specific host. The problem is solved if the NAT router has a translation
table.
Forwarding of IP Packets:
 When IP is used as a connectionless protocol, forwarding is based on the
destination address of the IP datagram; when the IP is used as a
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

connection-oriented protocol, forwarding is based on the label attached to


an IP datagram.
Forwarding based on Destination address:
 When IP is used as a connectionless protocol, destination address of the IP
datagram is used for forwarding the IP packets.
 This type is more commonly used.
 A forwarding table is used by the host to send a packet or by a router which
has a packet received to be forwarded.
 In classless addressing, the forwarding table needs one row of information
for each block involved.
 Class forwarding table has four pieces of information:
1) The mask
2) Network address
3) Interference number
4) IP address of the next router

 The forwarding table consists of


1) Network address including Mask
2) Next hop IP address
3) Interference(m1,m2,m3)
 Searching is done row by row to extract information.

Address Aggregation
 There is only one entry in the forwarding table for classful addressing.
 This entry defines each site and is checked by the router and the packet is
forwarded when classless addressing is used, the number of entries in the
forwarding table increases and the search time also increases.
 This problem can be taken care of by employing address aggregation.
 The concept of address aggregation is shown below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 The router R1 is connected to the networks of three organization.


 Router R2 is far from R1.
 R1 has a bigger forwarding table compared to R2.
 Aggregated address into a bigger block is sent out of the interface m3.
 R2 forwarding table is small due to the address done at the source router
R1.
Hierarchical Routing: When forwarding table is huge, a hierarchy is created in
the forwarding table.
 Hierarchy is obtained by considering national ISPs → Regional ISP → Local
ISPs.
 This will decrease the forwarding table size.
 Geographical routing: Reduces the size of the forwarding table further by
considering a block to America, a block Europe, A block to Asia ad so on.
 There will be only one entry in the table for each block.
 The Regional ISP is divided into 4 ISP blocks.
 Each ISP is sub divided into small ISP.
 Each small ISP provides services to the individual host.
Forwarding based on Label:
 In a datagram approach a router forwards the packet depending on the
destination address in the header of the packet.
 In a virtual circuit approach, a switch forwards the packet depending on the
label attached to the packet.
 Routing involves searching, switching and accessing.
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 An index is used to access the forwarding table.


 Forwarding is based on label as shown in the diagram below:
 A switching table is accessed by using a label.

Multiprotocol Label Switching(MPLS):


 MPLS can behave like a router and a switch.
 MPLS forwards the packets based on destination address when used as a
router.
 When used as a switch, MPLS forwards the packet based on the label.
 MPLS HEADER is attached by encapsulating the IPV4 packet into an MPLS
Packet.

 MPLS header has a stack of subheaders.


 Subheaders are used for multilevel hierarchical switching. The format of the
MPLS header is as shown the diagram below:
CCN Module 3 Part C Notes - NETWORK LAYER
Anitha S Sastry, Dept of ECE, GAT

 The MPLS header format has various fields. Some of them are:
1) Label: It defines the label used for indexing the forwarding table in the
router.
2) EXP: Reserved for experimental work.
3) S: It defines the situation into stack of the subheader.
4) When the bit is 1,it is the last header.
5) TTL: When it reaches zero, the packet is discarded.
6) It is similar to time to live field in the IP datagram.

Das könnte Ihnen auch gefallen