Cisco switch: 802.1q trunk to router, aka router-on-a-stick

Contributor Icon Contributed by abanks Date Icon November 17, 2006  
Tag Icon Tagged: Cisco switch

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.

Previous recipe | Next recipe |
 
  • Anonymous
    For 2600 series routers, I had to do a "no shutdown" on ethernet 0/0 interface for the trunk to come up and work properly.
  • Haitham
    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
    You need fastEthernet interface.
  • Dominusanubis
    You have the wrong IOS, go to Cisco's site and download this IOS....

    c2600-d-mz
  • Dominusanubis
    And no, you dont need a Fast Ethernet interface to do encapsulation.
  • felix
    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
  • Bob
    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
    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.
  • toni
    veryyyyyyyyyyyyyy good help
  • Tony
    Dude! Simplest explanation of VLAN and TRUNK'ing I have ever seen. Sweeeeet!
blog comments powered by Disqus