cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
3681
Views
15
Helpful
4
Replies

What the difference between Mac-address in the same subnet vs a mac address in another subnet.

dolanduck.
Level 1
Level 1

hello im having trouble getting the concept on how mac address works.

For example

 Say i have two switches and 2 computers connected at each end of the both switches and both switches connected by each other interface. here is the part that gets me why doesn't the switch change the mac address of the destination  or is that a router thing?   

Studying for the new ccna

3 Accepted Solutions

Accepted Solutions

Hi @dolanduck. ,

Layer 2 switches stretch the broadcast domain. In a broadcast domain of any size, the Ethernet MAC address is kept intact when forwarded by the switches out the correct port. There will be no MAC address change. Having said this, communication between your 2 computers in the same IP subnet, say 192.168.1.0/24 is possible and no change of MAC address will happen.

On the other hand, when computers are on different subnets, let's say Subnet A and Subnet B:

Subnet A) 192.168.1.0/24

Subnet B) 192.168.2.0/24

If Computer A in Subnet A needs to communicate to Computer B in Subnet B then:

Computer A sends the frame with the MAC destination the MAC of the Default Gateway IP in Subnet A which is for purpose of this explanation a Router.

Once the Router receives the packet, it will "route" the packet out its corresponding interface that connects to subnet B where the source MAC will now be the Router interface on subnet B and the destination MAC the one of Computer B. This is when MAC change happens.

There is also the ARP process and Unicast flood which are important in this process in real life but are not covered in this answer to keep it simple.

Additionally, this article can be of help:

 
PS:
The Cisco Learning Network community is a great place to discuss questions about topics coming in the Cisco certifications.
 
Regards.

View solution in original post

Hi,

 

    Things are simpler than that (leave ARP and subnet and broadcast domains aside). Forwarding within the same VLAN/subnet/broadcast domain, across one switch or multiple switches, is done based on the destination MAC address, so this never gets changed. When you need to reach anyone outside your VLAN/subnet/broadcast domain, your packet is still forwarded  based on the destination MAC address till it reaches your default gateway, a layer 3 hop, which it now routes the packet further based on the destination IP address and it will change the layer 2 header as well (as it may for example exit a Serial link, of for Ethernet it will change both source , to identify itself, and destination MAC, to identify the next-hop).

 

Regards,

Cristian Matei.

View solution in original post

Joseph W. Doherty
Hall of Fame
Hall of Fame
Another way to look at this, MACs are used for L2 communication between hosts. Two computer hosts within the same L2 domain communicate directly using each other MACs. Two computer hosts in different L2 domains, separated by a router, send their L2 traffic to the router, which in turn forwards it using the next hop, or destination's MAC, but using its own MACs on the interface connect to the L2 domain.

Same L2 domain

PC1 (mac 1) and PC2 (mac 2)

PC1 to PC2 src mac 1 : dest mac 2
PC2 to PC1 src mac 2 : dest mac 1

Different L2 domains - separated by a router

PC1 (mac 1) and (mac 10) RTR (mac 20) and PC2 (mac 2)

PC1 to PC2 src mac 1 : dest mac 10 then RTR consumes frame and makes new frame src mac 20 : dest mac 2
PC2 to PC1 src mac 2 : dest mac 20 then RTR consumes frame and makes new frame src mac 10 : dest mac 1

BTW, MACs need to be unique within same L2 domain, but can be duplicates across L2 domains, for example, with the RTR PC2's MAC could be 1 or 10.

View solution in original post

4 Replies 4

Hi @dolanduck. ,

Layer 2 switches stretch the broadcast domain. In a broadcast domain of any size, the Ethernet MAC address is kept intact when forwarded by the switches out the correct port. There will be no MAC address change. Having said this, communication between your 2 computers in the same IP subnet, say 192.168.1.0/24 is possible and no change of MAC address will happen.

On the other hand, when computers are on different subnets, let's say Subnet A and Subnet B:

Subnet A) 192.168.1.0/24

Subnet B) 192.168.2.0/24

If Computer A in Subnet A needs to communicate to Computer B in Subnet B then:

Computer A sends the frame with the MAC destination the MAC of the Default Gateway IP in Subnet A which is for purpose of this explanation a Router.

Once the Router receives the packet, it will "route" the packet out its corresponding interface that connects to subnet B where the source MAC will now be the Router interface on subnet B and the destination MAC the one of Computer B. This is when MAC change happens.

There is also the ARP process and Unicast flood which are important in this process in real life but are not covered in this answer to keep it simple.

Additionally, this article can be of help:

 
PS:
The Cisco Learning Network community is a great place to discuss questions about topics coming in the Cisco certifications.
 
Regards.

so correct me if im wrong so from the that link you sent and what you said.

Computers connected to a switch or that switch connected to a another switch and are in one big broadcast domain, there own bubble.

so by default they are all in vlan1 so they are in one big broadcast domain right ?

so, for vlan1 192.168.0.0/24 all hosts don't need to change mac addresses because they are in the same sub-net. They use arp to find the mac address that belongs to that ip in the same sub-net ?

 

Hi,

 

    Things are simpler than that (leave ARP and subnet and broadcast domains aside). Forwarding within the same VLAN/subnet/broadcast domain, across one switch or multiple switches, is done based on the destination MAC address, so this never gets changed. When you need to reach anyone outside your VLAN/subnet/broadcast domain, your packet is still forwarded  based on the destination MAC address till it reaches your default gateway, a layer 3 hop, which it now routes the packet further based on the destination IP address and it will change the layer 2 header as well (as it may for example exit a Serial link, of for Ethernet it will change both source , to identify itself, and destination MAC, to identify the next-hop).

 

Regards,

Cristian Matei.

Joseph W. Doherty
Hall of Fame
Hall of Fame
Another way to look at this, MACs are used for L2 communication between hosts. Two computer hosts within the same L2 domain communicate directly using each other MACs. Two computer hosts in different L2 domains, separated by a router, send their L2 traffic to the router, which in turn forwards it using the next hop, or destination's MAC, but using its own MACs on the interface connect to the L2 domain.

Same L2 domain

PC1 (mac 1) and PC2 (mac 2)

PC1 to PC2 src mac 1 : dest mac 2
PC2 to PC1 src mac 2 : dest mac 1

Different L2 domains - separated by a router

PC1 (mac 1) and (mac 10) RTR (mac 20) and PC2 (mac 2)

PC1 to PC2 src mac 1 : dest mac 10 then RTR consumes frame and makes new frame src mac 20 : dest mac 2
PC2 to PC1 src mac 2 : dest mac 20 then RTR consumes frame and makes new frame src mac 10 : dest mac 1

BTW, MACs need to be unique within same L2 domain, but can be duplicates across L2 domains, for example, with the RTR PC2's MAC could be 1 or 10.
Review Cisco Networking products for a $25 gift card