Search

What is a Subinterface in a Cisco Router and how to create a subinterface in a Cisco Router

A subinterface is a virtual interface created by dividing one physical interface into multiple logical interfaces.  A sub-interface in a Cisco Router uses the parent physical interface for sending and receiving data.

Subinterfaces are used for a variety of purposes. If we have one Router with one physical interface, but needed to have the router connected to two IP networks to route traffic between two routers, we can create two sub interfaces within the physical interface, assign each sub interface an IP address within each subnet and then route the data between two subnets.

We use Subinterfaces for inter VLAN traffic routing by using a Router-on-a-Stick configuration, NBMA (Non Broadcast Multiple Access) WAN solutions like frame-relay or ATM etc.

A Subinterface can be configured just like a physical interface. If you take the help from Cisco IOS using question mark, we can see the number range which be can used to create subinterfaces.

omnisecu.com.R1(config)#interface fastEthernet 0/0.?
<0-4294967295>  FastEthernet interface number

To create a subinterface and configure it with an IP address, use the following commands.

To bring the physical interface from Administrativly down state to up, first go to the physical interface and issue "no shutdown" command as shown below.

omnisecu.com.R1>enable
omnisecu.com.R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
omnisecu.com.R1(config)#interface fastethernet 0/0
omnisecu.com.R1(config-if)#no shutdown
omnisecu.com.R1(config-if)#exit
omnisecu.com.R1(config)#exit
omnisecu.com.R1#

Now create and configure a sub interface as shown below. In below configuration example the encapulation is set to IEEE 802.1q for Inter-VLAN routing for VLAN 100.

omnisecu.com.R1>enable
omnisecu.com.R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
omnisecu.com.R1(config)#interface fastethernet 0/0.100
omnisecu.com.R1(config-subif)#encapsulation dot1Q 100
omnisecu.com.R1(config-subif)#ip address 172.16.100.1 255.255.255.0
omnisecu.com.R1(config-subif)#exit
omnisecu.com.R1(config)#exit
omnisecu.com.R1#
Related Tutorials
• Different types of interfaces in a Cisco Router
• What is loopback interface in a Cisco Router
• What is null interface in a Cisco Router
• How to configure Router Serial Interfaces
• Basic Cisco Router Configuration Commands
• Cisco Router Show Commands
• Important Key Combinations of Cisco IOS Command Line Interface (CLI)
• Router interface naming conventionf
• Cisco Router interface configuration commands