View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12940 Members
Join this group to post and comment.
Sachin Jain
Sachin Jain • Oct 22, 2010

IP datagrams contains mac or not ?

Hello friends,
Can anyone tell me whether there is MAC address inside Datagram or not ?
If there is no mac, then how do we identify the desired system(receiver) in its network ?
silverscorpion
silverscorpion • Oct 22, 2010
IP packets won't contain MAC. They willonly contain IP address, of both the source and recipient.

The MAC address of the recipient is found from the recipient's IP address using the ARP protocol.

This is called address resolution, and it happens in layer 2 or Data Link Layer. 😀
Sachin Jain
Sachin Jain • Oct 22, 2010
Sorry but i did not get what you are saying.

Suppose my architecture is like this

Source-->Router1---->Router2----->Destination
Source : 172.19.6.59
172.19.6.1--------Router1----172.17.15.1
172.17.15.64-----Router2-----172.31.1.4
Destination : 172.31.1.6

Assume Mac are : S,R1a,R1b,R2a,R2b,D

Now, i want to send data from 172.19.6.59 to 172.31.1.6
so i want to know how data will travel from S to D.
As i know to move from one node to other it needs H/w address of other device.

Please reply....
Munguti
Munguti • Oct 22, 2010
As an addition mac addresses are only used for hosts on the same network, while IP addresses are used for hosts on different networks. Read more on ethernet communications and routing
Kishan Gupta
Kishan Gupta • Oct 22, 2010
Munguti saying right, mac address is only used for same network and ip address for different network.

Suppose my architecture is like this

Source-->Router1---->Router2----->Destination
Source : 172.19.6.59
172.19.6.1--------Router1----172.17.15.1
172.17.15.64-----Router2-----172.31.1.4
Destination : 172.31.1.6

Assume Mac are : S,R1a,R1b,R2a,R2b,D

Now, i want to send data from 172.19.6.59 to 172.31.1.6
so i want to know how data will travel from S to D.
As i know to move from one node to other it needs H/w address of other device.

Please reply....
NOw as your assumption, your ip's are Class B.
Source transfer data to router1, here router 1 knows the mac address of source (or use mac address to communicate with it).
Router 1 read destination address, and on its table information it send data (packet) to router 2.
Router 2 receive data and read destination.
Router 2 found destination in local network, it send packets to destination system. Here mac address is again used.

In between no mac address is used.
However if we want to trace source then we need to go back in reverse order.
I think it is enough for you.
Sachin Jain
Sachin Jain • Oct 22, 2010
jcksn
In between no mac address is used.
However if we want to trace source then we need to go back in reverse order.
But as i know we need MAC address to deliver packets to a node or system.As you are saying "in between no mac is used".
I am thinking its wrong.
As router1 (2nd Nic) and Router2 (1st nic) are on same network so to send packet from router1(2nd nic) to router2(1st nic) , there id need of mac of router2(1st nic) by router1(2nd nic)
Tell me if i am wrong.
durga ch
durga ch • Oct 22, 2010
@blunderboy

can you show your example in pictures? from what i understand, S is connected to R1 and D is connected to R2 right?
Lets name the LAN created by R1 as L1 and similarly LAN by R2 as L2. R1, R2 are connected, but that doesnot mean they are on a 'network' infact they form a network
now, consider the case when S has to send a packet within L1, though it knows that the IP address prefix is same , it will have to know the MAC address , and thats where ARP is used.This has already been pointed out
Now the case where Packet has to traverse to a different LAN in this case L2. The source puts in the public IP address of the destination D in the packet and pushes it to R1, R1 verifies the public address . Apart from the routing tables what a router uses , router as well does a forwarding functionality. In sense, it explicitly sees on what port (interface/card) is it supposed to forward the packet to in order to send the packet to destination. In case the Interface 1(I1) of R1 is connecting to R2, then R1 forwards the packet to I1 .It might at this point, look of MAC address of the I1 NIC.
Munguti
Munguti • Oct 25, 2010
blunderboy
But as i know we need MAC address to deliver packets to a node or system.As you are saying "in between no mac is used".
I am thinking its wrong.
As router1 (2nd Nic) and Router2 (1st nic) are on same network so to send packet from router1(2nd nic) to router2(1st nic) , there id need of mac of router2(1st nic) by router1(2nd nic)
Tell me if i am wrong.
I agree with blunder boy, mac addressses are used btn routers since they are on the same network. The source and destination MAC addresses change as the packet is moved from one network to another but the source and destination IPaddresses never change. This is why there is need for both forms of addressing.
Sachin Jain
Sachin Jain • Oct 26, 2010
Thanx Guys,
I have understood the concept well why we need both forms of addressing.
Just tell me one more thing when an intermediate node will send the frame to the next hop,
then the source MAC will be of itself or the original sender's MAC.
I mean will the intermediate node change the Source MAC or not ?

I hope the question is clear.
Munguti
Munguti • Oct 26, 2010
blunderboy
Thanx Guys,
I have understood the concept well why we need both forms of addressing.
Just tell me one more thing when an intermediate node will send the frame to the next hop,
then the source MAC will be of itself or the original sender's MAC.
I mean will the intermediate node change the Source MAC or not ?

I hope the question is clear.
The source MAC will be of itself(the intermediate node) and the destination MAC that of the next hop. But the source IP will be that for the original sender and the destination IP that of the final receiver.

So to answer your question, yes it will change the MAC address to be that of its own.

Share this content on your social channels -