NETWORK LAYER

 

 DISCUSSION ON:
Addressing: IP addressing, Subnetting, NAT, Routing: techniques, static vs. dynamic routing, Unicast
Routing Protocols: RIP, OSPF, BGP; Other Protocols: ARP, RARP, IP, ICMP, IPv6; VPN.
 
 

 First Address of Address Block

The first address in the block can be found by setting the rightmost 32 − n bits to 0s.

EXAMPLE

A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. What is the first address in the block?

The binary representation of the given address is 11001101 00010000 00100101 00100111

If we set 32−28 rightmost bits to 0, we get 11001101 00010000 00100101 0010000 or 205.16.37.32.

Last Address of Address Block

The last address in the block can be found by setting the rightmost 32 − n bits to 1s.
 

EXAMPLE

A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. What is the last address in the block?

The binary representation of the given address is 11001101 00010000 00100101 00100111

If we set 32−28 rightmost bits to 1, we get 11001101 00010000 00100101 00101111 or 205.16.37.47.

 Number of Addresses of Address Block

The number of addresses in the block can be found by using the formula 2^(32-n)

EXAMPLE

A block of addresses is granted to a small organization. We know that one of the addresses is 205.16.37.39/28. What is the number of addresses of address block?
 
The value of n is 28, which means that number of addresses is 2^(32-28) or 16.
 
 

First Address

The first address can be found by ANDing the given addresses with the mask. ANDing here is done bit by bit. The result of ANDing 2 bits is 1 if both bits are 1s; the result is 0 otherwise.

Address: 11001101 00010000 00100101 00100111
Mask : 11111111 11111111 11111111 11110000
First Address: 11001101 00010000 00100101 00100000

Last Address

The last address can be found by ORing the given addresses with the complement of the mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 if both bits are 0s; the result is 1 otherwise. The complement of a number is found by changing each 1 to 0 and each 0 to 1.

Address: 11001101 00010000 00100101 00100111
Mask Complement: 00000000 00000000 00000000 00001111
Last Address: 11001101 00010000 00100101 00101111

Number of Addresses

The number of addresses can be found by complementing the mask, interpreting it as a decimal number, and adding 1 to it.

Mask Complement: 00000000 00000000 00000000 00001111
Number of addresses: 15 + 1 = 16

 

****************************************************************************************************

ADDRESS MAPPING, ERROR REPORTING, AND MULTICASTING


ADDRESS MAPPING

The delivery of a packet to a host or a router requires two levels of addressing: logical and physical. We need to be able to map a logical address to its corresponding physical address and vice versa. This can be done by using either static or dynamic mapping.

Topics discussed in this section:
Mapping Logical to Physical Address
Mapping Physical to Logical Address
 

ARP OPERATION

Address Resolution Protocol (ARP)

Mapping IP Address to Data-Link Address

 How does a machine map an IP address to its Data- Link layer (hardware or MAC) address?
 This is needed by the source host A who needs to send an IP packet to another host B
     if B is on same IP network as A, address frame to B. Thus, DL-Address of B is needed.
     if B on a separate network, address frame to a router. Thus, DL-Address of router is needed.
 ARP is also used by routers (See next image)
 
 

Address Resolution

 Some protocol suites adopt one of the following:
     Keep mapping tables in each machine
     Hardware (physical) addresses are encoded in the high level addresses
 Both are ad-hoc, awkward solutions

 Resolution Through Dynamic Binding

 Ethernet uses 48-bit physical addresses
     Addresses assigned by manufacturers
     Replacing a faulty interface card meant a change to the machine physical address
 Can’t encode 48-bit long address into a 32-bit long IP address
 TCP/IP solution: Address Resolution Protocol (ARP)

ARP

 Exploits broadcast capability of Ethernet
 Allows a host to find the Ethernet address of a target host on the same network, given the target’s IP address
 Allows machines to be added or removed with no code recompilation
 Builds and maintains dynamically a table to translate IP addresses into Ethernet physical  addresses


  ARP (contd.)

 Hosts that use ARP maintain a small cache of recently acquired (IP,Hardware) address bindings
 Cache is updated dynamically
     Timer for each entry
     Whenever a new binding is received, update the corresponding table entry and reset the associated timer.
 ARP is a low level protocol that hides the underlying network physical addressing, permitting us to assign IP addresses of our choosing to every machine


ARP (contd.)

 We think of it as part of the physical network and not as part of the internet protocols
 Functionally ARP is divided in two parts
     One part that determines physical address of the destination of the outgoing packet
     One part answers requests from other machines

ARP Implementation (contd.)

 Address resolution of outgoing packet
     IF dest. IP address is in cache THEN
         Get corresponding physical address
         Construct an Ethernet frame
     Else
         Broadcast an ARP request
         Wait for an ARP reply
 

ARP Implementation (contd.)

 Two types of incoming ARP packets
     A Request
         IF this machine is the target of ARP Request THEN Generate ARP Reply and send it to requester 
         ELSE Ignore the request
     A Reply
         Determine if we need to create a cache entry or update existing entry
         Match Reply with initial Request
 
 

ARP Encapsulation in Ethernet Frame


 

 Eth. DA (Ethernet Destination Address) : 
For ARP Request it is set to FF FF FF FF FF FF
 
 

  ARP Packet Format (contd.)

 

 
 

ARP Packet Format

 To allow ARP to be used with a variety of network technologies, header of ARP messages does not have a fixed format
     First fields in the header specify the length of succeeding fields
 On Ethernet, 28-octet ARP message format is used
 

 Example

A host with IP address 130.23.43.20 and physical address B2:34:55:10:22:10 has a packet to send to another host with IP address 130.23.43.25 and physical address A4:6E:F4:59:83:AB. The two hosts are on the same Ethernet network. Show the ARP request and reply packets encapsulated in Ethernet frames.

Solution

Figure shows the ARP request and reply packets. Note that the ARP data field in this case is 28 bytes, and that the individual addresses do not fit in the 4-byte boundary. That is why we do not show the regular 4-byte boundaries for these addresses. 

an ARP request and reply

An arp request is broadcase and an arp reply is unicast.


 Additional Notes about ARP

 Every host that receives the broadcast ARP request caches the Sender's IP Address/Hardware Address
 When a station boots it sends a broadcast ARP request with target IP address matching its own
     This enables other hosts to cache the sender's info.
     If the station gets a reply, it knows that its IP address is used by some other host and thus we know of duplicate IP addresses
 

 Proxy ARP


 

Proxy ARP is a technique by which a proxy server on a given network answers the Address Resolution Protocol (ARP) queries for an IP address that is not on that network. The proxy is aware of the location of the traffic's destination and offers its own MAC address as the (ostensibly final) destination.[1] The traffic directed to the proxy address is then typically routed by the proxy to the intended destination via another interface or via a tunnel.

The process, which results in the proxy server responding with its own MAC address to an ARP request for a different IP address for proxying purposes, is sometimes referred to as publishing.



Determining an IP Address at Startup

 Diskless machines use IP addresses to communicate with the file server
 Also, many diskless machines use TCP/IP FTP protocols to obtain their initial boot image, thus requiring that they obtain and use IP addresses
 Designers keep both the bootstrap code and initial OS images free from specific IP addresses for portability

Determining IP Address at Startup (contd.)

 How does a diskless machine determine its IP address?
 When bootstrap code starts execution on a diskless machine, it must use the network to contact a server to obtain the machine’s IP address
 Usually, a machine’s IP address is kept on disk where OS finds it at startup

Reverse Address Resolution Protocol (RARP)

 RARP is the protocol used to solve the reverse problem solved by ARP
     Given a physical address, get the corresponding IP address
 RARP uses the same message format as ARP
 RARP messages are sent encapsulated in Ethernet frames
 These days, DHCP (Dynamic Host Configuration Protocol) is a newer protocol that is used as a replacement for RARP. Thus, we can say that DHCP has rendered RARP (but not ARP) obsolete


RARP (contd.)

 



 BOOTP client and server on the same and different networks 
 

Note :
DHCP provides static and dynamic address allocation that can be manual or automatic. 

DHCP HANDSHAKE


 

 ICMP

The IP protocol has no error-reporting or error- correcting mechanism. The IP protocol also lacks a mechanism for host and management queries. The Internet Control Message Protocol (ICMP) has been designed to compensate for the above two deficiencies. It is a companion to the IPprotocol.
 
Topics discussed in this section:
Types of Messages
Message Format
Error Reporting and Query
Debugging Tools 
 

General format of ICMP messages


 Note :

ICMP always reports error messages to the original source.
 

 Error-reporting messages 



Note :

Important points about ICMP error messages:
* No ICMP error message will be generated in a response to a datagram carrying an ICMP error message.
* No ICMP error message will be generated for a fragmented datagram that is not the first fragment.
* No ICMP error message will be generated for a datagram having a multicast address.
* No ICMP error message will be generated for a datagram having a special address such as 127.0-0.0 or 0.0-0.0. 
 
 

Contents of data field for the error messages


 

Redirection concept


Query messages


Encapsulation of ICMP query messages



Example

Figure 21.14 shows an example of checksum calculation for a simple echo-request message. We randomly chose the identifier to be 1 and the sequence number to be 9. The message is divided into 16-bit (2-byte) words. The words are added and the sum is complemented, Now the sender can put this value in the checksum field.

 Example of checksum calculation


 
Example

We use the ping program to test the server fhda.edu, The result is shown on the next slide. The ping program sends messages with sequence numbers starting from 0, For each probe it gives us the RTT time. The TTL (time to live) field in the IP datagram that encapsulates an ICMP message has been set to 62. At the beginning, ping defines the number of data bytes as 56 and the total number of bytes as 84. It is obvious that if we add 8 bytes of ICMP header and 20 bytes of IP header to 56, the result is 84. However, note that in each probe ping defines the number of bytes as 64. This is the total number of bytes in the ICMPpacket (56 + 8).


The traceroute program operation

EXAMPLE


 The first line shows the first router visited. The router is named Dcore.fhda.edu with IP address 153.18,31.254. The first round-trip time was 0.995 ms, the second was 0.899 ms, and the third was 0.878 ms. The second line shows the second router visited. The router is named Dbackup.fhda.edu with IP address The three round-trip times are also shown, The third line shows the destination host. We know that this is the destination host because there are no more lines. The destination host is the server fhda.edu, but it is named tiptoe.fhda.edu with the IP address The three round-trip times are also shown. 

Example 

In this example, we trace a longer route, the route to xerox.com (see next slide). Here there are 17 hops between source and destination. Note that some round- trip times look unusual. It could be that a router was too busy to process the packet immediately.
 

 

IGMP

The IP protocol can be involved in two types of' communication: unicasting and multicasting. The Internet Group Management Protocol (IGMP) is one of the necessary, but not sufficient, protocols that is involved in multicasting. IGMP is a companion to the IPprotoc01. Topics discussed in this section: Group Management IGMP Messages and IGMP Operation Encapsulation Netstat Utility

 IGMP message types

IGMP message format

 IGMP type field

IGMP operation



Note

In IGMP, a membership report is sent twice, one after the other.

Note

The general query message does not define a particular group.


Example

Imagine there are three hosts in a network, as shown in Figure 21.19. A query message was received at time O; the random delay time (in tenths of seconds) for each group is shown next to the group address. Show the sequence of report messages.

Solution

The events occur in this sequence:
 
a. Time 12: The timer for 228.42.0.0 in host A expires,  and a membership report is sent, which is received by the router and every host including host B which cancels its timer for 228.42.0.0.
 
b.Time 30:The timer for 225.14.0.0 in host A expires, and  a membership report is sent which is received by the router and every host including host C which cancels its timer for 225.14, 0, 0,
 
c. Time 50: The timer for 238,71.O.O in host B expires, and a membership report is sent, which is received by the router and every host. 
 
d. Time 70: The timer for 230,43.0.0 in host C expires, and a membership report is sent, which is received by the router and every host including host A which cancels its timer for 230.43.0.0. 
 

 Encapsulation of IGMP packet


Note:

 The IP packet that carries an IGMP packet has a value of 1 in its TTL field. 

 Destination IP address

Mapping class D to Ethernet Physical address




Note:

An Ethernet multicast physical address is in the range 01 to 01

Example

Change the multicast IP address 230,43.14.7 to an Ethernet multicast physical address.

Solution

We can do this in two steps:
a. We write the rightmost 23 bits of the IP address in hexadecimal. This can be done by changing the rightmost 3 bytes to hexadecimal and then subtracting 8 from the leftmost digit if it is greater than or equal to 8. In our example, the result is 2B:0E:07

b. We add the result of part a to the starting Ethernet multicast address, which is The result is 01:00:5E:2B:0E:07

Example

Change the multicast IP address 238.212.24.9 to an Ethernet multicast address.

Solution

a. The rightmost 3 bytes in hexadecimal is D4:18:09. We need to subtract 8 from the leftmost digit, resulting in 54:18:09.

b. We add the result of part a to the Ethernet multicast starting address. The result is 01:00:5E:54:18:09

Tunneling



Example

We use netstat (see next slide) with three options: -n, -r, and -a, The -n option gives the numeric versions of IP addresses, the -r option gives the routing table, and the -a option gives all addresses (unicast and multicast). Note that we show only the fields relative to our discussion. "Gateway" defines the router, "Iface" defines the interface.
Note that the multicast address is shown in color. Any packet with a multicast address from 224.0.0.0 to 239.255.255.255 is masked and delivered to the Ethernet interface.


ICMPv6

We discussed IPv6 in Chapter 20. Another protocol that has been modified in version 6 of the TCP/IP protocol suite is ICMP (ICMPv6). This new version follows the same strategy and purposes of version 4.
Topics discussed in this section:
Error Reporting
Query

 Comparison of network layers in version 4 and version 6


 




****************************** end************

SUBNETTING

 When a bigger network is divided into smaller networks, in order to maintain security, then that is known as Subnetting. so, maintenance is easier for smaller Networks. 

Now, let’s talk about dividing a network into two parts: 
so to divide a network into two parts, you need to choose one bit for each Subnet from the host ID part. (net id part and host id part)
 
 




In the above diagram, there are two Subnets.

Note: It is a class C IP so, there are 24 bits in the network id part and 8 bits in the host id part.

• For Subnet-1:

The first bit which is chosen from the host id part is zero and the range will be from  (193.1.2.00000000 till you get all 1’s in the host ID part i.e, 193.1.2.01111111) except for the first bit which is chosen zero for subnet id part.

Thus, the range of subnet-1:
193.1.2.0 to 193.1.2.127

• For Subnet-2:

The first bit chosen from the host id part is one and the range will be from (193.1.2.10000000 till you get all 1’s in the host ID part i.e, 193.1.2.11111111).

Thus, the range of subnet-2:
193.1.2.128 to 193.1.2.255

Note:
1. To divide a network into four (2^2) parts you need to choose two bits from host id part for each subnet i.e, (00, 01, 10, 11).
2. To divide a network into eight (2^3) parts you need to choose three bits from host id part for each subnet i.e, (000, 001, 010, 011, 100, 101, 110, 111) and so on.

Advantages and Disadvantages of Subnetting


Dividing a network into many small Networks is known as Subnetting.
Subnetting is useful in many ways like:

1. It provides security to one network from another network. eg) In an Organisation, code of the Developer department must not be accessed by another department.
2. It may be possible that a particular subnet might need higher network priority than others. For example, a Sales department need to host webcasts or video conferences.
3. In the case of Small networks, maintenance is easy.

Along with these advantages, Subnetting also has some disadvantages:

1. In case of the single network, only three steps are required in order to reach
a Process i.e Source Host to Destination Network, Destination Network to Destination Host and then Destination Host to Process.

But in the case of Subnetting four steps are required for Inter-Network Communication. i.e Source Host to Destination Network, Destination Network to proper Subnet, then Subnet to Host and finally Host to Process.
Hence, it increases Time complexity. In the case of Subnet, more time is required for communication or data transfer.



2. In the case of Single Network only two IP addresses are wasted to represent Network Id and Broadcast address but in case of Subnetting two IP addresses are wasted for each Subnet.
Example: If a Network has four Subnets, it means 8 IP addresses are going to waste.

Network Id for S1: 200.1.2.0
Broadcast address of S1: 200.1.2.63

Network Id for S2: 200.1.2.64
Broadcast address of S2: 200.1.2.127

Network Id for S3: 200.1.2.128
Broadcast address of S3: 200.1.2.191

Network Id for S4: 200.1.2.192
Direct Broadcast address of S4: 200.1.2.255

Hence, we can say that Network size will also decrease. We can’t use our Network completely.

3. Cost of the overall Network also increases. Subnetting requires internal routers, Switches, Hubs, Bridges etc. which are very costly.


4. Subnetting and network management require an experienced network administrator. This adds to the overall cost as well.



************************************************************************************************************************
 

 SUPERNETTING

 Supernetting
Supernetting is the opposite of Subnetting. In subnetting, a single big network is divided into multiple smaller subnetworks. In Supernetting, multiple networks are combined into a bigger network termed as a Supernetwork or Supernet.

Supernetting is mainly used in Route Summarization, where routes to multiple networks with similar network prefixes are combined into a single routing entry, with the routing entry pointing to a Super network, encompassing all the networks. This in turn significantly reduces the size of routing tables and also the size of routing updates exchanged by routing protocols.

More specifically,
• When multiple networks are combined to form a bigger network, it is termed as super-netting
• Super netting is used in route aggregation to reduce the size of routing tables and routing table updates

There are some points which should be kept in mind while supernetting:
1. All the IP address should be contiguous.
2. Size of all the small networks should be equal and must be in form of 2n.
3. First IP address should be exactly divisible by whole size of supernet.

Example – Suppose 4 small networks of class C:
200.1.0.0,
200.1.1.0,
200.1.2.0,
200.1.3.0

Build a bigger network which have a single Network Id.

Explanation – Before Supernetting routing table will be look like as:
NETWORK ID   SUBNET MASK     INTERFACE
200.1.0.0   255.255.255.0       A
200.1.1.0   255.255.255.0       B
200.1.2.0   255.255.255.0       C
200.1.3.0   255.255.255.0       D

First, lets check whether three condition are satisfied or not:

1. Contiguous: You can easily see that all network are contiguous all having size 256 hosts.

Range of first Network from 200.1.0.0 to 200.1.0.255. If you add 1 in last IP address of first network that is 200.1.0.255 + 0.0.0.1, you will get the next network id that is 200.1.1.0. Similarly, check that all network are contiguous.

2. Equal size of all network: As all networks are of class C, so all of the have a size of 256 which in turn equal to 2^8.

3. First IP address exactly divisible by total size: When a binary number is divided by 2^n then last n bits are the remainder. Hence in order to prove that first IP address is exactly divisible by while size of Supernet Network. You can check that if last n v=bits are 0 or not.
In given example first IP is 200.1.0.0 and whole size of supernet is 4*2^8 = 2^10. If last 10 bits of first IP address are zero then IP will be divisible.

Last 10 bits of first IP address are zero (highlighted by green color). So 3rd condition is also satisfied.
Therefore, you can join all these 4 networks and can make a Supernet. New Supernet Id will be 200.1.0.0.

Advantages of Supernetting –

1. Control and reduce network traffic
2. Helpful to solve the problem of lacking IP addresses
3. Minimizes the routing table

Disadvantages of Supernetting –

• It cannot cover different area of network when combined
• All the networks should be in same class and all IP should be contiguous

 ************************************************

 ROUTING TABLES IN COMPUTER NETWORK

 

Routers:

A Router is a networking device that forwards data packets between computer network. This device is usually connected to two or more different networks. When a data packet comes to a router port, the router reads address information in packet to determine out which port the packet will be sent. For example, a router provides you with the internet access by connecting your LAN with the Internet.

When a packet arrives at a Router, it examines destination IP address of a received packet and make routing decisions accordingly. Routers use Routing Tables to determine out which interface the packet will be sent. A routing table lists all networks for which routes are known. Each router’s routing table is unique and stored in the RAM of the device.

Routing Table:

A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables. See below a Routing Table:

Destination             Subnet mask             Interface

128.75.43.0             255.255.255.0             Eth0
128.75.43.0             255.255.255.128         Eth1
192.12.17.5             255.255.255.255         Eth3
default                                                         Eth2

The entry corresponding to the default gateway configuration is a network destination of 0.0.0.0 with a network mask (netmask) of 0.0.0.0. The Subnet Mask of default route is always 255.255.255.255 .


Entries of an IP Routing Table:

A routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network.

Each entry in the routing table consists of the following entries:

1. Network ID:
The network ID or destination corresponding to the route.
 
2. Subnet Mask:
The mask that is used to match a destination IP address to the network ID.
 
3. Next Hop:
The IP address to which the packet is forwarded.
 
4. Outgoing Interface:
Outgoing interface the packet should go out to reach the destination network.
 
5. Metric:
A common use of the metric is to indicate the minimum number of hops (routers crossed) to the network ID.

Routing table entries can be used to store the following types of routes:
• Directly Attached Network IDs
• Remote Network IDs
• Host Routes
• Default Route
• Destination


How are Routing Tables populated?

There are ways to maintain Routing Table:
• Directly connected networks are added automatically.
• Using Static Routing. 
• Using Dynamic Routing.

These Routing tables can be maintained manually or dynamically. In dynamic routing, devices build and maintain their routing tables automatically by using routing protocols to exchange information about the surrounding network topology. Dynamic routing tables allow devices to “listen” to the network and respond to occurrences like device failures and network congestion. Tables for static network devices do not change unless a network administrator manually changes them.


Route Determination Process (finding Subnet ID using Routing Table):

Consider a network is subnetted into 4 subnets as shown in the above picture. The IP
Address of the 4 subnets are:
200.1.2.0 (Subnet a)
200.1.2.64 (Subnet b)
200.1.2.128 (Subnet c)
200.1.2.192 (Subnet d)

Then, Routing table maintained by the internal router looks like:
DESTINATION     SUBNET MASK     INTERFACE
200.1.2.0             255.255.255.192             A
200.1.2.64           255.255.255.192             B
200.1.2.128         255.255.255.192             C
200.1.2.192         255.255.255.192             D
200.1.2.192         255.255.255.192             d
Default                 0.0.0.0                             e

To find its right subnet (subnet ID), router performs the bitwise ANDing of destination
IP Address mentioned on the data packet and all the subnet masks one by one.

• If there occurs only one match, router forwards the data packet on the corresponding interface.
• If there occurs more than one match, router forwards the data packet on the interface corresponding to the longest subnet mask.
• If there occurs no match, router forwards the data packet on the interface corresponding to the default entry.


 

Comments

Popular posts from this blog

DATA LINK LAYER

MODERN CONCEPT

FAQ