VLANs are used for segmenting a switched network into multiple broadcast domains. Normally, traffic has to be routed through a Layer 3 device like a router for packets to flow from one VLAN to another. However, routers can also be configured for bridging traffic from one VLAN to the other when non-routable protocols are used.
Generally, the inter-VLAN traffic flows between the switch and a router on links configured for VLAN trunking. Cisco proprietary Inter Switch Link (ISL) and IEEE 802.1Q are VLAN trunking mechanisms which allow traffic from multiple VLANs to be carried over the same link. This is done by carrying the VLAN information using identifiers in VLAN headers.
For the same VLAN to span a router, the router must be capable of forwarding frames from one interface to another by maintaining the VLAN header. The way the Layer 3, Media Access Control (MAC) and VLAN headers are handled by a router depends on whether a protocol is being routed or bridged. When a protocol is routed, the router replaces the incoming VLAN and MAC header with a new one, but it retains the same Layer 3 header before forwarding a frame from one interface to another. When the router bridges a protocol, it terminates the VLAN header and replaces it with a new header, but it retains the original MAC and Layer 3 header. Since both routing and bridging terminate the existing VLAN header and use a new header, a VLAN cannot be said to span a router. However, both links of the router may be configured with the same VLAN number.
Integrated Routing and Bridging (IRB) is a technique that allows a protocol to be bridged as well as routed on the same interface on a router. When a router is configured for IRB, it maintains the existing VLAN header when forwarding the frame between the interfaces. This allows the same VLAN to span a router.