How To Configure a Router-on-a-Stick

September 2, 2009

in CCNA

The example I am showing you was built using the RouterSim Network Visualizer. I’m doing this as part of my CCNA studies to get me familiar with configuring a router and switch together and also making sure computers on different subnets can actually communicate with each other.

Here is the virtual hardware used in this virtual lab:

  • Cisco 2811 Router
  • Cisco 3560 Switch
  • 2 x PC
Router on a Stick

Router on a Stick

The router on a stick is simply one router routing traffic between virtual local area networks (vlans). I’ll have the Cisco 3560 connecting to the Cisco 2811 Router. The 2 computers will connect to the 3560 switch but will be on 2 separate subnets or vlans.

Here’s what we’ll have to do this CCNA lab:

  1. Configure two virtual interfaces on f0/1 for the 2811 router.
  2. Configure f0/1 on the 3560 switch as a trunk interface to the 2811 router interface
  3. Configure two ports on the 3560 switch on different vlans.

How to configure a router on a stick lab:

Open the console for the Cisco 2811 router. Type in the following commands (comments are made after the ! character:

Router>enable
Router#conf t
!! Change the hostname to R1
Router(config)#hostname R1

!! Create the virtual interfaces for f0/1
R1(config)#int f0/1
R1(config-if)#no shutdown
R1(config-if)#int f0/1.10
R1(config-subif)#ip address 10.10.10.1 255.255.255.0

!! I'm using the 10.0.0.0 network with a /24 subnet mask

R1(config-subif)#int f0/1.20
R1(config-subif)#ip address 10.10.20.1 255.255.255.0

!! Those IP's will be the gateway addresses for the PCs we'll configure later on

Now we move on to the 3560 switch:

Switch>enable
Switch#conf t
!! change the hostname to SW1
Switch(config)#hostname SW1

!! configure the trunk interface to R1
SW1(config)#int f0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q

!! now configure the other ports, f0/2 & f0/3, on vlan 10 & 10 respectively
SW1(config-if)#int f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#int f0/3
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#end

Plug a PC into f0/2 of the switch and configure it with:

IP address: 10.10.10.10
Subnet Mask: 255.255.255.0
Gateway: 10.10.10.1

Plug a PC into f0/3 of the switch and configure it with:

IP address: 10.10.20.10
Subnet Mask: 255.255.255.0
Gateway: 10.10.20.1

Test connectivity between the two computers by issuing a ping to each other. If you get a reply then that means you’ve successfully configured a router on a stick.

Here is the full configuration for my R1:

R1>en
R1#show run
Building configuration...
Current configuration : 874 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!! CUT FOR BREVITY
!
interface FastEthernet0/0
  no ip address
  no ip directed-broadcast
  shutdown
!
interface FastEthernet0/1
  no ip address
  no ip directed-broadcast
!
interface FastEthernet0/1.10
  encapsulation dot1Q 10
  ip address 10.10.10.1 255.255.255.0
!
interface FastEthernet0/1.20
  encapsulation dot1Q 20
  ip address 10.10.20.1 255.255.255.0
!! CUT FOR BREVITY
end
R1#

And the configuration for SW1:

SW1>en
SW1#show run
Building configuration...
Current configuration : 868 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname SW1
!! CUT FOR BREVITY
!
interface FastEthernet0/1
  switchport mode trunk
  switchport trunk encapsulation dot1q
!
interface FastEthernet0/2
  switchport access vlan 10
  switchport mode access
!
interface FastEthernet0/3
  switchport access vlan 20
  switchport mode access
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface GigabitEthernet0/1
!
interface Vlan1
  no ip address
!! CUT FOR BREVITY
!
end
SW1#

What are your thoughts on the router on a stick? Do you have any input/questions/improvements?

Share and Enjoy:
  • Twitter
  • Facebook
  • del.icio.us
  • Digg
  • Google Bookmarks
  • Print
  • email

Related posts:

  1. Virtual LANs Notes
  2. 5 Easy Steps to Securing Your Cisco Switch or Router
  3. User VLAN Do Not Acquire DHCP Address
  4. CCNA Notes on the Basics of WANs

  • nieca
    and how to enable Internet access for Vlan10 and Vlan20?
  • Hi Nieca,

    You would have to set a default route on your router to the next hop IP address to the Internet or set a static route. Hope that gets you in that right direction.
blog comments powered by Disqus

Previous post:

Next post: