What is a Cisco Router Subinterface?
A subinterface in a Cisco router is a logical (virtual) division of a physical interface. Each subinterface can be assigned to different VLANs or IP subnets, allowing a single physical interface to handle multiple networks or VLANs. Subinterfaces are primarily used in inter-VLAN routing (router-on-a-stick configuration) or for situations where multiple IP networks need to be routed over a single physical connection.

Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Use of Subinterfaces in Cisco Routers
- Inter-VLAN Routing: In environments with VLANs, subinterfaces are used to route traffic between different VLANs. Each VLAN is assigned to a subinterface on the router, which can then route traffic between VLANs.
- Network Segmentation: Subinterfaces allow logical separation of different networks or departments within a single physical infrastructure. For example, in a company, subinterfaces can be used to separate traffic for HR, IT, and other departments, even if all traffic goes through the same physical router interface.
- Trunk Links: When a router is connected to a switch via a trunk link (a link that carries traffic for multiple VLANs), subinterfaces allow the router to understand which VLAN the traffic belongs to by using 802.1Q tagging.
- Efficient Resource Usage: Instead of dedicating multiple physical interfaces for each network or VLAN, subinterfaces enable better utilization of a single physical port by creating multiple logical interfaces.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
How to Configure Subinterfaces in a Cisco Router
Below is a step-by-step guide to configuring subinterfaces in a router, using the example of inter-VLAN routing (Router-on-a-Stick). This example uses two VLANs: VLAN 10 (for the HR department) and VLAN 20 (for the IT department). A router will be connected to a switch that has these two VLANs configured.
Network Setup Example:
- VLAN 10: 192.168.10.0/24 (HR)
- VLAN 20: 192.168.20.0/24 (IT)
- Router physical interface: GigabitEthernet0/0
- Subinterfaces: GigabitEthernet0/0.10 for VLAN 10 and GigabitEthernet0/0.20 for VLAN 20
- Switchport connected to the router is configured as a trunk port.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Step 1: Configure VLANs on the Switch
First, make sure the switch is configured with VLAN 10 and VLAN 20.
Switch(config)# vlan 10nnSwitch(config-vlan)# name HRnnSwitch(config-vlan)# exitnnSwitch(config)# vlan 20nnSwitch(config-vlan)# name ITnnSwitch(config-vlan)# exitAssign the appropriate switch ports to the VLANs (for the HR and IT departments):
Switch(config)# interface fastEthernet 0/1nnSwitch(config-if)# switchport mode accessnnSwitch(config-if)# switchport access vlan 10nnSwitch(config-if)# exitnnSwitch(config)# interface fastEthernet 0/2nnSwitch(config-if)# switchport mode accessnnSwitch(config-if)# switchport access vlan 20nnSwitch(config-if)# exitFinally, configure the switch port connected to the router as a trunk port:
Switch(config)# interface fastEthernet 0/24nnSwitch(config-if)# switchport mode trunknnSwitch(config-if)# switchport trunk allowed vlan 10,20nnSwitch(config-if)# exitCisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Step 2: Configure Subinterfaces on the Router
Now, let’s move on to the router. We will create subinterfaces for VLAN 10 and VLAN 20.
Enter Global Configuration Mode:
Router> enablennRouter# configure terminalCreate Subinterfaces:
For each VLAN, create a subinterface and assign the appropriate encapsulation and IP address.
Router(config)# interface gigabitEthernet 0/0.10nnRouter(config-subif)# encapsulation dot1Q 10 # VLAN 10nnRouter(config-subif)# ip address 192.168.10.1 255.255.255.0nnRouter(config-subif)# exitnnRouter(config)# interface gigabitEthernet 0/0.20nnRouter(config-subif)# encapsulation dot1Q 20 # VLAN 20nnRouter(config-subif)# ip address 192.168.20.1 255.255.255.0nnRouter(config-subif)# exit- The encapsulation dot1Q [vlan-id] command is used to specify which VLAN the subinterface will handle. In this case, subinterface GigabitEthernet 0/0.10 handles VLAN 10, and subinterface GigabitEthernet 0/0.20 handles VLAN 20.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Step 3: Enable the Physical Interface
The physical interface (GigabitEthernet0/0) must be active to carry the VLAN traffic. Ensure it is enabled:
Router(config)# interface gigabitEthernet 0/0nnRouter(config-if)# no shutdownnnRouter(config-if)# exitCisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Step 4: Configure Routing
To enable communication between VLANs, the router must be able to route between the subnets. If this is the only router, it will automatically route between the directly connected subnets (192.168.10.0/24 and 192.168.20.0/24). However, if you have other networks, you may need to configure static routes or enable a routing protocol like RIP, EIGRP, or OSPF.
For basic inter-VLAN routing, no additional routing configuration is required, as the router already has routes for directly connected networks.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Step 5: Verification
Check Subinterface Configuration:
Use the show ip interface brief command to verify the subinterface configuration.
Router# show ip interface briefOutput:
Interface IP-Address OK? Method Status ProtocolGigabitEthernet0/0 unassigned YES unset up upGigabitEthernet0/0.10 192.168.10.1 YES manual up upGigabitEthernet0/0.20 192.168.20.1 YES manual up upTest Connectivity:
From a device in VLAN 10, try to ping a device in VLAN 20 to verify inter-VLAN routing.
PC1> ping 192.168.20.2Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Advantages of Subinterfaces
- Efficient Use of Resources: Subinterfaces allow you to use a single physical interface for multiple VLANs or networks, reducing the number of physical interfaces needed.
- Inter-VLAN Routing: Subinterfaces enable inter-VLAN routing (router-on-a-stick), allowing devices on different VLANs to communicate.
- Logical Segmentation: Subinterfaces provide logical segmentation for different networks without requiring additional physical infrastructure.
- Cost-Effective: Instead of buying multiple routers or switches with more ports, you can use subinterfaces to extend the functionality of existing devices.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Disadvantages of Subinterfaces
- Single Point of Failure: If the physical interface goes down, all subinterfaces using that interface will also go down, disrupting traffic for all VLANs or networks assigned to that interface.
- Performance Impact: Routing traffic between VLANs through a single physical interface can create bottlenecks, especially in environments with high traffic volumes.
- Configuration Complexity: Configuring subinterfaces for multiple VLANs requires careful planning and understanding of 802.1Q encapsulation, as well as attention to network design.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Summary
Subinterfaces in Cisco routers provide a flexible way to handle multiple VLANs or networks through a single physical interface. They are commonly used for inter-VLAN routing in router-on-a-stick configurations, where each VLAN is assigned a separate subinterface with its own IP address and 802.1Q encapsulation. Subinterfaces allow for efficient resource utilization and logical segmentation of networks, but they can also introduce performance bottlenecks and complexity in configuration. By following the configuration steps outlined, you can easily set up subinterfaces for inter-VLAN routing on a Cisco router.
Cisco Router Subinterfaces Explained: Purpose, Setup & Best Practices
Useful Links
Your feedback matters
Was this post helpful?
Discussion
0 approved comments
No approved comments yet. You can start the discussion below.
Leave a Comment
No login is required. Name and email are used for moderation/security. Your email is never displayed publicly. All comments require administrator approval.
Discover more from SanchitGurukul
Subscribe to get the latest posts sent to your email.