Network Technology
Network Technology
Guided transmission media refer to the physical mediums through which data signals are transmitted in a network.
Unlike wireless transmission, where data is sent through the airwaves, guided transmission media use physical
pathways, such as cables or wires, to transmit signals. These mediums guide the signals along a specific path, hence
the name "guided."Here are some common types of guided transmission media:
1. **Twisted Pair Cable:**
- Twisted pair cables are made up of pairs of copper wires twisted together. The twisting helps to reduce
electromagnetic interference from external sources.They are commonly used in telephone lines and local area
networks (LANs).Twisted pair cables come in two main categories: unshielded twisted pair (UTP) and shielded twisted
pair (STP). STP has additional shielding to further reduce interference.
2. **Coaxial Cable:* - Coaxial cables consist of a central copper conductor surrounded by a layer of insulation, a
metallic shield, and an outer insulating layer. They are widely used for cable television (CATV) and high-speed internet
connections.Coaxial cables have higher bandwidth and can transmit signals over longer distances compared to
twisted pair cables.
3. **Optical Fiber:**Optical fibers use light signals to transmit data through thin strands of glass or plastic fibers.
- They offer extremely high bandwidth and are immune to electromagnetic interference.Optical fibers are
commonly used in long-distance telecommunications networks, high-speed internet connections, and backbone
networks.
Guided transmission media offer several advantages:
- **Security:** Since the signals are confined within the physical medium, it's more difficult for unauthorized users to
intercept the data compared to wireless transmission.
- **Reliability:** Guided media are less susceptible to environmental interference and can provide more stable
connections.
- **Higher Bandwidth:** Optical fibers, in particular, offer extremely high bandwidth, making them suitable for
transmitting large amounts of data at high speeds.
However, guided transmission media also have some limitations:
- **Physical Limitations:** They require physical installation, which can be costly and labor-intensive, especially for
laying cables over long distances.
- **Susceptibility to Damage:** Cables can be damaged by environmental factors such as moisture, temperature
fluctuations, and physical stress.
- **Limited Mobility:** Devices connected via guided media are typically stationary since they rely on physical
connections.
Q.6. Generate CRC code for the data word – 11001010 using the divisor – 10101.
To generate a CRC (Cyclic Redundancy Check) code for the given data word "11001010" using the divisor
"10101," you would perform polynomial division. Here's how you can do it step by step:
Append zeros to the data word to match the length of the divisor minus 1. In this case, the divisor has a
length of 5, so append 4 zeros to the data word:Data Word: 11001010 0000
_______________________________
Divisor: | 1 0 1 0 1
Data Word: | 1 1 0 0 1 0 1 0 0 0 0
| 1 0 1 0 1 <-- Divisor * Quotient
| ---------
1 0 0 1 0 1 <-- Remainder (CRC)
The remainder obtained after the division is the CRC code. So, the CRC code for the given data word
"11001010" using the divisor "10101" is "100101."
Q.8. Describe any two Error- detection techniques.
Certainly! Here are descriptions of two common error detection techniques used in networking and data
communication:
1. **Checksum:**
- The checksum is a simple error detection technique used to detect errors in data transmission. It
involves adding up the binary values of all the data units (such as bytes or words) in a message and
appending the resulting sum (checksum value) to the message. When the message is received, the receiver
recalculates the checksum using the same algorithm and compares it to the transmitted checksum. If the
calculated checksum matches the transmitted checksum, it indicates that the message was received
without errors.
- Example: Suppose we have a message consisting of the bytes 01011001, 10101010, and 11001100. To
calculate the checksum, we sum up these bytes (01011001 + 10101010 + 11001100 = 110000011). The
checksum value is then appended to the message. Upon receiving the message, the receiver performs the
same checksum calculation. If the calculated checksum matches the transmitted checksum (110000011),
the message is assumed to be error-free.
2. **Cyclic Redundancy Check (CRC):**
- CRC is a more sophisticated error detection technique widely used in network communication protocols
such as Ethernet and Wi-Fi. It involves polynomial division, where the data to be transmitted is treated as a
binary polynomial. A fixed-length binary divisor (known as the generator polynomial) is used to divide the
data polynomial, resulting in a remainder called the CRC code. This CRC code is appended to the data
before transmission. At the receiver's end, the same divisor is used to perform polynomial division on the
received data. If the remainder obtained after division is zero, it indicates that no errors were detected in
the data transmission.
- Example: Let's say we want to transmit the data word 11001010 using the divisor 10101 for CRC
calculation. We perform polynomial division, as shown in the previous answer, and obtain a CRC code of
100101. This CRC code is then appended to the data word before transmission. Upon receiving the data
word with the appended CRC code, the receiver performs the same polynomial division. If the remainder is
zero, it indicates that the data was received without errors.
Q.9. Find the maximum number of Hosts available on – Class -B IP address with subnet mask
255.255.255.240. Also find maximum number of subnets available.
To find the maximum number of hosts available and the maximum number of subnets available with a Class
B IP address and a subnet mask of 255.255.255.240 (which corresponds to a /28 subnet), we can use the
following formulas:
Q.10. Describe HDLC protocol with its sub types and frame format.
HDLC (High-Level Data Link Control) is a bit-oriented synchronous data link layer protocol used to
encapsulate data frames for transmission over synchronous serial communication links. It is a widely used
protocol in telecommunications and networking, often serving as the basis for other protocols like SDLC
(Synchronous Data Link Control) and PPP (Point-to-Point Protocol). HDLC defines both the frame format and
the rules for frame exchange between devices.
**Frame Format:**
The HDLC frame format consists of several fields, including flags, address, control, data, and frame check
sequence (FCS). Here's a breakdown of the HDLC frame format:
1. **Flag:**
- A special bit pattern (01111110) used to indicate the beginning and end of an HDLC frame. Flags are
used for synchronization and framing, allowing the receiver to identify the boundaries of the frame.
2. **Address:**
- A field used to specify the address of the recipient device. In some configurations, this field is optional
and may be omitted.
3. **Control:**
- The control field contains information about the type of frame and the specific operation being
performed (e.g., data transfer, acknowledgment). It also includes flow control and error control
information.
4. **Data:**
- The data field contains the payload of the frame, which may include user data, control information, or
padding to fill the frame to a minimum size.
5. **Frame Check Sequence (FCS):**
- The FCS field contains a checksum or CRC value computed over the entire frame, excluding the flag
fields. It is used to detect errors introduced during transmission.
6. **Flag:**
- Another flag field marks the end of the frame, similar to the start flag.
**HDLC Subtypes:**
HDLC supports several subtypes, each with specific characteristics and functions. The most common HDLC
subtypes include:
1. **Normal Response Mode (NRM):**
- In NRM, devices communicate in a point-to-point or multipoint configuration, with one device acting as
the primary (sender) and the other as the secondary (receiver). Frames are exchanged using a combination
of polling and acknowledgment mechanisms.
2. **Asynchronous Response Mode (ARM):**
- ARM is similar to NRM but allows for asynchronous communication between devices, typically over dial-
up or packet-switched networks. Devices can transmit data independently, and acknowledgments are not
always required.
3. **Asynchronous Balanced Mode (ABM):**
- ABM supports bidirectional communication between devices, allowing either device to initiate frame
exchange. ABM is often used in networking scenarios where devices have equal roles and responsibilities.
4. **Asynchronous Balanced Mode Extended (ABME):**
- ABME extends ABM by adding additional functionality, such as selective reject and window flow control,
to improve performance and reliability in high-speed or noisy environments.
HDLC is a versatile protocol that can be adapted to various network topologies and requirements, making it
a popular choice for data link layer communication in telecommunications and networking applications. Its
simplicity, efficiency, and reliability make it well-suited for both synchronous and asynchronous
communication environments.
Q.11. Explain performance of TCP protocol in wireless network.
The performance of the TCP (Transmission Control Protocol) protocol in wireless networks can be affected
by several factors inherent to wireless communication. While TCP was originally designed for wired
networks, it is commonly used over wireless links in modern networking environments. However, the
characteristics of wireless networks, such as variable channel conditions, limited bandwidth, and higher
error rates, can impact TCP's performance. Here's how:
1. **Packet Loss and Retransmissions:**
- Wireless networks are prone to packet loss due to factors like signal interference, fading, and collisions.
When TCP detects packet loss through timeouts or duplicate acknowledgments, it assumes congestion and
initiates congestion control mechanisms such as TCP's slow start, congestion avoidance, and fast
retransmit/recovery. However, in wireless networks, packet loss can also occur due to reasons other than
congestion, such as channel errors. This can lead to unnecessary retransmissions, reducing TCP's
throughput and efficiency.
2. **Latency and Delay:**
- Wireless networks often have higher latency compared to wired networks due to factors like signal
propagation delay, protocol overhead, and contention for the shared wireless medium. TCP's performance
can be affected by latency, especially in applications sensitive to delay, such as real-time communication or
interactive applications. Long round-trip times (RTTs) can impact TCP's congestion control algorithms,
causing suboptimal throughput and inefficient resource utilization.
3. **Bandwidth Variability:**
- Wireless networks experience variability in available bandwidth due to factors like channel fading,
interference, and contention among multiple users sharing the same wireless medium. TCP's congestion
control algorithms are designed to adapt to changes in available bandwidth by dynamically adjusting the
sending rate based on network conditions. However, sudden fluctuations in bandwidth can trigger
aggressive congestion control responses, leading to underutilization of available capacity or unnecessary
reductions in throughput.
4. **Channel Errors and Link Quality:**
- Wireless channels are prone to errors due to noise, interference, and attenuation. TCP's reliability
mechanisms, such as checksums and selective retransmission, help detect and recover from errors.
However, frequent errors can degrade TCP's performance by triggering retransmissions, increasing latency,
and reducing throughput. In extreme cases, poor link quality may lead to link-layer retransmissions or link-
layer protocols (e.g., ARQ) discarding packets, impacting TCP's congestion control mechanisms.
5. **Wireless Mobility:**
- Mobile devices moving between different wireless access points or changing network conditions can
experience handoffs or roaming events. TCP connections may be disrupted or experience transient
congestion during handoffs, leading to packet loss, retransmissions, and degraded performance. Mobile
TCP enhancements, such as Mobile IP and Fast Handover, aim to mitigate the impact of mobility on TCP
performance in wireless networks.
Overall, while TCP can operate over wireless networks, its performance may be affected by the unique
characteristics and challenges of wireless communication. Various TCP enhancements, adaptations, and
optimizations have been proposed to improve TCP's performance in wireless environments, including
modifications to congestion control algorithms, error recovery mechanisms, and transport-layer protocols
tailored for wireless communication.
Q.12. Detect & correct the single error in the received Hamming code word 110011100110 with odd
parity.
To detect and correct errors in a received Hamming code word with odd parity, we first need to determine
the parity bit positions and then calculate the parity for each position to identify any errors. The received
code word is 110011100110.
1. Determine the number of parity bits required: In this case, the received code word has 12 bits, so we
need 4 parity bits (2^3 = 8 < 12 < 2^4 = 16).
2. Identify the positions of the parity bits (using 1-based indexing): P1, P2, P4, and P8.
3. Check the parity for each parity bit position:
- P1: (Position 1, 3, 5, 7, 9, 11) - Check if the total number of 1s is odd. (Should be odd)
- P2: (Position 2, 3, 6, 7, 10, 11) - Check if the total number of 1s is odd. (Should be even)
- P4: (Position 4, 5, 6, 7, 12) - Check if the total number of 1s is odd. (Should be odd)
- P8: (Position 8, 9, 10, 11, 12) - Check if the total number of 1s is odd. (Should be even)
Q.18. Write a TCP server socket program which accept which accept a request from client to capitalize
string and sending the response in the form of capitalized sentence back to the client. Here's a Python
example of a TCP server socket program that accepts a request from a client to capitalize a string and
sends the response in the form of a capitalized sentence back to the client:
python
import socket
# Define the server's IP address and port
SERVER_HOST = '127.0.0.1'
SERVER_PORT = 12345
# Create a TCP socket
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the address and port
server_socket.bind((SERVER_HOST, SERVER_PORT))
# Listen for incoming connections
server_socket.listen(1)
print(f"[*] Listening for incoming connections on {SERVER_HOST}:{SERVER_PORT}")
while True:
# Accept a client connection
client_socket, client_address = server_socket.accept()
print(f"[*] Accepted connection from {client_address[0]}:{client_address[1]}")
try:
# Receive data from the client
data = client_socket.recv(1024).decode().strip()
if data:
# Capitalize the received string
capitalized_string = data.upper()
# Send the capitalized string back to the client
client_socket.send(capitalized_string.encode())
print(f"[*] Sent capitalized string '{capitalized_string}' back to
{client_address[0]}:{client_address[1]}")
except Exception as e:
print(f"[!] Error: {e}")
finally:
# Close the client socket
client_socket.close()
To test the server, you can create a simple TCP client program that sends a string to the server and receives
the capitalized response. Here's a simple example of a TCP client in Python:
```python
import socket
# Define the server's IP address and port
SERVER_HOST = '127.0.0.1'
SERVER_PORT = 12345
# Create a TCP socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the server
client_socket.connect((SERVER_HOST, SERVER_PORT))
# Send a string to the server
string_to_capitalize = "hello, world!"
client_socket.send(string_to_capitalize.encode())
# Receive the capitalized string from the server
capitalized_string = client_socket.recv(1024).decode()
print(f"Received capitalized string from server: {capitalized_string}")
# Close the socket
client_socket.close()
Q.19. Explain RIP in detail. RIP (Routing Information Protocol) is a distance-vector routing protocol used
in computer networks to dynamically exchange routing information among routers. It is one of the oldest
and simplest routing protocols and is commonly used in small to medium-sized networks. Here's a
detailed explanation of RIP:
1. **Operation:**
- RIP routers exchange routing information periodically by broadcasting their routing tables to
neighboring routers. Each router advertises the routes it knows about to its neighbors.
- RIP routers use the Bellman-Ford algorithm to calculate the shortest path to each destination network
based on hop count (the number of routers a packet must pass through to reach the destination).
- RIP routers maintain a routing table that lists known destinations, next-hop routers, and associated
metrics (hop counts). They update their routing tables based on incoming routing updates from
neighboring routers.
2. **Distance Vector Algorithm:**
- RIP uses a distance vector algorithm, where each router maintains a vector of distances (hop counts) to
reachable destinations. Routers exchange these vectors with their neighbors, allowing each router to
update its routing table based on the received vectors.
- RIP routers periodically send routing updates (RIP messages) containing their entire routing table to
inform neighboring routers of their known routes. Neighboring routers compare the received routes with
their own and update their routing tables accordingly.
3. **Split Horizon and Poison Reverse:**
- RIP includes mechanisms such as split horizon and poison reverse to prevent routing loops and improve
convergence.
- Split horizon prevents a router from advertising routes back to the neighbor from which it learned them,
reducing the likelihood of routing loops.
- Poison reverse is an extension of split horizon where a router advertises unreachable routes back to the
neighbor with an infinite metric (infinity), signaling that the route is no longer valid.
4. **Metric:**
- RIP uses hop count as its metric for path selection. A hop count represents the number of routers (hops)
a packet must pass through to reach a destination network.
- RIP imposes a maximum hop count limit of 15, beyond which a route is considered unreachable
(infinity). This limitation makes RIP unsuitable for large networks with more than 15 hops between routers.
5. **Versions:**
- There are two versions of RIP: RIP version 1 (RIPv1) and RIP version 2 (RIPv2). RIPv1 is the original
version and has limited capabilities, such as support for classful routing and absence of support for subnet
information. RIPv2 is an enhanced version that supports classless routing, Variable Length Subnet Masking
(VLSM), and authentication.
6. **Convergence and Stability:**
- RIP routers converge relatively quickly in small to medium-sized networks, thanks to their frequent
routing updates and simple algorithm.
- However, RIP may suffer from slow convergence and instability in larger networks or networks with high
link or router failure rates, as frequent routing updates and limited metric information can lead to routing
loops and suboptimal paths.
Q.20. Write client & Server programs for establishing and termination of connection between client and
server using TCP.
Sure, here's an example of a TCP client-server pair written in Python that establishes a connection,
exchanges a simple message, and then terminates the connection:
**Server (server.py):**
```python
import socket
# Define the server's IP address and port
SERVER_HOST = '127.0.0.1'
SERVER_PORT = 12345
# Create a TCP socket
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the address and port
server_socket.bind((SERVER_HOST, SERVER_PORT))
# Listen for incoming connections
server_socket.listen(1)
print(f"[*] Listening for incoming connections on {SERVER_HOST}:{SERVER_PORT}")
# Accept a client connection
client_socket, client_address = server_socket.accept()
print(f"[*] Accepted connection from {client_address[0]}:{client_address[1]}")
try:
# Receive data from the client
data = client_socket.recv(1024).decode().strip()
print(f"[*] Received message from client: {data}")
# Send a response to the client
response = "Hello from the server!"
client_socket.send(response.encode())
print("[*] Sent response to client")
finally:
# Close the client socket
client_socket.close()
# Close the server socket
server_socket.close(
**Client (client.py):**
```python
import socket
# Define the server's IP address and port
SERVER_HOST = '127.0.0.1'
SERVER_PORT = 12345
# Create a TCP socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to the server
client_socket.connect((SERVER_HOST, SERVER_PORT))
print(f"[*] Connected to server at {SERVER_HOST}:{SERVER_PORT}")
# Send a message to the server
message = "Hello from the client!"
client_socket.send(message.encode())
print("[*] Sent message to server")
# Receive a response from the server
response = client_socket.recv(1024).decode().strip()
print(f"[*] Received response from server: {response}")
finally:
# Close the client socket
client_socket.close()
To use these programs, run the server script first (`python server.py`), then run the client script (`python
client.py`). You should see output indicating the establishment of the connection, the message exchange,
and the termination of the connection.
Q.21. Encode a binary word 11001 into the even parity hamming code.
[Given number of data bits, n=5]
To encode the binary word "11001" into an even parity Hamming code with 5 data bits, we need to follow
these steps:
1. Determine the number of parity bits required. Since we have 5 data bits, we need to calculate the
number of parity bits required to make a total of 5 + p bits, where p is the number of parity bits.
2. Determine the positions of the parity bits. Parity bits are typically placed at positions that are powers
of 2 (1, 2, 4, 8, 16, etc.).
3. Calculate the values for the parity bits based on the data bits.
1. Insert the data bits into the code word, leaving spaces for the parity bits:
__1_1001_0001
2. Determine the positions of the parity bits (1-based indexing): P1, P2, P4.
3. Calculate the values for the parity bits:
• P1: Check the data bits in positions where the least significant bit is 1. (Positions 1, 3, 5, 7, 9,
11) P1 = (1 + 1 + 0 + 1) mod 2 = 1 (odd parity)
• P2: Check the data bits in positions where the second least significant bit is 1. (Positions 2, 3,
6, 7, 10, 11) P2 = (1 + 1 + 0 + 1) mod 2 = 1 (odd parity)
•
P4: Check the data bits in positions where the third least significant bit is 1. (Positions 4, 5, 6,
7, 12) P4 = (1 + 0 + 0 + 1) mod 2 = 0 (even parity)
4. Insert the calculated parity bits into their respective positions:
111110010001
So, the even parity Hamming code for the binary word "11001" with 5 data bits is 111110010001.
Q.22. The received code word is 1100100101011, check if there is error in the code word if
divisor is 10101.
To check if there is an error in the received code word "1100100101011" using a divisor "10101",
we can perform polynomial division (binary division) using the received code word and the divisor.
If the remainder after the division is zero, then there is no error. Otherwise, there is an error.
------------------
10101 | 1100100101011
-10101
--------
01000101011
-10101
-------
010010110
-10101
------
01011101
-10101
------
001001
-10101
-----
1101
-10101
-----
1011
-10101
-----
1001
-10101
-----
110 (Remainder)
The remainder is not zero, there is an error in the received code word when divided by the divisor "10101".
Q.23. A receiver received the hamming code 11001010101 with even parity. Find the error in
received code.
To find the error in the received Hamming code "11001010101" with even parity, we'll follow these
steps:
1. Determine the number of parity bits and their positions in the received code.
2. Calculate the parity for each position and check if it matches the received parity.
3. If there's a discrepancy, locate the error by considering the position of the faulty parity bit.
4. The received Hamming code has 11 bits, so it requires 4 parity bits: P1, P2, P4, and P8.
5. Calculate the parity for each position:
1. P1: (Position 1, 3, 5, 7, 9, 11) - Check if the total number of 1s is even. (Should be
even)
2. P2: (Position 2, 3, 6, 7, 10, 11) - Check if the total number of 1s is even. (Should be
even)
3. P4: (Position 4, 5, 6, 7, 12) - Check if the total number of 1s is even. (Should be even)
4. P8: (Position 8, 9, 10, 11, 12) - Check if the total number of 1s is even. (Should be
odd)
The incorrect parity bits are P1 and P8. To locate the error, we convert the positions of the
incorrect parity bits to decimal:
• P1 is at position 1.
• P8 is at position 8.
The error bit is at the position corresponding to the sum of the positions of the incorrect parity
bits. So, the error bit position is 1 + 8 = 9.
Now, we flip the value of the bit at position 9 to correct the error.
To generate the Hamming code for the data "111011011" with odd parity, we need to follow these
steps:
So, the Hamming code for the data "111011011" with odd parity is "111111011011".
Q.25. Determine the network address for the following IP-addresses
To determine the network address for the given IP addresses, we need to perform a bitwise AND
operation between each IP address and its corresponding subnet mask. The network address
represents the common bits between the IP address and the subnet mask.
Assuming that we're using default subnet masks for the IP addresses provided, we'll consider the following:
1. IP Address: 87.52.26.71 Subnet Mask: 255.0.0.0 (Class A default subnet mask) Network Address:
87.0.0.0
2. IP Address: 77.12.133.86 Subnet Mask: 255.0.0.0 (Class A default subnet mask) Network Address:
77.0.0.0
3. IP Address: 193.56.77.22 Subnet Mask: 255.0.0.0 (Class A default subnet mask) Network Address:
193.0.0.0
4. IP Address: 128.76.44.37 Subnet Mask: 255.0.0.0 (Class A default subnet mask) Network Address:
128.0.0.0
5. IP Address: 100.77.44.13 Subnet Mask: 255.0.0.0 (Class A default subnet mask) Network Address:
100.0.0.0
IP addressing, along with network masks and network addresses, are fundamental concepts in
computer networking.
1. IP Address: An IP (Internet Protocol) address is a unique numerical label assigned to each
device connected to a computer network that uses the Internet Protocol for
communication. IP addresses are used for identifying and locating devices on a network.
They are typically written in dotted-decimal notation, such as 192.168.1.1.
2. Network Mask (Subnet Mask): A network mask, or subnet mask, is a 32-bit number used
to divide an IP address into two parts: the network address and the host address. It
determines which portion of the IP address is used to identify the network and which
portion is used to identify the specific host on that network. Network masks consist of a
series of contiguous 1 bits followed by a series of contiguous 0 bits.
For example, in the subnet mask 255.255.255.0, the first 24 bits (8 bits for each of the first
three octets) are set to 1, indicating the network portion, while the last 8 bits are set to 0,
indicating the host portion.
3. Network Address: The network address is the portion of the IP address obtained by
applying the network mask. It identifies the specific network to which a device belongs. The
network address is obtained by performing a bitwise AND operation between the IP address
and the network mask.
For example, if we have an IP address of 192.168.1.100 and a subnet mask of 255.255.255.0,
applying the bitwise AND operation gives us the network address of 192.168.1.0, indicating
that the device belongs to the network 192.168.1.0.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source IP Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination IP Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data (Payload) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1. Version (4 bits): Specifies the version of the Internet Protocol. For IPv4, this field is set to 4.
2. Internet Header Length (IHL) (4 bits): Specifies the length of the IP header in 32-bit
words. This is necessary because the header length can vary due to the presence of optional
fields like options.
3. Type of Service (8 bits): Provides information about the quality of service requested for
the packet, such as prioritization and handling instructions.
4. Total Length (16 bits): Indicates the total length of the IP packet in bytes, including both
the header and the data.
5. Identification (16 bits): Used for uniquely identifying fragments of an original IP datagram.
6. Flags (3 bits): Used for controlling and identifying fragments. The three flags are:
• Reserved (bit 0): Must be set to 0.
• Don't Fragment (bit 1): If set to 1, indicates that the packet should not be
fragmented.
• More Fragments (bit 2): If set to 1, indicates that more fragments follow.
7. Fragment Offset (13 bits): Indicates the offset of the current fragment relative to the
beginning of the original IP datagram.
8. Time to Live (TTL) (8 bits): Specifies the maximum number of hops (routers) that the
packet can traverse before being discarded.
9. Protocol (8 bits): Specifies the protocol used in the data portion of the packet, such as TCP,
UDP, ICMP, etc.
10. Header Checksum (16 bits): Used for error-checking the header. It ensures the integrity of
the header during transmission.
11. Source IP Address (32 bits): Specifies the IP address of the sender.
12. Destination IP Address (32 bits): Specifies the IP address of the intended recipient.
13. Options (variable): Optional field used for various purposes, such as timestamping,
security, or debugging. This field may or may not be present.
14. Data (Payload): Contains the actual data being transmitted, such as segments of a TCP
stream or an ICMP message.
Q.28. Determine the network subnetwork & host addresses if IP address is 27.54.19.33 and
subnet mask is 255.255.224.0.
To determine the network, subnetwork, and host addresses, we need to perform a bitwise AND
operation between the given IP address and the subnet mask.
Given IP address: 27.54.19.33 Subnet mask: 255.255.224.0
IP address (27.54.19.33):
00011011.00110110.00010011.00100001
11111111.11111111.11100000.00000000
IP address: 00011011.00110110.00010011.00100001
Subnet mask: & 11111111.11111111.11100000.00000000
-----------------------------------
Network part: 00011011.00110110.00000000.00000000
To find the subnetwork and host addresses, we'll need to determine the number of bits used for
the subnetwork and host portions based on the subnet mask. In this case, the subnet mask
255.255.224.0 leaves 11 bits for host addresses.
The remaining 11 bits for host addresses allow for 211−2211−2 host addresses per subnetwork
(subtracting 2 for the network address and the broadcast address). So, each subnetwork will have
211−2=2046211−2=2046 host addresses.
Thus, the subnetwork address and host address within that subnetwork for the given IP address
are:
calculate the network addresses for each IP address using these assumptions:
1. IP address: 87.52.26.71
Subnet mask: 255.0.0.0 (Class A)Performing the bitwise AND operation:
IP address: 01010111.00110100.00011010.01000111
-----------------------------------
-----------------------------------
-----------------------------------
IP address: 10000000.01001100.00101100.00100101
-----------------------------------
-----------------------------------
1. Establishing a Connection:
• TCP uses a three-way handshake to establish a connection between a client and a
server.
• The client sends a SYN (synchronize) packet to the server to initiate the connection.
• The server responds with a SYN-ACK (synchronize-acknowledgment) packet,
indicating that it has received the SYN packet and is willing to establish a connection.
• Finally, the client acknowledges the SYN-ACK packet with an ACK (acknowledgment)
packet, indicating that the connection has been successfully established.
2. Reliable Data Transfer:
• TCP ensures reliable data transfer by using sequence numbers, acknowledgment
numbers, and checksums.
• Each segment of data sent over TCP is assigned a sequence number by the sender.
• The receiver acknowledges the receipt of data segments by sending
acknowledgment packets back to the sender.
• If the sender does not receive an acknowledgment for a segment within a certain
timeout period, it retransmits the segment.
• TCP also implements flow control to prevent overwhelming the receiver with data.
The receiver advertises a window size indicating how much data it can accept, and
the sender adjusts its transmission rate accordingly.
3. Ordered Delivery:
• TCP guarantees that data sent by the sender will be delivered to the receiver in the
same order it was sent.
• Each segment of data includes a sequence number, allowing the receiver to
reassemble the data in the correct order.
4. Connection Termination:
• When the data transfer is complete, TCP tears down the connection using a four-way
handshake.
• The client sends a FIN (finish) packet to the server, indicating that it has finished
sending data.
• The server acknowledges the FIN packet with an ACK packet.
• The server then sends its own FIN packet to the client.
• Finally, the client acknowledges the server's FIN packet, and the connection is
terminated.
5. Error Detection and Correction:
• TCP uses checksums to detect errors in transmitted data.
• The sender calculates a checksum for each segment of data and includes it in the
TCP header.
• The receiver recalculates the checksum upon receipt and compares it to the
checksum in the header. If they don't match, the segment is discarded and the
sender is notified.
Q.31. Explain DNS & DNS - resource records in detail.
DNS Resource Records:
DNS uses resource records (RRs) to store information about domain names. Each resource record contains
specific data associated with a domain name. Some common types of resource records include:
These are just a few examples of DNS resource records. DNS is a critical component of Internet
infrastructure, facilitating the translation of human-readable domain names into machine-readable IP
addresses and enabling the seamless navigation of the Internet.
Q.32. What is open shortest path first protocal? Explain in detail.
OSPF Operation:
1. Neighbor Discovery:
• OSPF routers discover neighboring routers by sending Hello packets.
• Routers become neighbors if they agree on parameters such as area ID, network
type, and authentication.
2. Exchange of Link-State Advertisements (LSAs):
• Upon forming adjacencies, OSPF routers exchange LSAs to build their link-state
databases.
• LSAs contain information about local router interfaces, neighboring routers, and
network topology.
3. Link-State Database Synchronization:
• OSPF routers synchronize their link-state databases by flooding LSAs to all routers
within the same area.
• This ensures that all routers have an identical view of the network topology.
4. Shortest Path Calculation:
• After building the link-state database, each router runs Dijkstra's algorithm to
calculate the shortest path to each destination.
• The shortest path is determined based on the cost associated with each link, where
cost is inversely proportional to link bandwidth.
5. Routing Table Update:
• OSPF routers update their routing tables based on the calculated shortest paths.
• The routing table contains entries specifying the next-hop router for each destination
network.
6. Route Convergence:
• OSPF routers continuously monitor the network for changes in topology.
• Upon detecting a change, routers recalculate routes and update their routing tables
accordingly to ensure route convergence.
Q.33. Explain the functioning of SMTP protocol.
The Simple Mail Transfer Protocol (SMTP) is a communication protocol used to transmit electronic mail
(email) messages across the Internet. SMTP is a fundamental protocol in the email delivery process,
responsible for sending outgoing email messages from a sender's mail server to the recipient's mail server.
how SMTP works:
SMTP Operation:
Security attacks refer to deliberate actions or attempts to compromise the confidentiality, integrity,
availability, or authenticity of information or information systems. These attacks can target various
components of a system, including networks, devices, software, and users. Security attacks are typically
classified into two main categories: passive attacks and active attacks. Let's focus on explaining passive
attacks in detail:
Passive Attacks:
1. Eavesdropping (Sniffing):
• Eavesdropping involves the interception and monitoring of network communications
between parties.
• Attackers use network sniffers or packet analyzers to capture data packets
transmitted over a network.
• By analyzing captured packets, attackers can extract sensitive information such as
usernames, passwords, credit card numbers, or other confidential data.
2. Traffic Analysis:
• Traffic analysis involves the examination and analysis of network traffic patterns to
infer sensitive information.
• Attackers analyze the frequency, timing, size, and destination of network packets to
deduce patterns and relationships.
• For example, an attacker might monitor the timing and volume of data exchanged
between two parties to infer the nature of their communication (e.g., financial
transactions, email correspondence).
3. Reconnaissance (Information Gathering):
• Reconnaissance involves passive information gathering about a target system or
network.
• Attackers collect publicly available information, such as domain names, IP addresses,
system configurations, or employee names, to identify potential vulnerabilities and
attack vectors.
• Reconnaissance techniques include passive DNS enumeration, WHOIS queries, social
engineering, and dumpster diving.
Q.35. WAP for establishing termination of connection between clinet & server using TCP.
simple Python script demonstrating how to establish and terminate a TCP connection between a client and
server:
import socket
def main():
# Server configuration
server_socket.bind((server_host, server_port))
server_socket.listen(5)
data = client_socket.recv(1024)
client_socket.sendall(response.encode())
client_socket.close()
server_socket.close()
if __name__ == "__main__":
main()
This script creates a simple TCP server that listens for incoming connections on a specified host and port.
When a client connects to the server, the server receives data from the client, sends a response, and then
terminates the connection. Finally, it closes the server socket.
To test this script, you can create a corresponding TCP client script that establishes a connection to
the server, sends some data, receives a response, and then terminates the connection.
1. Physical Layer:
• The physical layer deals with the transmission of raw data bits over a physical medium, such
as cables or wireless signals.
• It defines the electrical, mechanical, and procedural characteristics for transmitting data.
• Example devices and protocols: Ethernet cables, fiber optics, Wi-Fi standards, hubs,
repeaters.
• The data link layer provides error detection and correction mechanisms to ensure reliable
data transmission between directly connected nodes.
• It organizes raw bits into frames and adds addressing information (MAC addresses) to
enable communication between devices on the same network.
• Example devices and protocols: Ethernet switches, MAC addresses, IEEE 802.3 (Ethernet),
IEEE 802.11 (Wi-Fi).
3. Network Layer:
• The network layer is responsible for routing and forwarding data packets between different
networks.
• It uses logical addresses (IP addresses) to identify devices and determine the best path for
data transmission.
• Example devices and protocols: Routers, IP addresses, IPv4, IPv6, ICMP (Internet Control
Message Protocol).
4. Transport Layer:
• The transport layer ensures reliable end-to-end communication between hosts by providing
error detection, flow control, and data segmentation.
• It establishes connections (TCP) or sends data without establishing connections (UDP)
between applications.
• Example protocols: Transmission Control Protocol (TCP), User Datagram Protocol (UDP).
5. Session Layer:
• The session layer establishes, maintains, and synchronizes communication sessions between
applications.
• It handles session management, including session establishment, maintenance, and
termination.
• Example functions: Authentication, authorization, session checkpointing.
6. Presentation Layer:
7. Application Layer:
• The application layer provides network services directly to end-users and applications.
• It facilitates communication between software applications and network services, such as
email, web browsing, file transfer, and remote access.
• Example protocols: HTTP, FTP, SMTP, DNS, DHCP.
Q.37. Write a program for implementing the sliding window protocol of window size 5.
def sender(data):
window_size = 5
base = 0
next_seq_num = 0
next_seq_num += 1
ack = input("Enter acknowledgment (0 for none, 1 for positive, 2 for negative): ")
if ack == '1':
base += 1
base = 0
next_seq_num = 0
else:
def receiver(data):
window_size = 5
expected_seq_num = 0
expected_seq_num += 1
if expected_seq_num == len(data):
break
print("\nSending acknowledgment...")
ack = input("Enter acknowledgment (0 for none, 1 for positive, 2 for negative): ")
if ack == '2':
expected_seq_num = 0
else:
def main():
data = ["Frame 1", "Frame 2", "Frame 3", "Frame 4", "Frame 5", "Frame 6", "Frame 7", "Frame 8", "Frame 9",
"Frame 10"]
print("Sender:")
sender(data)
print("\nReceiver:")
receiver(data)
if __name__ == "__main__":
main()
This program simulates a simple sender and receiver implementing the sliding window protocol with a
window size of 5. The sender sends frames sequentially, while the receiver acknowledges the frames and
requests retransmission if necessary.