cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
453
Views
5
Helpful
4
Replies

Switching Layer-2/Layer-3

hassan_syed6
Level 1
Level 1

Hello,

I have a simple question which is confusing me.

In a Lan setup we have let's say 2 workstations on the same subnet on VLAN-1 and we have a Router FastEthernet also connects on the Switch as the gateway for the same subnet.

So both PC's have their default gateway ( Router's FastEthernet- IP address). When 1-PC sends a traffic to PC # 2, does the traffic have to go to Router and once router sees it that everybody is on the same subnet I don't have to send it out and it justs forwards it to PC # 2. OR ...the switch because of the MAC-Address table ( Layer-2) gets the traffic from PC-1 and forwards it to PC # 2.

My confusion is because of default gateway given to PC's and switch of Router's FastEthernet does the packet touches the Default gateway ( Router) and gets send back to switch for PC # 2. Because in Layer-3 source/dest. IP addresses..and switch can't do that so Router has to decided where it goes...correct me if i am wrong...or i am not clear enough...

Regards,

Hassan....

4 Replies 4

Edison Ortiz
Hall of Fame
Hall of Fame

On same subnet, the workstation goes directly to the other workstation without using the gateway.

You can do a quick test and unplug the gateway from the network and repeat the process. Do it during non-production time of course :)

Jon Marshall
Hall of Fame
Hall of Fame

Hassan

If PC1 wants to talk to PC2 and they are on the same subnet with the same subnet mask once PC1 has the mac-address of PC2 it will send data to it. It does not need the router for this communication.

If PC1 wants to talk to another PC on a different subnet then yes it will use the router.

HTH

Jon

Hello,

Thanks for the replies. My confusion is Packet Headers. If switch has mac-addresses of all the PC's then PC # 1 will go to switch and will process it and forward to PC # 2 because it's on same subnet...so far so good. In packet headers, we have IP addresses also right, source and destination....switch does not recognize ip address because it's layer 2 so I am not saying Router will process it but it will forward back to Switch ...or i am getting all confuse...I guess I have been looking at Packet headers alot..and thing have confused my concept..

When PC1 talks to PC2 it uses the mac-address. Mac-addresses are used on ethernet to deliver traffic between hosts on the same subnet.

The IP addresses are relevant only when the host has to make a forwarding decision ie.

PC1 192.168.5.5 255.255.255.0

PC1 network 192.168.5.0

PC2 192.168.5.10 255.255.255.0

PC1 compares PC2's ip address with it's own subnet mask

PC2 192.168.5.10 255.255.255.0 - network = 192.168.5.0 so this is the same network and so it only needs the mac-address to deliver the packet.

Jon

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco