cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Cisco announces new innovations in SD-WAN, ISRs, SD-WAN Services, and Catalyst 9000 Series switches


226
Views
0
Helpful
4
Replies
Beginner

Router, Switches, Vlans, PCs, Dot1Q

Hello everyone,
Can anyone explain to me why we need a router to ping PC's that are in different vlans?
Or better yet, I have doubts in behavior about:
1 - What happens when I ping to PCs that have the same VLAN?
2 - What happens when I ping PCs that have different VLANs?
3 - Why do switches put a tag(dot1Q) in frames?
4 - Where does the router fit into all this?

Everyone's tags (3)
4 REPLIES
Highlighted
VIP Expert

Re: Router, Switches, Vlans, PCs, Dot1Q

Your questions mainly fall into the "it depends" category. As most can be answered with completely opposite answers depending on how the network, and hosts, are configured.

For example:

"Can anyone explain to me why we need a router to ping PC's that are in different vlans?"

Router (or another L3 routing device) isn't always required.

For 1 & 2, from the host PC perspective, generally the same thing happens.

For 3, to identify what VLAN a frame belongs to where there are multiple VLANs on the same medium.

For 4, generally for moving traffic between networks, but again, there's much that can impact this and what's needed or not.
Beginner

Re: Router, Switches, Vlans, PCs, Dot1Q

My question is related to what happens with my frame.
For example, figuring that I have a PC1 that is in vlan 10 and a PC2 that is in vlan 20 that are separated by a switch and this same switch is connected to a router. I'm going to use my PC1 to ping PC2... and what I know is that my frame that is being sent is of type 802.3, but when it arrives at the switch it places a tag on it 802.1Q, there was a transition from 802.3 -> 802.1Q and this same frame will go to my router (which has subinterfaces configured (vlan 10 and vlan 20 => encapsulation dot1Q) which will do an inter routing vlan, I do not know if here the frame undergoes a new transition, but continuing this same frame will again reach my switch that will do the tag removal, that is, there will be a 802.1Q -> 802.3 transition, and this same frame is received by PC2.

My question here is that my knowledge on this is vague, which is why I made those 4 questions to see if anyone can deepen my knowledge.

Hall of Fame Guru

Re: Router, Switches, Vlans, PCs, Dot1Q


@vekiez wrote:

My question here is that my knowledge on this is vague, which is why I made those 4 questions to see if anyone can deepen my knowledge.My question here is that my knowledge on this is vague, which is why I made those 4 questions to see if anyone can deepen my knowledge.


There are several ways to answer these questions and one of the factors that will influence the answers will depend entirely on your instructor's lesson. 

This forum is mostly used by people with real-life networking issues.  If we start giving out answers that, based on our real-life experience in fixing things, may not "gel" with your instructor's teaching and chances are your instructor may just turn around and ask, "Where the <EXPLETIVE> did you get this idea from?"

VIP Expert

Re: Router, Switches, Vlans, PCs, Dot1Q

Ok, what normally happens, for the situation you describe is:

PC1 will physically send the ping request to its defined gateway IP (right here this assumes it has a gateway IP defined). It would do this assuming PC2's IP is in a different network than its own.

If the gateway IP is not in PC1's ARP cache, it would ARP for the gateway IP. When PC1 receives the ARP reply, it can construct a frame with the gateway's MAC. The packet, though, would have the PC2 IP.

When the switch receives the frame from PC1, it would forward that frame out its trunk port to the router.  (This assumes the switch knows which port that is - and it should having just seen the ARP reply.  The ARP request, may have been sent to all the switch's ports, same VLAN, except the ingress port.) Since link to the router would be a trunk, to carry the two VLANs, 10 and 20, frames to the router would have a VLAN tag added to them, unless the VLAN is defined to be "native" (only one can be so defined - by default, its VLAN 1).

The router's port will receive the frame, and depending on how the router port is defined, know which logical subinterace the frame belong to. It will then strip the frame and route the packet. As the packet should be routed to VLAN 20's interface, the router will construct a new frame to encapsulate the packet and send it to the switch (which which will forward it to the PC2 port). How the frame is constructed is much again a repeat of what I've already described, in that router needs the MAC of PC2 and may need to add a VLAN tag to the frame, which will be stripped off by the switch.

When PC2 receives the frame built by the router, and strips that off, it will then have the packet sent by PC1. It will then reverse the process to send a ping reply.

Important to the above, L2 frames don't transit L3 interfaces. L2 VLAN tags are only used when needed to identiy that frames belong to different VLANs on the same "wire". Cisco, though, will permit one VLAN to use untagged frames on such a shared "wire".

BTW, networking books, or other information on the Internet will likely better explain the above. These forums are best used for very specific questions (or as Leo notes - what's actually done in the "real world").

CreatePlease to create content
Content for Community-Ad

Blog-Cisco Community Designated VIP Class of 2019