What is Subinterface in Cisco Router

Subinterface in Cisco routers

The interface is the point of communication between two devices. Imagine a scenario where we have a router with a single interface and the same interface has to connect to two different IP networks.

Instead of having another router or additional interface cards, it is very easy to divide physical interface into two parts logically.

A sub interface is the logical division of physical interface. A physical interface can be divided into multiple sub interfaces.

Sub interfaces are used when Virtual Local Area Network (VLAN) is created in the network and inter-VLAN routing is enabled using a router on a stick method. The configuration of a sub interface is same as that of configuring physical interface. Before configuring a sub interface, the physical interface that is going to be divided must be turned active or on.

Let us consider an example where we create two sub interfaces or logical interfaces on Fast Ethernet 0/0 port of the router. Hence, Fast Ethernet 0/0 must be made active before dividing the Fast Ethernet interface logically.

CISCO-ROUTER> Enable

CISCO-ROUTER# configure terminal

CISCO-ROUTER(config)# interface FastEthernet 0/0

CISCO-ROUTER(config-if)# no shutdown

CISCO-ROUTER(config-if)# end

CISCO-ROUTER# copy run start

The above list of commands makes an inactive Fast Ethernet port active. Once the port is active, we can divide the port logically. The configuration of subinterface is same as that of configuring a physical interface.

CISCO-ROUTER> Enable

CISCO-ROUTER# configure terminal

CISCO-ROUTER(config)# interface FastEthernet 0/0.1

CISCO-ROUTER(config-if)# encapsulation dot1q 15

CISCO-ROUTER(config-if)# ip address 12.31.14.15 255.0.0.0

CISCO-ROUTER(config-if)# exit

CISCO-ROUTER(config)# interface FastEthernet 0/0.2

CISCO-ROUTER(config-if)# encapsulation dot1q 13

CISCO-ROUTER(config-if)# ip address 132.26.26.1 255.255.0.0

CISCO-ROUTER(config-if)# exit

CISCO-ROUTER# copy run start

The Fast Ethernet 0/0.1 and Fast Ethernet 0/0.2 indicates two logical interfaces derived from physical interface fast Ethernet 0/0. Encapsulation is the process of adding control data when it passes through the layered network. Dot1q encapsulation technique is used when VLAN’s are configured. IEEE 802.1q is simply represented as dot1q.

Trunk ports allow the VLAN data to pass from one switch to another switch. The trunk ports make use of trunk protocols like ISL and dot1q or IEEE 802.1q to transmit the VLAN information between two switches. 802.1q has VLAN identifier tag that gives the information about which VLAN does the frame belongs.

The 802.1q restricts the frames which do not have any tags on them. 15 and 13 in the configuration are the VLAN id’s to which the subinterface Fast Ethernet 0/0.1 and 0/0.2 belongs