edited by
3,360 views
1 votes
1 votes

I was studying how the packet is transmitted from source to destination, what i understood is, we need IP address to identify the network in which our destination is present, while MAC address (data link layer address) is used for hop to hop communication. On reaching the destinations network we again find the MAC address of the destination (using ARP), and finally deliver the packet.

I have 3 questions:-

Question 1) We use IP address to get the MAC address of the destination or the next hop, i.e. we use ARP(address resolution protocol) to discover MAC address, so why don't we directly use IP address instead of using MAC address, for the delivery of the packet. Our data link layer can use IP address itself for hop to hop communication, and after reaching the network we can directly deliver the packet to the host, so we will not require to find MAC address using ARP at each intermediate delivery of the packet. 

Does we use MAC because it is a physical address embedded in the NIC and therefore we can use hardware circuit to identify whether the packet is delivered for us or not, as hardware are faster than the software, but what about address resolution overhead?

Question 2) Suppose someone sent a packet to me, therefore packet is sent to my IP address, but before i can receive the packet, i have switched my network(say i was using some WIFI and i switched to my mobile network) therefore leading to changing my network id, While as the WIFI has the heavy traffic, the IP address which was assigned to me is therefore now assigned to someone else, will it lead to delivery of message meant for me to someone else, what happens in these situation?  

Question 3) I have read that in modern operating system MAC address can be changed (https://www.thewindowsclub.com/change-mac-address-in-windows). How is it possible if MAC address is present in the NIC?

edited by

3 Answers

Best answer
4 votes
4 votes

Question 2) Suppose someone sent a packet to me, therefore packet is sent to my IP address, but before i can receive the packet, i have switched my network(say i was using some WIFI and i switched to my mobile network) therefore leading to changing my network id, While as the WIFI has the heavy traffic, the IP address which was assigned to me is therefore now assigned to someone else, will it lead to delivery of message meant for me to someone else, what happens in these situation? 

No, it will not be delivered to the new host.

EXPLANATION

Every router has a DHCP Server enabled in it. Even if you disconnect from the WiFi, the IP Address is not taken back immediately by the DHCP Server. The IP is still assigned to your MAC Address of say Laptop or Mobile Phone, whatever device it is. So, this IP CANNOT BE ASSIGNED IMMEDIATELY TO ANOTHER HOST. THERE HAS TO BE EXPIRY OF THE "LEASE TIME". Now even though you have disconnected from Wifi, you still occupy the same IP until the lease expiry. Now as you have disconnected from the network, the host device becomes unreachable as a result, even if any packet sent for your host comes then it is discarded by the switch/router present in the network as the "HOST_UNRECHABLE"

Let's even assume that another host is assigned the SAME IP Address after you disconnected, then also the port number must match for end to end packet delivery which very rare that the IP AND PORT NO MATCHES AS IT IS NOT REQUIRED THAT NEW COMPUTER WOULD BE LISTENING ON THE SAME PORT NO. THERE ARE 65536 PORTS.

Now even if the port number matches, since the new PC/ destination Host would not be expecting any packet from a random Source IP. It would generally send a "Reset" Signal to the Source. [It means I was not expecting this packet, Kindly reconnect and send the packet again].


So, it is not possible as per the situation in your query.

I hope it answers :) 

Please upvote :)
 

selected by
4 votes
4 votes

Does we use MAC because it is a physical address embedded in the NIC and therefore we can use hardware circuit to identify whether the packet is delivered for us or not, as hardware are faster than the software, but what about address resolution overhead?

No
Explanation
Actually,Both IP AND MAC Address are unique in the entire world because
IP = Network ID + Subnet ID + Host ID
Subnet is determined by the Subnet Mask.

MAC = VendorID + Manufacturing Date + Serial Number
So, No two NICs in the world are same.

and theoretically MAC can be used like an IP ADDRESS but practically, it is not possible as it is not helpful in identifying the Target Network, Target Subnetwork and Host using VendorID,  Manufacturing Date and Serial Number.

and theoretically IP ADDRESS can ALSO be used like MAC but practically, it is not possible as it is a software number and keeps changing after the expiry of "lease time". So, if it changes frequently then for every packet we may need to send a query request asking for the updated IP Address or it may be possible that if IP ADDRESS is used as MAC Address then the source host may end up sending packet to an INVALID IP.


Why can't  WE USE MAC ADDRESSES AS IP ADDRESS ? Another Explanation....

Because they are permanent and if it is permanent then even if the host is not online ROUTERS will have to store it in memory. IPs are dynamic and the number of IPs in routing table depends upon the number of ONLINE hosts in the network. (DHCP does not assign IP to offline hosts). So the dynamic nature of IP helps in reducing the size of Routing table in Router's memory. So, IP Should always be DYNAMIC.


So, In conclusion : 

IP is expected to be dynamic and MAC is supposed to be Static [Although, we can change it by changing the NIC or by MAC Spoofing but generally MACs do not change like IP Addresses and they are not expected to change for the reasons mentioned above.]


[IP GETS INVALID BECAUSE THE LEASE TIME EXPIRES FOR THE PARTICULAR HOST AS DHCP SERVER LEASES IP DYNAMICALLY TO HOST FOR CERTAIN PERIOD ONLY AFTER WHICH IT MAY TAKE IT BACK].  

IP IS A SOFTWARE / LOGICAL NUMBER WHILE MAC IS PHYSICAL / HARDCODED / PERMANENT NUMBER.
Both of them have their own uses and we cannot use MAC address as IP address and IP Address as MAC address practically..

I hope it answers :)

Please upvote :)

edited by
1 votes
1 votes

Question 3) I have read that in modern operating system MAC address can be changed (https://www.thewindowsclub.com/change-mac-address-in-windows). How is it possible if MAC address is present in the NIC?

It is possible to change the MAC Address by 

1. Changing the NIC
2. Adding additional NIC
3. MAC Spoofing [You can even do it in your Windows Laptop without any software. OS provides functionality for it. But you should NOT do it. It is illegal.]


I hope it answers :) 

Please upvote :)

Related questions

1 votes
1 votes
1 answer
1
arnav1827 asked Mar 21, 2023
1,184 views
One of the header fields in an IP datagram is the Time to Live (TTL) field. Which of the following statements best explains the need for this field ? It can be used to pr...
0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
Mayank Joshi asked Sep 6, 2017
753 views
When the IP packet has minimum size (20bytes), what happens to option field. Is it not present or present with all bits set to 0 (all 40bytes of 0's)?
0 votes
0 votes
1 answer
4