Mobiprep has created last-minute notes for all topics of Computer networks to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on Computer networks.
Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Brief the functions of network layer.
Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.
difference between logical addressing and physical addressing.
what are the different methods used to convert ipv4 to ipv6.
what are the protocols used to map logical address to physical address.
what are the protocols used to map physical address to logical address.
what is message forwarding? Explain the message forwarding techniques.
difference between distance vector routing and link state routing.
explain border gateway protocol (bgp) in detail along with its working.
what is the difference between packet switching and circuit switching?
what are the difference between static and dynamic ip addressing?
Network Layer
Question 1) Brief the functions of network layer.
Answer) The network layer is responsible for the delivery of data packets from source to destination. It ensures that the data packet is received by the receiver. The other responsibilities of the network layer are:
1. Logical addressing
The network layer assigns an address to the network device. It is also known as IP address. This address is used to uniquely identify a device within a network.
2. Routing
The network layer is responsible for routing the data packets from source to destination. Routing involves selecting the correct path for the data packets to reach the destination.
3. Fragmentation
Fragmentation is the process of dividing the data packets into multiple blocks called fragments. This is done when the size of the datagram is greater than the MTU (Maximum Transmission Unit).
Question 2) Explain logical addressing and its types.
Answer) The logical address is also called the IP address. It is the address assigned by the network layer to a device so that it can be uniquely identified within a network. No two devices in a network can have the same IP address. The IP address has two parts: Host ID and Network ID. The network ID is used to identify the network to which the device belongs. The Host ID is used to uniquely identify the device in a network.
The logical addressing is of two types:
a. Classful addressing
In classful addressing, the total address space is divided into many classes. Each class
consists of different number of bits allocated for network ID and host ID.
The IPv4 address is divided into 5 classes. They are:
Class A
It is used for very large organizations.
Here, 8 bits are used to represent network ID, and 24 bits are used to represent host ID.
2. Class B
It is for mid-size organizations.
Here, 16 bits are used to represent network ID, and 16 bits are used to represent host ID.
3. Class C
It is designed for small organizations with small number of hosts and routers.
Here, 24 bits are used to represent network ID, and 8 bits are used to represent host ID.
4. Class D
It is assigned for multicasting. i.e. Each address here is used to define one group of hosts on the internet.
5. Class E
The addresses in class E of IPv4 addressing are reserved for future use.

b. Classless addressing
In classless addressing, the address space is not divided into classes. There are no restrictions on host ID and network ID. Hence, this method is more practical and useful than classful addressing.
Question 3) Difference between logical addressing and physical addressing.
Answer)
Logical addressing | Physical addressing |
The logical address is assigned by the Internet Service Provider (ISP) | The physical address is assigned by the device manufacturer. |
It is also known as IP address | It is also known as MAC address |
The IP address of a device changes depending on the network to which it belongs. | The physical address of a device cannot be changed. It is assigned during the device manufacturing. |
The logical address is used by the network layer. | The physical address is used by the datalink layer. |
The logical address is represented in decimal form. | It is represented in hexadecimal form. |
The logical address consists of 32 bits or 128 bits.The physical address consists of 48 bits. | The physical address consists of 48 bits. |
The logical address is divided into 4 parts (each of one byte length) | The physical address is divided into 6 parts (each of one byte length) |
Example: 192.168.1.1 | Example: 42:87:FF:AE:00:11 |
Question 4) Difference between ipv4 and ipv6.
Answer)
IPv4 | IPv6 |
The IPv4 address is a 32 bit address | The IPv6 address is a 128 bit address |
Address space is small | Address space is large. |
The address space can accommodate 232 devices. | The address space can accommodate 2128 devices. |
Includes unicast, multicast and broadcast addresses. | Includes unicast, multicast and anycast addresses. Does not include broadcast address. |
It is represented in dotted decimal notation. | It is represented in hexadecimal notation separated by colons. |
Packet flow identification is not available in IPv4 | Packet flow identification is available in IPv6 using the flow label in IPv6 header |
IPv4 header contains options field and checksum field | IPv6 header does not contain options field and checksum field. |
Example: 192.168.1.2 | Example: ABCD:EF12:1243:0000:1786:FFFF:EFE1 |
Question 5) Explain the fields in the ipv4 header with diagram.
Answer) The IPv4 header is 20 to 60 bytes long. It should have a minimum length of 20 bytes. The structure of the IPv4 header is shown in the diagram given below:

IPv4 HEADER FIELD
1. VER (Version)
It is a 4-bit field.
It defines the version of IP protocol (IPv4 or IPv6).
2. HLEN (Header Length)
It is a 4-bit field.
It defines the length of the datagram header in 4 byte words.
If length of the header is 20 bytes, the value in this field will be 5 (5 x 4 = 20).
3. SERVICE
It is 8 bit field.
The first 3 bits are called Precedence Bits. The Precedence bits define the priority of the datagram when congestion occurs.
The next 4 bits define the TOS (Type of Service)
Only 1 of the 4 bits is set at a time to define the Type of Service.
Different programs request different types of service.

The last bit is not used.
4. TOTAL LENGTH
This field defines total length of the datagram including header in bytes.Length of data = total length – header length
5. IDENTIFICATION
It is a 16-bit field.
It helps to identify the fragments which belong to the same datagram. The identification field is the same for all the fragments of the same datagram. It helps in reassembly of the fragments at the receiver.
6. FLAGS
It is a 3-bit field.
The first bit is reserved.
The second bit is called Do Not Fragment (DF). If DF=1, the datagram should not be fragmented. If DF=0, the datagram is fragmented.
The third bit is called More Fragment (MF). If MF=1, it means that the current datagram is not the last fragment. If MF=0, the current datagram is the last or only fragment.
7. FRAGMENTATION OFFSET
It is a 13-bit field.
This field defines the relative position of the fragment with respect to the whole datagram.
8. TIME TO LIVE
It is an 8 bit field.
This field is used to control the maximum number of hops (routers) visited by the datagram. When the source sends the datagram, it sets a value in this filed. Each router processes the datagram and decrements this number by 1. This limits the lifetime of a datagram.
If this field is not present, the datagram may travel between two or more routers for a long time without getting delivered
9. PROTOCOL
It is an 8-bit field.
It specifies the final destination protocol to which this datagram is delivered (Higher level protocols such as TCP, ICMP, UDP, IGMP).

10. HEADER
It is a 16-bit field.
This field is used to detect errors in the header.
11. SOURCE ADDRESS
It is a 32-bit field.
It defines the IPv4 address of the source.
12. DESTINATION ADDRESS
It is a 32-bit field.
It defines the IPv4 address of the destination.
13. OPTIONS
The Options field can have a maximum of 40 bytes. It is optional.
Question 6) Explain the fields in ipv6 header with diagram.
Answer) The structure of the IPv6 header is given below:

HEADER FIELDS
1. Version
It is a 4-bit field
It defines the version of the IP protocol. (IPv4 or IPv6)
2. Priority
It is a 4-bit field.
It defines the priority of the datagram with respect to traffic congestion.
3. Flow label
It is a 3 byte (24-bit) field.
Flow is a sequence of packets that share the same characteristics (same path, same resources.
Flow label is used to speed up the processing of a packet by a router. The flow table contains the address of the next hop.
The flow label is used for transmission of real time audio and video.
4. Payload length
It is a 2-byte field.
It defines the length of datagram excluding the header.
5. Next header
It is an 8-bit field.
This field contains the address of the next datagram header.
6. Hop limit
It is an 8-bit field.
This field is used to control the maximum number of hops (routers) visited by the datagram. When the source sends the datagram, it sets a value in this filed. Each router processes the datagram and decrements this number by 1. This limits the lifetime of a datagram.
7. Source address
16-bytes
It contains the IP address of the source.
8. Destination address
16-bytes
It contains the IP address of the destination.
Question 7) What are the different methods used to convert ipv4 to ipv6.
Answer) The different methods used to convert IPv4 address to IPv6 address are:
DUAL STACK
A Dual stack network can be installed with IPv4 and IPv6 addresses configured to its interfaces pointing to the network of relevant IP scheme. The Dual stack router can communicate with both IPv4 and IPv6 networks. It enables the hosts with IPv4 or IPv6 address to communicate with the server without changing their IP address.

2. TUNNELING
This method is used when the two computers using IPv6 want to communication with each other and the packet must pass through a region that uses IPv4. Here, the IPv6 packet is encapsulated in a IPv4 packet when it enters the IPv4 region (or tunnel).

3. HEADER TRANSLATION
This method is used when the source uses IPv6 and the destination uses IPv4 or vice versa. Here, the IPv6 header is translated into IPv4 header or vice versa.

Question 8) Explain network address translation and its types.
Answer) Network address translation enables the user to have a large set of addresses internally and one, or a small set of addresses externally.
The private addresses need not be unique in the internet. Because the private addresses are visible only inside the organization. The NAT router translates the private address into the global NAT address. All outgoing packets go through the NAT router, which replaces the source address in the packet with the global NAT address. All incoming packets pass through the NAT router, which replaces the destination address with the appropriate private address, obtained from the NAT translation table.
NAT table contains only two columns:
the private address
the external address (destination address of the packet)

TYPES OF NAT
STATIC NAT
In static NAT, one private address is mapped to one Public IP address and this address does not change. It is expensive. IP addresses are wasted in this method.
DYNAMIC NAT
In dynamic NAT, mapping of Private IP address to Public IP address is dynamic. The router maps the Private IP to one of the available IP address from the pool of Public IP addresses. This method is very expensive. But, the IP addresses are not wasted.
PAT (Port Address Translation)
In this method, the port numbers are used to map traffic from specific hosts on the network. Here, each private address is mapped to a public IP address and attached to some unique port number. Using this method, many internal hosts can be handled with a single public IP address.

PORT FORWARDING
It allows network administrators to use one IP address for all external communications on the Internet while dedicating multiple servers with different IPs and ports to the task internally. Port forwarding technique is explained using the diagram given below:

Question 9) What is meant by fragmentation? Why is it needed?
Answer) Fragmentation is the process of dividing the data packets into multiple blocks called fragments. This is done when the size of the datagram is greater than the MTU (Maximum Transmission Unit).
The limit in the size of datagrams that can be processed by a network is called Maximum Transmission Unit (MTU). A datagram larger than the MTU cannot be transmitted directly through the network. The datagram has to be broken down into small fragments, so that the size of the datagram becomes smaller than the MTU. The transmitted data fragments are reassembled at the receiver.
Question 10) What are the protocols used to map logical address to physical address.
Answer) The following protocols are used to map the logical address to physical address:
a. ARP
When the source needs to send a packet to destination and it knows its IP address, it looks into its ARP cache for the destination’s MAC address. If the receiver IP is not mapped to any MAC address, the sender broadcasts a message asking the MAC address of the computer that has the specific IP address. The destination replies to this message with its MAC address. Once the sender receives the destination MAC, it stores it in the ARP cache.
The ARP cache is a table that stores the IP to MAC address associations.
ARP MESSAGES
1. ARP REQUEST
The ARP request is broadcast in nature, but the ARP reply is unicast.
The MAC address of the device is kept null because the source has requested for it.
2. ARP REPLY
The target machine (or destination) replies to the ARP Request. The reply is unicasted to the sender. The ARP reply contains the receiver’s MAC address.
b. PROXY ARP
This method is used to create sub-netting effect to ARP. Proxy ARP acts on behalf of a set of hosts. When running a proxy ARP, if an ARP request is received for the IP address of one of its hosts, it sends its own MAC address instead of the host’s address. After it receives the actual IP packet, it sends the packet to an appropriate host or router.
Question 11) What are the protocols used to map physical address to logical address.
Answer) The following protocols are used to map physical address to logical address:
a. RARP (Reverse Address Resolution Protocol)
RARP is a datalink layer protocol. Two messages are used in the RARP protocol. They are RARP request and RARP reply.
RARP request
The RARP request is broadcasted in the network by the RARP client (the system which needs its own IP)
RARP reply
RARP server replies with the corresponding IP address. The server has all the physical addresses mapped to the IP address in table form.
Broadcasting of RARP is done at data link layer. This increases the implementation cost. RARP provides only the IP address, but not subnet mask, default gateway etc.
b. BOOTP
The BOOTP protocol is the successor of RARP protocol and predecessor of DHCP protocol.
BOOTP is similar to RARP, but the Server can be in another network. It is a client server model. BOOTP uses a static database to store the mapping of MAC address to IP address, while DHCP uses a dynamic database. The entries in the database must be entered manually.
BOOTP request is broadcasted in the network. As the BOOTP request cannot be broadcasted into another network, there is a device called relay agent which knows the IP address of the server. It unicasts the BOOTP request to the server.
c. DHCP (Dynamic Host Configuration Protocol)
In DHCP, the database which contains the mapping of MAC address to the corresponding IP address is dynamic. DHCP maintains a pool of IP addresses.
When the DHCP server receives a DHCP request, assigns one of the IP addresses from the pool for a period of time unless some reservations are made. The entry is added in the dynamic database. The DHCP server first checks in its static database if the requested physical address exists in the permanent database. If the physical address does not exist in the database, it assigns an IP address dynamically.
Question 12) What is ARP? What are ARP messages?
Answer) ARP – Address Resolution Protocol
ARP is a protocol which is used to map the IP address to the corresponding MAC address. The working of the ARP protocol is given below.
When the source needs to send a packet to destination and it knows its IP address, it looks into its ARP cache for the destination’s MAC address. If the receiver IP is not mapped to any MAC address, the sender broadcasts a message asking the MAC address of the computer that has the specific IP address. The destination replies to this message with its MAC address. Once the sender receives the destination MAC, it stores it in the ARP cache.
The ARP cache is a table that stores the IP address to MAC address associations.
ARP MESSAGES
a. ARP REQUEST
It consists of the sender’s physical address and IP address and the receiver’s IP address. The receiver’s MAC address field is filled with 0’s.
Destination address of the packet is broadcast address.
b. ARP REPLY
The target machine (or destination) replies to the ARP Request. The reply is unicasted to the sender. The ARP reply contains the receiver’s MAC address.
Question 13) What is ICMP? Explain its usage
Answer) ICMP is a transport layer protocol that is used along with the TCP/IP protocol. ICMP is considered as an integral part of the TCP/IP protocol suite. ICMP provides error reporting mechanism to the IP protocol. It only reports errors, but it does not correct them. The ICMP data packet consists of an 8 byte header and a variable size data section. ICMP reports the information on network connectivity, and the speed of data relay between the source and the destination.
The ICMP protocol provides the following services:
Error Reporting
Congestion Reporting
First-hop router Redirection
Question 14) What are the ICMP messages?
Answer) The ICMP messages are of two types. They are:
Error reporting messages
Query messages
ERRORS MESSAGES
Destination unreachable
This error is generated when the router can’t route the datagram or when the host can’t deliver the datagram.
Source quench
This message is used to add flow control to IP protocol. It is generated when a router discards the datagram due to congestion. The Source Quench message indicates that the source should slow down the sending process.
Time exceeded
This error message is generated when datagram is discarded due to expiration of time to live.
Parameter problems
This error is generated when there is ambiguity or missing value in any field in the datagram.
Redirection
The redirection message is sent to the host to update its routing table whenever there is change in the network.
QUERY MESSAGES
The query messages are used to diagnose some problems in the network.
Echo request and reply
The echo request and echo reply are used to check whether the two systems (sender and receiver) can communicate with each other.
Timestamp request and reply