06-14-2023
08:10 AM
- last edited on
06-15-2023
10:33 AM
by
Translator
I wanted to ask, using a configuration below...
Regarding the second command; the VLAN number doesn't have to match.
Regarding the third command; Does the VLAN number have to match here with the one we configured on the switch? For example; 10 on the switch, and 10 here, on the Router?
I am asking because I am just interesting how does a router determine which tag belongs to which subinterface? Thank you for your help.
1. Interface g0/0
2. Interface g0/0.10
3. Encapsulation dot1q 10
4. Ip address 192.168.1.62 255.255.255.192
Solved! Go to Solution.
06-14-2023
08:28 AM
- last edited on
06-15-2023
10:36 AM
by
Translator
Encapsulation dot1q 10
this vlan-id need to match what you config in SW in vlan database and vlan allow in trunk
SW
vlan 10
interface fax/x <<- interface connect to router
switchport mode trunk
switchport trunk allow vlan 10
R
interface fa0/0.1000 <<- not matter
encapsulation dot1q 10 <<- must match VLAN-ID in SW
ip add x.x.x.x mask
06-14-2023
09:23 AM
- last edited on
06-15-2023
10:38 AM
by
Translator
The subinterface of
g0/0.10
does not have to match but it is helpful for identifying which subinterface belongs to which VLAN. You only have 1 in your example but imagine a network with 10 or 20 subinterfaces. As @MHM Cisco World pointed out the encapsulation number has to match the VLAN youre trying to match becasue its telling the router that wehn you send traffic on this subinterface encapsulate it with the VLAN # tag so when the switch on the other side receives it on its trunk port it knows which VLAN it belongs to and can switch the frames accordingly.
-David
06-14-2023
01:07 PM
- last edited on
06-15-2023
10:43 AM
by
Translator
Hello @Sinosha,
When a router receives a frame with a
dot1q
header, it uses the information in the header to determine which subinterface should handle the frame.
The
dot1q
header contains a VLAN tag that specifies the VLAN ID of the traffic. The router examines this VLAN tag to determine which subinterface is associated with that VLAN. The router compares the VLAN ID in the
dot1q
header with the VLAN IDs configured on its subinterfaces. If there is a match, the router forwards the frame to the corresponding subinterface.
Each subinterface is configured with a specific VLAN ID using the Encapsulation
dot1q
command. This VLAN ID is used as a filter to determine which frames should be accepted by the subinterface. Frames that arrive with a matching VLAN tag are forwarded to the corresponding subinterface, and frames with a different VLAN tag are typically dropped or handled according to the router's configuration.
By associating a VLAN ID with a subinterface, the router can distinguish between different VLANs and treat them as separate logical interfaces, allowing for the routing and processing of traffic between different VLANs.
06-14-2023
08:28 AM
- last edited on
06-15-2023
10:36 AM
by
Translator
Encapsulation dot1q 10
this vlan-id need to match what you config in SW in vlan database and vlan allow in trunk
SW
vlan 10
interface fax/x <<- interface connect to router
switchport mode trunk
switchport trunk allow vlan 10
R
interface fa0/0.1000 <<- not matter
encapsulation dot1q 10 <<- must match VLAN-ID in SW
ip add x.x.x.x mask
06-14-2023
09:23 AM
- last edited on
06-15-2023
10:38 AM
by
Translator
The subinterface of
g0/0.10
does not have to match but it is helpful for identifying which subinterface belongs to which VLAN. You only have 1 in your example but imagine a network with 10 or 20 subinterfaces. As @MHM Cisco World pointed out the encapsulation number has to match the VLAN youre trying to match becasue its telling the router that wehn you send traffic on this subinterface encapsulate it with the VLAN # tag so when the switch on the other side receives it on its trunk port it knows which VLAN it belongs to and can switch the frames accordingly.
-David
06-14-2023
01:07 PM
- last edited on
06-15-2023
10:43 AM
by
Translator
Hello @Sinosha,
When a router receives a frame with a
dot1q
header, it uses the information in the header to determine which subinterface should handle the frame.
The
dot1q
header contains a VLAN tag that specifies the VLAN ID of the traffic. The router examines this VLAN tag to determine which subinterface is associated with that VLAN. The router compares the VLAN ID in the
dot1q
header with the VLAN IDs configured on its subinterfaces. If there is a match, the router forwards the frame to the corresponding subinterface.
Each subinterface is configured with a specific VLAN ID using the Encapsulation
dot1q
command. This VLAN ID is used as a filter to determine which frames should be accepted by the subinterface. Frames that arrive with a matching VLAN tag are forwarded to the corresponding subinterface, and frames with a different VLAN tag are typically dropped or handled according to the router's configuration.
By associating a VLAN ID with a subinterface, the router can distinguish between different VLANs and treat them as separate logical interfaces, allowing for the routing and processing of traffic between different VLANs.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide