The Gateway to Computer Science Excellence
+1 vote
255 views

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?

in Computer Networks by (481 points)
edited by | 255 views
0

Mac address can be changed. 

Mac Address : Physical Address (Which is unique only within the network)

IP Address : Logical Address (Which is unique in Entire World)

0
Remember Router has Only Three layers -

1.PL

2.DLL

3.NL
0
Mac address can be changed if you change nic chip.
0
yes i know routers have only 3 layers : physical, data link layer and network layer, the router or any device accepts the packet if the destination MAC address in the packet matches it's own MAC address, then it checks the destination IP address using it's network layer. If the destination IP address is device address then it accepts the packet else it uses the subnet mask to find whether the destination packet is in same network or other network,

if the packet belongs to the same network it uses the ARP to find the MAC address of the destination device and transmits the packet to the device else

it finds the IP address of the interface or default gateway at which the packet needs to be transmitted in the next hop(default gateway and interface's IP address is available to the routers in the routing table), the IP address then is used to discover the MAC address using ARP and then the packet is transmitted to the next hop or the router.

This is what i have understood till now, my question was why we need the MAC address if IP addresses are unique and can be used instead of MAC for hop to hop transmission, the data link layer will work as it works but instead of MAC address, why don't it use IP address and therefore directly transmit the packet to the next hop or the destination? Please correct me where i am going wrong....
0

3 Answers

+3 votes
Best answer

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 :)
 

by (495 points)
selected by
+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 :)

by (495 points)
edited by
+1 vote

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 :)

by (495 points)
0
Thank you very much for your answers.
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,291 answers
198,209 comments
104,890 users