Command
Encapsulation Dot1Q
Use
Allows you to use a router interface as a trunk port to a switch. This is also known as “Router on a stick” because the switch uses the router to route between VLANs.
Syntax
Router(config-subif)#encapsulation dot1Q <vlan> <native>
Option
<native> | Sets the vlan on the subinterface to act as the native VLAN. |
Example
In the below example we will configure a basic “router on a stick” configuration. First, we will configure the port connected to 2611XM’s Fa0/1 interface to be a trunk on the switch.
Routers only support Dot1Q encapsulation.
2950-XL#show cdp neighbor Device ID Local Intrfce Holdtme Capability Platform Port ID 2950-XL#conf t |
Now we configure the router’s Fa0/1 interface to act as a trunk.
First, we remove the ip address on the physical interface.
Next, we configure a subinterface for each VLAN the link will be a trunk for. The interface number can be anything you want.
After that, we configure encapsulation dot1q <vlan> for each subinterface. This command has to be entered before the IP address or you will get an error seen below.
Finally, configure an ip address for the VLAN. This is typically a default gateway.
2611XM(config-if)#int fa0/1 2611XM(config-if)#int fa0/1.70 2611XM(config-subif)#int fa0/1.99 % Configuring IP routing on a LAN subinterface is only allowed if that |
For testing we will add a couple SVI interfaces so we can do some ping tests.
2950-XL(config)#int vlan 70 Type escape sequence to abort. Type escape sequence to abort. |