3-Options For Inter-VLAN Routing - Implementing and Administering Cisco Solutions
3-Options For Inter-VLAN Routing - Implementing and Administering Cisco Solutions
Open Transcript
Open Transcript
Inter-VLAN routing is a process of forwarding network traffic from one VLAN to another VLAN
using a Layer 3 device.
Traditional inter-VLAN routing requires multiple physical interfaces on both the router and the
switch. VLANs are associated with unique IP subnets on the network. This subnet configuration
facilitates the routing process in a multi-VLAN environment. When you use a router to facilitate
inter-VLAN routing, the router interfaces are connected to switch interfaces that are in separate
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 1/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
VLANs. Devices on these VLANs send traffic through the router to reach other VLANs. However,
when you use a separate interface for each VLAN on a router, you can quickly run out of
interfaces. This solution is not very scalable.
The figure shows a router that is attached to a switch. The router interface is configured to
operate as a trunk link and is connected to a switch port that is configured as a trunk. The router
performs inter-VLAN routing by accepting VLAN-tagged traffic on the trunk interface coming from
the adjacent switch and internally routing between the VLANs using subinterfaces. Subinterfaces
are multiple virtual interfaces that are associated with one physical interface. To perform inter-
VLAN routing functions, the router must know how to reach all VLANs that are being
interconnected; there must be a separate logical connection on the router for each VLAN. VLAN
trunking (such as Institute of Electrical and Electronics Engineers [IEEE] 802.1Q) must be
enabled on these connections.
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 2/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
These subinterfaces are configured in software. Each is independently configured with its own IP
addresses and VLAN assignment. The router routes packets incoming from one subinterface and
then sends the data on another subinterface by putting it in a VLAN-tagged frame and sending it
back out the same physical interface. Devices on the VLANs have their default gateway set to the
appropriate router IP address; in this figure, the devices in VLAN 10 will have default gateway set
to 10.1.10.1, and the devices in VLAN 20 will have default gateway set to 10.1.20.1.
Learning Activity
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 3/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
In the example, the encapsulation dot1q 20 command enables 802.1Q encapsulation trunking
on the GigabitEthernet0/0.20 subinterface. The value 20 represents the VLAN number (or VLAN
identifier), therefore associating 802.1Q-tagged traffic from this VLAN with the subinterface.
Each 802.1Q-tagged VLAN on the trunk link requires a subinterface with 802.1Q encapsulation
trunking that is enabled in this manner. The subinterface number does not have to be the same
as the dot1q VLAN number. However, management and troubleshooting are easier when the two
numbers are the same.
In this example, devices in different VLANs use the subinterfaces of the router as default
gateways to access the devices that are connected to the other VLANs.
On the switch, assign ports to specific VLANs and configure the port toward the router as a trunk.
The trunk link will carry traffic from different VLANs, and the router will route between these
VLANs.
Learning Activity
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 4/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
switchport Sets the access VLAN when the interface is in the access mode. To
access reset the access-mode VLAN to the appropriate default VLAN for the
vlan_number switch, use the no form of this command.
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 5/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
Verify the IPv4 routing table for the VLAN subinterfaces, using the show ip route command.
Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/0
L 10.1.10.1/32 is directly connected, GigabitEthernet0/0.10
C 10.1.10.0/24 is directly connected, GigabitEthernet0/0.10
L 10.1.20.1/32 is directly connected, GigabitEthernet0/0.20
C 10.1.20.0/24 is directly connected, GigabitEthernet0/0.20
The show ip route command displays the state of the routing table. The sample output shows
two subinterfaces. The GigabitEthernet0/0.10 and GigabitEthernet0/0.20 VLAN subinterfaces are
directly connected to the router.
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 6/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
Some switches can perform Layer 3 functions, replacing the need for dedicated routers to
perform basic routing on a network. Layer 3 switches are capable of performing inter-VLAN
routing. Traditionally, a switch makes forwarding decisions by looking at the Layer 2 header,
whereas a router makes forwarding decisions by looking at the Layer 3 header. A Layer 3 switch
combines the functionality of a switch and a router in one device. It switches traffic when the
source and destination are in the same VLAN and routes traffic when the source and destination
are in different VLANs (that is, on different IP subnets). To enable a Layer 3 switch to perform
routing functions, you must properly configure VLAN interfaces on the switch; these are called
switch virtual interfaces (SVIs). You must use the IP addresses that match the subnet that the
VLAN is associated with on the network. The Layer 3 switch must also have IP routing enabled.
Devices on the VLANs have their default gateway set to the appropriate Layer 3 switch IP
address.
Layer 3 switching is more scalable than router on a stick because the latter can pass only so
much traffic through the trunk link. In general, a Layer 3 switch is primarily a Layer 2 device that
has been upgraded to have some routing capabilities. A router is a Layer 3 device that can
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 7/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
perform some switching functions. Layer 3 switches do not have WAN interfaces, while routers
do. Typically, routers also support more advanced Layer 3 features (for example, Network
Address Translation, encryption, and tunneling) than Layer 3 switches.
However, the line between switches and routers becomes hazier every day. Some Layer 2
switches support limited Layer 3 functionality, such as static routing on SVIs, so you can configure
static routes, but routing protocols are not supported.
Following is an example configuration on the Layer 3 switch with personal computers (PCs) that
are connected to VLAN 10 and VLAN 20. PCs in VLAN 10 will have default gateway 10.1.10.1,
and PCs in VLAN 20 will have default gateway 10.1.20.1. The Layer 3 switch will perform routing
between VLAN 10 and VLAN 20.
ip routing
!
interface Vlan10
ip address 10.1.10.1 255.255.255.0
no shutdown
!
interface Vlan20
ip address 10.1.20.1 255.255.255.0
no shutdown
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 8/9
3/26/2020 Options for Inter-VLAN Routing | Implementing and Administering Cisco Solutions
https://ondemandelearning.cisco.com/cisco-cte/ccna10/sections/16/pages/3 9/9