** NOTE ** – You don’t need to configure router on a stick if you have a layer 3 switch.
Router on a stick is a way to get VLAN’s talking to each other by routing data between the VLAN networks. Here are some of the gotchas in point form for Router on a stick:
- You need to have at least one switch segmented into two different VLANS
- You need a router with a FastEthernet or Gigabit port. Ethernet (10MB/sec) will not work.
- Trunking protocol on the switch must match the trunking protocol on the router (ISL or Dot1Q)
- The Router will use sub-interfaces… More on this later
- You have to run the encapsulation command first.
- Make sure that you run “no shut” on the ports used on the router. They are closed by default unlike a switch.
- The hosts must have their default gateway changed to the sub-interface on the router.
Here’s what the packet tracer lab will look like:
You can download the Cisco Router on a stick lab.
In order to set this up we are going to use two networks. Note – For ease I decided to match the 3rd octet to the VLAN. If you are creating a network from scratch doing something like this makes it much easier for you know what VLAN a particular host will be in:
- 192.168.1.0 /24 (Default VLAN)
- 192.168.2.0 /24 (VLAN 2)
- 192.168.4.0 /24 (VLAN 4)
Couple of things to note:
- There are three hosts connected to the switch. Each one is in a different subnet but do not currently have their Default gateways installed.
- Nothing is setup on the switch or the router
Setup the Cisco Switch
- conf t
- int fast 0/24
- switchport mode trunk
- int fast 0/2
- switchport access vlan 2
- int fast 0/3
- switchport access vlan 4
- exit
- exit
- show vlan brief
- wr
Setup the Cisco Router
We need to start with the router for this setup. Here are the commands we will need to use:
Change the fast 0/0 port on the router to up
- conf t
- int fast 0/0
- ip address 192.168.1.254 255.255.255.0
Setup both sub-ports
- int fast 0/0.2
- encap dot1q 2 <— We’ve just told to encapsulate the sub interface and to use VLAN 2
- ip address 192.168.2.254 255.255.255.0
- int fast 0/0.4
- encap dot1q 4 <— We’ve just told to encapsulate the sub interface and to use VLAN 4
- ip address 192.168.4.254 255.255.255.0
- exit
- wr
Setup the Hosts
- Make sure each of the hosts has the Default Gateway pointing to the sub-interface that you created on the Cisco router that is in it’s VLAN.
- 192.168.1.10 /24 gateway will be 192.168.1.254
- 192.168.2.10 /24 gateway will be 192.168.2.254
- 192.168.4.10 /24 gateway will be 192.168.4.254
Test it Out!
- You should be able to ping all hosts on the network.
- You should be able to ping the router port and sub-ports from any machine.
Leave a Reply