Content

| 4.2 |  | Configuring Inter-VLAN Routing |
| 4.2.6 |  | Configuring router-on-a-stick |

When using an external router, an interface can be logically divided into multiple, virtual subinterfaces. Subinterfaces provide a flexible solution for routing multiple VLANs through a single physical interface.

To configure subinterfaces on a physical interface, perform the following tasks:

- Identify the interface.
- Define the VLAN encapsulation.
- Assign an IP address to the interface.

To identify the interface, enter the following command in global configuration mode:

> Router(config)#interface FastEthernet slot-number / port-number.subinterface-number

> Note: The slot-number/port-number.subinterface-number identifies the physical and logical interface.

To define the VLAN encapsulation, enter the following command in subinterface configuration mode:

> Router(config-subif)#encapsulation dot1Q vlan-number

> Note: The vlan-number identifies the VLAN for which the subinterface will carry traffic.

To assign the IP address to the subinterface, enter the following command in interface configuration mode:

> Router(config-subif)#ip address ip-address subnet-mask

> Note: The ip-address and subnet-mask are the 32-bit network address and mask of the specific interface.

In the example configuration file, the router has three subinterfaces configured on Fast Ethernet interface 0/0. These three interfaces are identified as FastEthernet0/0.10, FastEthernet0/0.20, and FastEthernet0/0.30. All interfaces are encapsulated for 802.1Q. Interface FastEthernet0/0.10 is routing packets for VLAN 10, whereas interface FastEthernet0/0.20 is routing packets for VLAN 20 and FastEthernet0/0.30 is routing packets for VLAN 30.

With IOS 12.1(3)T and later, the router subinterface can be configured as the native VLAN. The native option tells the router to accept any frames coming in untagged on FastEthernet0/0 as belonging to VLAN 1. Prior to IOS 12.1(3)T the native VLAN had to be configured on the physical interface of the router.