Lecture Note Data Communication and Networking
Lecture Note Data Communication and Networking
DIGITAL 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
1
Computer Communications Networks CYB 204
2
Computer Communications Networks CYB 204
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
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.
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
1. Bandwidth
2. Propagation delay
5
Computer Communications Networks CYB 204
EXAMPLE 1
Solution:
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:
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
= 120,000,000 bits/minute
Now, let's convert the bandwidth from Mbps to bits per 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:
= 10,000,000 bits/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
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 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
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:
13
Computer Communications Networks CYB 204
14
Computer Communications Networks CYB 204
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
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
Solution 1
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.
Note:
18
Computer Communications Networks CYB 204
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
in decimal:
20
Computer Communications Networks CYB 204
21
Computer Communications Networks CYB 204
22
Computer Communications Networks CYB 204
23
Computer Communications Networks CYB 204
Exercise:
Draw the IP header alligned to 32-bit words and explain the fields of the header.
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.
25
Computer Communications Networks CYB 204
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
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