Cisco switch: 802.1q trunk to router, aka router-on-a-stick
Connect a Cisco switch and router via 802.1q trunking. This configuration is known as a router-on-a-stick.
First, let’s start with the switch. VLAN 1 exists by default, so we’ll add a couple of other VLANs:
vlan 100
name data
state active
vlan 200
name data
state active
Now, let’s configure the switchport to connect to the router:
interface fastethernet 1/0/1
switchport trunk encapsulation dot1q
switchport mode trunk
Over to the router!
interface fastethernet 0/0
no ip address
interface fastethernet 0/0.1
encapsulation dot1q 1 native
interface fastethernet 0/0.100
encapsulation dot1q 100
ip address 192.168.100.1 255.255.255.0
interface fastethernet 0/0.200
encapsulation dot1q 200
ip address 192.168.200.1 255.255.255.0
At this point, workstations on VLAN 100 should be able to ping the 192.168.100.1 address, and workstations on VLAN 200 should be able to ping the 192.168.200.1 address.
If, for some reason, the native VLAN on the switchport is something other than 1, change the encapsulation statement on the router, or the trunk may not form.











Haitham said on December 14, 2008
Hello, I wonder how to create a 802.1q interface in cisco 2600 router with ios ver c2600-i-mz_122-1?
it has one interface Ethernet 0/0
but I searched about encapsulation .1q commands and couldn’t find it.
So i need your advice.
Best Regards
Dahab
vtwin said on January 15, 2009
You need fastEthernet interface.
Dominusanubis said on January 19, 2009
You have the wrong IOS, go to Cisco’s site and download this IOS….
c2600-d-mz
Dominusanubis said on January 19, 2009
And no, you dont need a Fast Ethernet interface to do encapsulation.
felix said on March 1, 2009
its usuall not a good idea to use vlan 1 as your management vlan for security reasons.
make sure to trunk the interface directly conecting the switch to the router.
Bob said on April 6, 2009
try using ISL as the encapsulation. And if the router has a AUX port you can get a dongle that will turn it into a ethernet/fast ethernet port
felix said on June 20, 2009
You do need FastEthernet interface. You cannot create a sub-interfaces from a regular Ethernet interface. So, you cannot use a router that doesn’t have a fastethernet interface in a router on a stick configuration
toni said on June 30, 2009
veryyyyyyyyyyyyyy good help
Tony said on July 10, 2009
Dude! Simplest explanation of VLAN and TRUNK’ing I have ever seen. Sweeeeet!
Anonymous said on April 22, 2010
good work, keep it up.
Ace said on July 8, 2010
omg :0
Ive totally forgot encapsulation dot1q 1 native in sub
thanQ
Axiz said on September 28, 2010
how about routing vlan 100 to vlan 200 what would be the config?
Hhaa111 said on October 3, 2010
I tried creating sub-interface on a regular ethernet interface and it does allow you to create.
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 155.1.58.5 YES manual up up
Ethernet0/0.1 unassigned YES unset up up
Serial0/0 155.1.0.5 YES manual up up
Markjunky said on July 29, 2011
They are rotued on the router … ’show ip route’ on the router should show the two routes as connected. Hence, hosts on VLAN 100 should point to 192.168.100.1 as their gateway to VLAN 200, and hosts on VLAN 200 should point to 192.168.200.1 as their gateway to VLAN 100.
simone1 said on January 10, 2012
Is there a limit to amount of sub interfaces which can be created on one router fastethernet interface