0% found this document useful (0 votes)
29 views

Lecture Note Data Communication and Networking

Cyb 204
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Lecture Note Data Communication and Networking

Cyb 204
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Computer Communications Networks CYB 204

DIGITAL TRANSMISSION

A computer network is designed to send information from one point to another.


This information needs to be converted to either a digital signal or an analog
signal for transmission.

Digital-to-Digital Conversion

We said that data can be either digital or analog. We also said that signals that
represent data can also be digital or analog. Let’s see how we can represent
digital data by using digital signals. The conversion involves three
techniques: line coding, block coding, and scrambling. Line coding is
always needed, block coding and scrambling may or may not be needed.

Line Coding

Line coding is the process of converting digital data to digital signals. We


assume that data, in the form of text, numbers, graphical images, audio, or
video, are stored in computer memory as sequences of bits. Line coding
converts a sequence of bits to a digital signal. At the sender, digital data are
encoded into a digital signal; at the receiver, the digital data are recreated by
decoding the digital signal.

Characteristics of Line Coding

Signal Element Versus Data Element

Let us distinguish between a data element and a signal element. In data


communications, our goal is to send data elements. A data element is the
smallest entity that can represent a piece of information: this is the bit. In digital

1
Computer Communications Networks CYB 204

data communications, a signal element carries data elements. A signal


element is the shortest unit (timewise) of a digital signal. In other words, data
elements are what we need to send; signal elements are what we can send.
Data elements are being carried; signal elements are the carriers.
We define a ratio r which is the number of data elements carried by each signal
element.
Figure below shows several situations with different values of r .

2
Computer Communications Networks CYB 204

Data Rate Versus Signal Rate:

The data rate defines the number of data elements (bits) sent in 1s. The unit is
bits per second (bps). The signal rate is the number of signal elements sent in
1s. The unit is the baud. There are several common terminologies used in the
literature. The data rate is sometimes called the bit rate; the signal rate is
sometimes called the pulse rate, the modulation rate, or the baud rate.
One goal in data communications is to increase the data rate while
decreasing the signal rate. Increasing the data rate increases the speed of
transmission; decreasing the signal rate decreases the bandwidth
requirement. In our vehicle-people analogy, we need to carry more people in
fewer vehicles to prevent traffic jams. We have a limited bandwidth in our
transportation system.
We now need to consider the relationship between data rate and signal rate
(bit rate and baud rate). This relationship, of course, depends on the value of
r. It also depends on the data pattern. If we have a data pattern of all 1s or all
0s, the signal rate may be different from a data pattern of alternating 0s and
1s. To derive a formula for the relationship, we need to define three cases: the
worst,
best, and average. The worst case is when we need the maximum signal rate;
the best case is when we need the minimum.
In data communications, we are usually interested in the average case. We
can formulate the relationship between data rate and signal rate as

S =c * N * (1/r) baud where N is the data rate (bps); c is the case factor,
which varies for each case; S is the number of signal elements; and r is the
previously defined factor.

3
Computer Communications Networks CYB 204

Example
A signal is carrying data in which one data element is encoded as one signal
element (r = 1). If the bit rate is 100 kbps, what is the average value of the
baud rate if c is between 0 and l?

Solution
We assume that the average value of c is (1/2). The baud rate is
then S =c * N * (1/r) = (1/2) * 100,000 * 1 = 50,000 = 50 Kbaud

Channel Bandwidth and Capacity

Bandwidth
Bandwidth refers to the permissible speed of data transfer between devices
within a network. It indicates the amount of information that can be transmitted
across the network over a certain period of time. The higher the bandwidth, the
faster the data transmission speed.

Bandwidth is typically measured in bits per second (bps) or its derivatives, such
as kilobits per second (Kbps), megabits per second (Mbps), or gigabits per
second (Gbps).

Channel Capacity
By capacity of a channel, it means the capacity of the transmission medium
(wire or link). Capacity is the number of bits the transmission medium can hold.

Types of Communication Channel


There are three types of communication channels in computer networking −

Simplex channel − Signals can only be sent in one way using a simple
communication connection. As a result, the channel's complete bandwidth can
be used during transmission.

4
Computer Communications Networks CYB 204

Half-duplex channel − A half-duplex communication channel can send signals


in both directions simultaneously, but only in one (one at a time). It can be
thought of as a simplex communication channel with a switchable transmission
direction.

Full-duplex channel − A full-duplex communication link can simultaneously


send signals in both directions. Communication efficiency is considerably
improved by using full-duplex communication channels.

For example, when the transmission medium is operating in its maximum


capacity, the number of bits it is holding at that time is called capacity of the
transmission medium.

How can we represent it mathematically,

i. If the length of the transmission medium is longer, its capacity will be


higher.
ii. It also depends on the area of cross section of the medium.
iii. If the bandwidth is 1 bps, then every second it can take 1 bit. After every
second it will move forward so that next bit could occupy the space.
Therefore, the final time in which it will occupy all the bits will be its
propagation delay.

The capacity of the channel depends on two things:

1. Bandwidth
2. Propagation delay

Capacity = bandwidth * propagation delay (in case of half duplex)

Capacity =2 * bandwidth * propagation delay (in case of full duplex)

5
Computer Communications Networks CYB 204

EXAMPLE 1

Calculate the capacity of a communication channel with a bandwidth of 10 MHz


and a propagation delay of 2 milliseconds. Assume the communication is
operating in full-duplex mode.

Solution:

- Bandwidth (B) = 10 MHz = (10 * 106) Hz


- Propagation Delay (D) = 2 milliseconds = (2 * 10-3) seconds

Using the formula for full-duplex communication channel capacity:

Capacity = 2 * Bandwidth * Propagation Delay

Substitute the given values:

Capacity = 2 * (10 * 106 Hz) * (2 * 10-3 seconds)

Capacity = 2 * 107 * 2 * 10-3

Capacity = 40 kbps (kilobits per seconds)

So, the capacity of the communication channel is 4 Mbps (megabits per


second).

6
Computer Communications Networks CYB 204

If the bandwidth is given in bps (bits per second), you can still use the same
formula for capacity, but you'll need to adjust the units accordingly. Let's modify
the example to use bandwidth in bps:

Example 2
Calculate the capacity of a communication channel with a bandwidth of 20
Mbps (20 million bits per second) and a propagation delay of 5 milliseconds.

Solution:

- Bandwidth (B) = 20 Mbps = (20 * 106) bps (bits per second)


- Propagation Delay (D) = 5 milliseconds = (5 * 10-3) seconds

Using the formula for full-duplex communication channel capacity:

Capacity = 2 * Bandwidth * Propagation Delay

Substitute the given values:

Capacity = 2 * (20 * 106 bps) * (5 * 10-3 seconds)

Capacity = 2 * 20 * 106 * 5 * 10-3

Capacity = 200 * 106 * 5 * 10-3

Capacity = 1000 Mbps

So, the capacity of the communication channel is 1000 Mbps (megabits per
second).

7
Computer Communications Networks CYB 204

EXAMPLE 3
A network with bandwidth of 10 Mbps can pass only an average of 12,000
frames per minute with each frame carrying an average of 10,000 bits. What
is the throughput of this network?

Solution

To find the throughput of the network, we first need to calculate the total
number of bits that can be transmitted in a minute, then divide that by the total
time taken.

Given:
Bandwidth = 10 Mbps
Frames per minute = 12,000
Bits per frame = 10,000

First, let's calculate the total number of bits transmitted per minute:

Total bits per minute = Frames per minute × Bits per frame

= 12,000 frames/minute × 10,000 bits/frame

= 120,000,000 bits/minute

Now, let's convert the bandwidth from Mbps to bits per minute:

Bandwidth = 10 Mbps = 10,000,000 bits/minute

To find the throughput, we'll take the minimum of the total bits per minute and
the bandwidth, as throughput cannot exceed the capacity of the network:

Throughput = min(Total bits per minute, Bandwidth)

= min(120,000,000 bits/minute, 10,000,000 bits/minute)

= 10,000,000 bits/minute

So, the throughput of this network is 10,000,000 bits per minute.

8
Computer Communications Networks CYB 204

Example 5
To find the maximum data rate achievable for the telephone channel with a
bandwidth of 3 kHz and a signal-to-noise ratio exceeding 30 dB, we can use
the Shannon-Hartley theorem:

C = W * log2 (1 + SNR)

Given:
- Bandwidth (W) = 3 kHz = 3 * 103 Hz
- Signal-to-Noise Ratio (SNR) > 30 dB

First, convert the SNR from decibels (dB) to linear scale:

SNR (linear) = 10(SNR (dB) / 10)

For SNR > 30 dB:

SNR (linear) = 10(30/10) = 103 = 1000

Now, plug the values into the Shannon-Hartley theorem:

C = 3 * 103 *log2 (1 + 1000)

C = 3 * 103 log2 (1001)

C ≈ 3 * 103 * 9.97

C ≈ 29.91 * 103

C ≈ 29910 bps

So, the maximum data rate achievable for this telephone channel is
approximately 29.91 kbps (kilobits per second).

9
Computer Communications Networks CYB 204

Local Area Network (LAN) technologies

Local Area Network (LAN) technologies are essential for connecting devices
within a limited geographic area, such as a home, office, or campus. Two
widely used LAN technologies are Ethernet and Token Ring, each with its own
characteristics and advantages.

1. Ethernet:
- Description: Ethernet is the most commonly used LAN technology. It
employs a bus or star topology and uses Carrier Sense Multiple Access with
Collision Detection (CSMA/CD) as its access method. This means that devices
on the network listen for traffic, and if the line is clear, they can transmit. If two
devices transmit simultaneously, they detect the collision and back off,
retransmitting after a random time interval.
- Speeds: Ethernet has evolved over time to support various speeds,
including 10 Mbps (Ethernet), 100 Mbps (Fast Ethernet), 1 Gbps (Gigabit
Ethernet), 10 Gbps (10 Gigabit Ethernet), 40 Gbps, and even 100 Gbps.
- Media Types: Ethernet can run over different types of physical media,
including twisted-pair copper cables (e.g., Cat 5e, Cat 6), coaxial cables, and
fiber optic cables.
- MAC Addressing: Ethernet uses Media Access Control (MAC) addresses,
which are unique identifiers assigned to network interface controllers for
communication on the physical network segment. MAC addresses are typically

10
Computer Communications Networks CYB 204

expressed as 48-bit hexadecimal numbers, and they are used for addressing
and delivering data frames within the LAN.

2. Token Ring:
- Description: Token Ring is a LAN technology that uses a ring topology.
Devices are connected in a logical ring, and a token circulates around the ring,
granting the right to transmit data. Only the device holding the token can send
data, ensuring collision-free transmission.
- Speeds: Token Ring typically operated at speeds of 4 Mbps or 16 Mbps.
- Media Types: Token Ring networks traditionally used shielded twisted-pair
copper cabling.
- MAC Addressing: Token Ring also uses MAC addresses for addressing
devices on the network. However, unlike Ethernet, where devices compete for
access to the network, Token Ring devices must wait for the token to be passed
to them before they can transmit data.

Both Ethernet and Token Ring have been widely used in the past, but Ethernet
has largely become the dominant LAN technology due to its scalability,
simplicity, and higher speeds. However, understanding both technologies
provides a comprehensive view of LAN technologies and their evolution.

11
Computer Communications Networks CYB 204

Switched Ethernet, shared Ethernet and Client-Server Communication

1. Switched Ethernet:
- Description: In switched Ethernet, each device on the network is connected
to a switch port. Switches use MAC addresses to forward data only to the port
where the destination device is located, resulting in more efficient data
transmission compared to shared Ethernet.
- Advantages:
i. Reduced collisions: Each device has its own dedicated bandwidth,
reducing the likelihood of collisions and improving network performance.
ii. Better security: Switches create separate collision domains for each port,
isolating traffic and enhancing network security.
iii. Scalability: Switched Ethernet networks can easily scale to
accommodate more devices without significant performance degradation.
- Disadvantages:
i. Cost: Switched Ethernet typically requires more hardware (switches) than
shared Ethernet, leading to higher initial setup costs.
ii. Complexity: Managing and configuring switches in a switched Ethernet
network can be more complex compared to shared Ethernet.

12
Computer Communications Networks CYB 204

2. Shared Ethernet:
- Description: Shared Ethernet, also known as Ethernet hubs or legacy
Ethernet, relies on a shared medium where all devices on the network share
the same bandwidth. When one device transmits data, all other devices on the
network receive the data, regardless of whether it's intended for them.
- Advantages:
i. Simplicity: Shared Ethernet networks are relatively simple to set up and
manage compared to switched Ethernet networks.
ii. Cost-effectiveness: Shared Ethernet requires fewer hardware
components (hubs) than switched Ethernet, resulting in lower initial costs.
- Disadvantages:
i. Lower performance: Shared Ethernet networks can suffer from collisions
and congestion, leading to lower overall network performance, especially as
the number of devices increases.
ii. Security concerns: Since all devices on the network can see each other's
traffic, shared Ethernet networks are less secure than switched Ethernet
networks.

3. Client-Server Communications:

- Description: Client-server communication is a networking model where one


device (the client) requests services or resources from another device (the
server) over the network. The server provides the requested resources or
services to the client in response to the client's requests.
- Advantages:
i. Centralized resources: Client-server architectures allow for the
centralization of resources and data, making it easier to manage and secure.

13
Computer Communications Networks CYB 204

ii. Scalability: Client-server architectures can easily scale to accommodate


a large number of clients and provide services efficiently.
iii. Specialization: Servers can be specialized for specific tasks, such as file
storage, database management, or web serving, optimizing performance and
resource utilization.
- Disadvantages:
i. Single point of failure: If the server experiences downtime or failure,
clients may lose access to critical resources or services.
ii. Network latency: Client-server communication relies on network
connectivity, which can introduce latency, especially in wide-area networks
(WANs) or over long distances.
iv. Management complexity: Managing and maintaining server
infrastructure, including security, backups, and updates, can be complex
and require specialized skills.

Note: switched Ethernet offers better performance and security compared to


shared Ethernet but comes with higher costs and complexity. Client-server
communication provides a scalable and efficient model for accessing
resources and services over the network but introduces concerns such as
single points of failure and network latency.

14
Computer Communications Networks CYB 204

Network Layer Protocols

Network Layer is responsible for the transmission of data or communication from one host
to another host connected in a network. Rather than describing how data is transferred, it
implements the technique for efficient transmission. In order to provide efficient
communication protocols are used at the network layer. The data is being grouped into
packets or in the case of extremely large data it is divided into smaller sub packets. Each
protocol used has specific features and advantages. The below article covers in detail the
protocols used at the network layer.
Functions of Network Layer
The network layer is responsible for providing the below-given tasks:
• Logical Addressing: Each device on the network needs to be identified
uniquely. Therefore network layer provides an addressing scheme to identify the
device. It places the IP address of every sender and the receiver in the header.
This header consists of the network ID and host ID of the network.
• Host-to-host Delivery of Data: The network layer ensures that the packet is
being delivered successfully from the sender to the receiver. This layer makes
sure that the packet reaches the intended recipient only.
• Fragmentation: In order to transmit the larger data from sender to receiver, the
network layer fragments it into smaller packets. Fragmentation is required
because every node has its own fixed capacity for receiving data.
• Congestion Control: Congestion is defined as a situation where the router is
not able to route the packets property which results in aggregation of packets in
the network. Congestion occurs when a large amount of packets are flooded in
the network. Therefore network layer controls the congestion of data packets in
the network.
• Routing and Forwarding: Routing is the process that decides the route for
transmission of packets from sender to receiver. It mostly chooses the shortest
path between the sender and the receiver. Routing protocols that are mostly
used are path vector, distance vector routing, link state routing, etc.
Network Layer Protocols
There are various protocols used in the network layer. Each protocol is used for a different
task. Below are the protocols used in the network layer:

15
Computer Communications Networks CYB 204

Protocols at each Layer

1. IP (Internet Protocol)
IP stands for Internet Protocol. Internet Protocol helps to uniquely identify each device on
the network. Internet protocol is responsible for transferring the data from one node to
another node in the network. Internet protocol is a connectionless protocol therefore it does
not guarantee the delivery of data. For the successful delivery higher level protocols such
as TCP are used to guarantee the data transmission. The Internet Protocol is divided in two
types. They are:
• IPv4: IPv4 provides with the 32 bit address scheme. IPv4 addressing has four
numeric fields and are separated by dot. IPv4 can be configured either using
DHCP or manually. IPv4 does not provide with more security features as it does
not support authentication or encryption techniques. IPv4 is further divided into
five classes as Class A, Class B, Class C, Class D and Class E.
• IPv6: IPv6 is the most recent version of IP. If provided with a 128 bit addressing
scheme. IP address has eight fields that are separated by colon, and these
fields are alphanumeric. The IPv6 address is represented in hexadecimal. IPv6
provides with more security features such as authentication and encryption.
IPv6 supports end-to-end connection integrity. IPv6 provides with more range of
IP address as compared to IPv4.
Part 1: IP addressing scheme
IP addressing scheme is based on two parts:
• network address (number) and
• host address (number)

16
Computer Communications Networks CYB 204

The classical addressing scheme is fixed into 5 classes:


First byte in 32-bit address:
class A: 00000000 – 01111111 ...
class B: 10000000 – 10111111 ...
class C: 11000000 – 11011111 ...
class D: 11100000 – 11101111 ...
class E: 11110000 – 11111111 ...
Exercise 1:
a. Give the corresponding decimal values and the interpretation
b. What is the problem with the usage of class-based addressing scheme?

Solution 1

a. Decimal Values and Interpretation of Class-Based Addressing Scheme


In the classical IP addressing scheme, IPv4 addresses are divided into five classes: A, B,
C, D, and E. However, classes D and E are typically used for special purposes
(multicasting and experimental use, respectively). Here is the breakdown of the address
classes, their corresponding binary ranges, and the interpretation of these addresses:

Class A
• Binary range: 00000000 – 01111111
• Decimal range: 0 – 127
• Interpretation:
o Class A addresses are used for very large networks.
o The first byte (8 bits) is the network portion, and the remaining three bytes
(24 bits) are the host portion.
o Example: 10.0.0.0 is a Class A address.
o Default subnet mask: 255.0.0.0 (/8) (Note: /8 specify that the first 8 bits are
used for the network identifier.)

Class B
• Binary range: 10000000 – 10111111
• Decimal range: 128 – 191
• Interpretation:
o Class B addresses are used for medium-sized networks.
o The first two bytes (16 bits) are the network portion, and the remaining two
bytes (16 bits) are the host portion.
o Example: 172.16.0.0 is a Class B address.
o Default subnet mask: 255.255.0.0 (/16)

17
Computer Communications Networks CYB 204

Class C
• Binary range: 11000000 – 11011111
• Decimal range: 192 – 223
• Interpretation:
o Class C addresses are used for small-sized networks.
o The first three bytes (24 bits) are the network portion, and the remaining one
byte (8 bits) is the host portion.
o Example: 192.168.0.0 is a Class C address.
o Default subnet mask: 255.255.255.0 (/24)

Class D
• Binary range: 11100000 – 11101111
• Decimal range: 224 – 239
• Interpretation:
o Class D addresses are used for multicast groups.
o They do not have a network or host portion.
o Example: 224.0.0.0 is a Class D address.
o Default Subnet Mask: Not applicable
o Multicasting is used for sending data to multiple destinations.

Class E
• Binary range: 11110000 – 11111111
• Decimal range: 240 – 255
• Interpretation:
o Class E addresses are reserved for experimental purposes and future use.
o They are not assigned to any network.

b. Problems with Class-Based Addressing Scheme


1. Inefficient IP Address Utilization: Class-based addressing leads to inefficient use
of IP addresses. Large blocks of addresses (like Class A and B) are often allocated
to organizations that do not need that many addresses, resulting in wastage.
2. Rigidity in Address Allocation: The fixed nature of class boundaries does not
allow for flexibility in address allocation. An organization requiring more than 254
hosts but fewer than 65,536 hosts would have to be allocated a Class B address,
leading to inefficient utilization of the address space.
3. Scalability Issues: The class-based system does not scale well with the growing
number of networks and devices on the internet. The fixed classes can result in
exhaustion of address space within a class.
4. Routing Table Size: The fixed class boundaries lead to larger routing tables
because each network has to be listed individually. This increases the complexity
and memory requirements for routers.
5. Lack of Support for Subnetting and Supernetting: While subnetting is possible
within a class, the rigid class structure does not easily support more efficient use of
IP address space through techniques like Classless Inter-Domain Routing (CIDR),
which allows for more flexible allocation.

Note:

18
Computer Communications Networks CYB 204

To address these issues of class based addressing scheme, Classless Inter-Domain


Routing (CIDR) was introduced, which allows for variable-length subnet masking (VLSM)
and more efficient allocation of IP addresses. CIDR replaces the rigid class-based
addressing scheme with a more flexible, hierarchical approach.

Classless addressing scheme:


Classless IP addresses mean that the address range is determined by the subnet mask.
the address 172.19.64.2 and subnet mask 255.255.255.0 has its range as 172.19.64.0-255
because 255.255.255.0 corresponds to that range.
Exercise 2:
a. Take the same address 172.19.64.2 and subnet mask 255.255.248.0; give the
subnetwork address (number) and the range of host adresses on this network.
b. Give the broadcast address on this network.

Solution 2:

To solve this, we need to understand how subnetting works with the given IP address
and subnet mask. Here are the steps:
i. Convert the subnet mask to binary form.
ii. Apply the subnet mask to the IP address to find the network address.
iii. Calculate the range of host addresses in the subnet.
iv. Determine the broadcast address.
Given:
IP Address: 172.19.64.2
Subnet Mask: 255.255.248.0
Step-by-Step Solution for:
a. Subnetwork Address and Range of Host Addresses
Step 1: Convert Subnet Mask to Binary
255.255.248.0 in binary:
Decimal 255 255 248 0
Binary 11111111 11111111 11111000 00000000

19
Computer Communications Networks CYB 204

Step 2: Convert IP Address to Binary


172.19.64.2 in binary:
Decimal 172 19 64 2

Binary 10101100 00010011 01000000 00000010

Step 3: Apply Subnet Mask to IP Address


Perform a bitwise AND operation between the IP address and the subnet mask:
IP Address 10101100 00010011 01000000 00000010
Subnet Mask 11111111 11111111 11111000 00000000
Network Address 10101100 00010011 01000000 00000000
(bitwise AND
operation)

network address 172 19 64 0

in decimal:

The network address in decimal: 172.19.64.0


Step 4: Determine the Range of Host Addresses
Subnet Mask and Network Calculation Recap:
Subnet Mask: 255.255.248.0
Subnet Mask in Binary: 11111111.11111111.11111000.00000000
IP Address: 172.19.64.2
Network Address: 172.19.64.0
Number of Host Bits
The subnet mask 255.255.248.0 has 21 network bits and 11 host bits:
Network bits: The number of 1s in the subnet mask (21 bits)
Host bits: The number of 0s in the subnet mask (11 bits)
Calculating the Number of Hosts in the Subnet
The number of possible host addresses in the subnet is calculated as:

20
Computer Communications Networks CYB 204

2number of host bits – 2 = 211 – 2 = 2048 – 2 = 2046


We subtract 2 to account for the network address and the broadcast address,
which cannot be assigned to hosts.
Determining the Range of Host Addresses
First Host Address: The first host address is the network address plus one. For the
network address 172.19.64.0, the first host address is:
172.19.64.0 + 1 = 172.19.64.1
Last Host Address: The last host address is the network address plus the number of
hosts. To find the last host address, we need to calculate the last address in the subnet.
Since the subnet spans 2046 host addresses, we need to add 2046 to the network
address (considering the 0-based indexing of addresses):
172.19.64.0 + 2046 = 172.19.71.254
The addition process
To add 2046 to the network address:
Start from 64.0, and add 2046.
The third octet (64) in 172.19.64.0 will increase by the number of complete 256
increments it can hold, and the fourth octet (0) will handle the remaining.
Calculate how many full 256 (that is the IPv4 address range 0 to 255) increments fit
into 2046:
2046 ÷ 256 = 7 (remaining 254)
Therefore,
add 7 to 64 and
254 to 0
Then we have
172.19.64.0 + 2046 = 172.19.71.254

Therefore, the range of host addresses is from 172.19.64.1 to 172.19.71.254.

21
Computer Communications Networks CYB 204

Step 5: Determine the Broadcast Address


The broadcast address is the last address in the subnet. It can be found by setting all
the host bits to 1 in the network address:
Network Address in Binary: 10101100.00010011.01000000.00000000
Subnet Mask in Binary: 11111111.11111111.11111000.00000000
To find the broadcast address, we set the host bits (last 11 bits) to 1:
10101100.00010011.01000111.11111111
Note that the Host bits are the number of 0s in the subnet mask (11 bits)
Convert the broadcast address back to decimal:
10101100.00010011.01000111.11111111 = 172.19.71.255
Lastly:
a. Subnetwork Address: 172.19.64.0
Range of Host Addresses: 172.19.64.1 to 172.19.71.254
b. Broadcast Address: 172.19.71.255

22
Computer Communications Networks CYB 204

Global and private IP addresses:


Some values of IP addresses are reserved for the “private” usage on the local networks
where the hosts addresses are not integrated into the global addressing scheme.
24 bit block /8 prefix – from 10.0.0.0 to 10.255.255.255
20 bit block /12 prefix – from 172.16.0.0 to 172.31.255.255
16 bit block /16 prefix – from 192.168.0.0 to 192.168.255.255
Any user may use any of the reserved blocks. Typically, a network administrator will divide
a block into subnets; for example, many home routers automatically use a default address
range of 192.168.0.0 through 192.168.0.255 (192.168.0.0/24)

Example of IP addresses (host interface) :


lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:24:1d:78:35:b5 brd ff:ff:ff:ff:ff:ff
inet 172.19.64.141/21 brd 172.19.71.255 scope global eth0
inet6 fe80::224:1dff:fe78:35b5/64 scope link

Part 2: IP protocol and the forwarding mechanisms

Here is the IP protocol header:


struct ip {
unsigned int ip_hl:4; /* both fields are 4 bits */
unsigned int ip_v:4;
uint8_t ip_tos; // type of service
uint16_t ip_len; // length of packet
uint16_t ip_id; // packet identifier
uint16_t ip_off; // fragmentation falgs (3 bits) and offset (13 bits)
uint8_t ip_ttl; // time to live
uint8_t ip_p; // protocol
uint16_t ip_sum; // check sum
struct in_addr ip_src; // source address
struct in_addr ip_dst; // destination address
};

23
Computer Communications Networks CYB 204

Exercise:
Draw the IP header alligned to 32-bit words and explain the fields of the header.

Explanation of Each Field


Version (4 bits):
Indicates the version of the IP protocol. For IPv4, this value is 4.
IHL (Internet Header Length) (4 bits):
Specifies the length of the IP header in 32-bit words. The minimum value is 5
(indicating a 20-byte header) and the maximum value is 15 (indicating a 60-byte
header).
Type of Service (TOS) (8 bits):
Specifies the priority and quality of service desired for the packet. This field is often
used for specifying Differentiated Services (DiffServ) and Explicit Congestion
Notification (ECN).
Total Length (16 bits):
Specifies the total length of the IP packet, including the header and data, in bytes.
The minimum length is 20 bytes, and the maximum length is 65,535 bytes.
Identification (16 bits):
Used to uniquely identify each packet sent by a host. It is used for reassembling
fragmented packets.
Flags (3 bits):
Control and indicate fragmentation. The three bits are:
Reserved: Must be zero.
DF (Don't Fragment): If set, the packet should not be fragmented.
MF (More Fragments): If set, more fragments are following this fragment.
Fragment Offset (13 bits):
Indicates the position of the fragment in the original packet. It helps in reassembling
the fragmented packets.
Time to Live (TTL) (8 bits):
Specifies the maximum number of hops (routers) the packet can traverse before
being discarded. This prevents packets from circulating indefinitely.

24
Computer Communications Networks CYB 204

Protocol (8 bits):
Indicates the protocol used in the data portion of the IP packet. Common values
include 1 for ICMP, 6 for TCP, and 17 for UDP.
Header Checksum (16 bits):
Used for error-checking the header of the IP packet. It ensures the integrity of the
header.
Source Address (32 bits):
Specifies the IP address of the sender.
Destination Address (32 bits):
Specifies the IP address of the receiver.
Options and Padding (variable length):
Optional field used for various control options. Padding is added to ensure the
header length is a multiple of 32 bits. The length of this field varies, making the total
header length between 20 and 60 bytes.
Note:
The IPv4 header consists of mandatory fields that provide essential information for routing
and delivering packets. The fields are designed to be aligned to 32-bit boundaries for
efficient processing by network devices. Options and padding fields allow for additional
functionality and alignment.

2. ARP (Address Resolution Protocol)


ARP stands for Address Resolution Protocol. ARP is used to convert the logical address
ie. IP address into physical address ie. MAC address. While communicating with other
nodes, it is necessary to know the MAC address or physical address of the destination
node. If any of the node in a network wants to know the physical address of another node
in the same network, the host then sends an ARP query packet. This ARP query packet
consists of IP address and MAC address of source host and only the IP address of
destination host. This ARP packet is then received to every node present in the network.
The node with its own IP address recognises it and sends it MAC address to the requesting
node. But sending and receiving such packets to know the MAC address of destination
node it increases the traffic load. Therefore in order to reduce this traffic and improve the
performance, the systems that makes use of ARP maintain a cache of recently acquired
IP into MAC address bindings.
How Does ARP Work?
• The host broadcasts an ARP inquiry packet containing the IP address over the
network in order to find out the physical address of another computer on its
network.
• The ARP packet is received and processed by all hosts on the network;
however, only the intended recipient can identify the IP address and reply with
the physical address.
• After adding the physical address to the datagram header and cache memory,
the host storing the datagram transmits it back to the sender.

25
Computer Communications Networks CYB 204

Types of ARP Entries


• Static Entry: This type of entry is created when a user uses the ARP
command utility to manually enter the IP to MAC address association.
• Dynamic Entry: A dynamic entry is one that is automatically formed when a
sender broadcasts their message to the whole network. Dynamic entries are
periodically removed and are not permanent.

Address Resolution Protocol – ARP


struct arp
{
unsigned short arp_htype; /* ARP Hardware Format */
unsigned short arp_ptype; /* ARP Protocol Format */
unsigned char arp_haddr; /* ARP Hardware Address Length */
unsigned char arp_paddr; /* ARP Protocol Address Length */
unsigned short arp_op; /* ARP Opcode */
unsigned char arp_hsrc[6]; /* ARP Sender Ethernet Address */
unsigned char arp_psrc[4]; /* ARP Sender IP Address */
unsigned char arp_hdst[6]; /* ARP Target Ethernet Address */
unsigned char arp_pdst[4]; /* ARP Target IP Address */
};

On a local network the hosts communicate using physical addresses (also called MAC
addresses). The MAC addresses are coded on 48 bits (6 bytes); the question is how to
associate the IP addreses to the MAC addresses. This work is done by ARP protocol.

26
Computer Communications Networks CYB 204

Exercise:
Explain the usage of broadcast addresses in MAC frames. Note that the hosts
maintain the ARP cache containing the associations between the IP and MAC
addresses (this cache is regenerated automatically after the predefined period, for
instance 30s)

Solution
Usage of Broadcast Addresses in MAC Frames

1. ARP Requests:
a. The Address Resolution Protocol (ARP) uses broadcast frames to resolve IP
addresses to MAC addresses.
b. When a device needs to communicate with another device on the same network but
does not know its MAC address, it sends an ARP request to the broadcast address.
c. Example: A device with IP address 192.168.1.1 wants to communicate with
192.168.1.2. It sends an ARP request to the broadcast MAC address
FF:FF:FF:FF:FF:FF, asking "Who has IP address 192.168.1.2? Please send your
MAC address."

27
Computer Communications Networks CYB 204

2. DHCP Discover:
a. When a device connects to a network and needs an IP address, it sends a DHCP
Discover message to the broadcast address.
b. This message is intended to reach any DHCP servers on the network, which will
respond with an IP address offer.

3. Network Announcements:
a. Various network protocols use broadcast addresses to announce services or updates
to all devices on the network.
b. Examples include routing protocol updates (e.g., RIP) and network discovery
protocols (e.g., NetBIOS over TCP/IP).

3. RARP
RARP stands for Reverse Address Resolution Protocol. RARP works opposite of ARP.
Reverse Address Resolution Protocol is used to convert MAC address ie. physical address
into IP address ie. logical address. RARP provides with a feature for the systems and
applications to get their own IP address from a DNS( Domain Name System) or router.
This type of resolution is required for various tasks such as executing reverse DNS lookup.
As Reverse Address Resolution Protocol works at low level it requires direct network
addresses. The reply from the server mostly carries a small information but the 32 bit
internet address is used and it does not exploit the full potential of a network such as
ethernet.
How Does RARP Work?
• Data is sent between two places in a network using the RARP, which is on the
Network Access Layer.
• Every user on the network has two distinct addresses: their MAC (physical)
address and their IP (logical) address.
• Software assigns the IP address, and the hardware then builds the MAC
address into the device.
• Any regular computer connected to the network can function as the RARP
server, answering to RARP queries. It must, however, store all of the MAC
addresses’ associated IP addresses. Only these RARP servers are able to
respond to RARP requests that are received by the network. The information
package must be transmitted over the network’s lowest tiers.
• Using both its physical address and Ethernet broadcast address, the client
transmits a RARP request. In response, the server gives the client its IP
address.

28
Computer Communications Networks CYB 204

4. ICMP
ICMP stands for Internet Control Message Protocol. ICMP is a part of IP protocol suite.
ICMP is an error reporting and network diagnostic protocol. Feedback in the network is
reported to the designated host. Meanwhile, if any kind of error occur it is then reported to
ICMP. ICMP protocol consists of many error reporting and diagnostic messages. ICMP
protocol handles various kinds of errors such as time exceeded, redirection, source
quench, destination unreachable, parameter problems etc. The messages in ICMP are
divided into two types. They are given below:
• Error Message: Error message states about the issues or problems that are
faced by the host or routers during processing of IP packet.
• Query Message: Query messages are used by the host in order to get
information from a router or another host.
How Does ICMP Work?
• The main and most significant protocol in the IP suite is called ICMP. However,
unlike TCP and UDP, ICMP is a connectionless protocol, meaning it doesn’t
require a connection to be established with the target device in order to
transmit a message.
• TCP and ICMP operate differently from one another; TCP is a connection-
oriented protocol, while ICMP operates without a connection. Every time a
connection is made prior to a message being sent, a TCP Handshake is
required of both devices.
• Datagrams including an IP header containing ICMP data are used to transmit
ICMP packets. An independent data item like a packet is comparable to an
ICMP datagram.

29
Computer Communications Networks CYB 204

ICMP
ICMP is used by hosts and routers to communicate network-layer information to each other.
The most typical use of ICMP is for error reporting. For example, when running a Telnet,
FTP, or HTTP session, you may have encountered an error message such as “Destination
network unreachable.” This message had its origins in ICMP. At some point, an IP router
was unable to find a path to the host specified in your Telnet, FTP, or HTTP application.
That router cre- ated and sent a type-3 ICMP message to your host indicating the error.
ICMP messages are carried inside IP datagrams. That is, ICMP messages are carried as
IP payload, just as TCP or UDP segments are carried as IP payload. Similarly, when a host
receives an IP datagram with ICMP specified as the upper-layer protocol, it demultiplexes
the datagram’s contents to ICMP, just as it would demultiplex a datagram’s content to TCP
or UDP.
ICMP messages have a type and a code field, and contain the header and the first 8 bytes
of the IP datagram that caused the ICMP message to be generated in the first place (so
that the sender can determine the datagram that caused the error).

struct icmp {
unsigned char icmp_type;
unsigned char icmp_code;
unsigned short int icmp_cksum;
/* The following data structures are ICMP type specific */
unsigned short int icmp_id;
unsigned short int icmp_seq;
}; /* total icmp header length: 8 bytes (=64 bits) */

30
Computer Communications Networks CYB 204

Remark: The reply messages identify the requests by returning the first 8 bytes of the
request datagram.

Exercise:
ICMP is used to implement several usefull commands such as ping or traceroute.
Indicate how to used the ICMP messages (type, code) to build:
1. the ping command
2. the traceroute command

Solution
ICMP (Internet Control Message Protocol) is used for error messages and operational
information queries within the IP network layer. Two of the most common utilities that
rely on ICMP are ping and traceroute. Below, we'll describe how these commands use
ICMP messages, including their types and codes.
1. The Ping Command
The ping command is used to check the connectivity between two networked devices
and measure the round-trip time for messages sent from the originating host to a
destination computer.
ICMP Messages Used:
ICMP Echo Request: Type 8, Code 0
ICMP Echo Reply: Type 0, Code 0
Process:
a. The ping command on the source device sends an ICMP Echo Request (Type 8,
Code 0) message to the destination IP address.
b. The destination device, upon receiving the Echo Request, replies with an ICMP
Echo Reply (Type 0, Code 0) message.
c. The source device receives the Echo Reply and calculates the round-trip time,
thereby determining the connectivity status and latency.

31
Computer Communications Networks CYB 204

2. The Traceroute Command

The traceroute command is used to discover the path that packets take to reach a
destination. It reveals each hop's IP address in the path from the source to the
destination.
ICMP Messages Used:
1. ICMP Time Exceeded: Type 11, Code 0
2. ICMP Echo Request: Type 8, Code 0
3. ICMP Echo Reply: Type 0, Code 0
Process:
a. The traceroute command sends a series of ICMP Echo Request (Type 8, Code 0)
messages to the destination IP address, starting with a TTL (Time to Live) value
of 1.
b. The first router in the path decrements the TTL to 0, discards the packet, and
sends back an ICMP Time Exceeded (Type 11, Code 0) message to the source.
c. Traceroute records the IP address of this first router (the first hop).
d. The process repeats, incrementing the TTL value by 1 for each subsequent ICMP
Echo Request message, allowing each router along the path to send back an
ICMP Time Exceeded message.
e. When the packet finally reaches the destination, it will send back an ICMP Echo
Reply (Type 0, Code 0), indicating the final hop has been reached.

5. IGMP
IGMP stands for Internet Group Message Protocol. IGMP is a multicasting communication
protocol. It utilizes the resources efficiently while broadcasting the messages and data
packets. IGMP is also a protocol used by TCP/IP. Other hosts connected in the network
and routers makes use of IGMP for multicasting communication that have IP networks. In
many networks multicast routers are used in order to transmit the messages to all the
nodes. Multicast routers therefore receives large number of packets that needs to be sent.
But to broadcast this packets is difficult as it would increase the overall network load.
Therefore IGMP helps the multicast routers by addressing them while broadcasting. As
multicast communication consists of more than one senders and receivers the Internet
Group Message Protocol is majorly used in various applications such as streaming media,
web conference tools, games, etc.
How Does IGMP Work?
• Devices that can support dynamic multicasting and multicast groups can use
IGMP.
• The host has the ability to join or exit the multicast group using these devices.
It is also possible to add and remove customers from the group using these
devices.
• The host and local multicast router use this communication protocol. Upon
creation of a multicast group, the packet’s destination IP address is changed to
the multicast group address, which falls inside the class D IP address range.

32

You might also like