

now on the router i configure 2 sub-interfaces- one using dot1q 2 and the other using dot1q 3. now my trunk link connecting the switch and the router uses dot1q. I just don’t know how any help would be appreciated )ġ. I just did the router-on-a-stick lab and works well with two PCs as hosts.īut I couldn’t make work using two routers acting as hosts, as instructed I added the default gateway to the routers but no luck (the only way that I could make it work was by running rip an all 3 routers.But I think I can do it without running rip. Therefore, if the router is low-end model with not much bandwidth performance and also if the interface is just a simple old 10/100 Mbps interface, then you might have traffic problems (especially if the VLANs have lots of traffic between them). Note however that all traffic between the VLANs will pass through the single physical interface of the router. With this scenario you can provide Layer3 routing between two or more Layer2 VLANs which exist on the switch. The “ Router on a Stick” configuration is useful in situations where there is no Layer3 switch available and the only networking equipment you have are a router and a Layer2 switch. The numbered ACL 101 allows all traffic from host 10.10.10.10 to reach host 20.20.20.10 and denies everything else (note that in ACLs there is an implicit “deny all” at the end of the access-list). If you want to restrict traffic between the two VLANs, you can do so using Access Control Lists applied to the subinterfaces of the router.įor example, if you want to allow only host 10.10.10.10 to communicate with host 20.20.20.10 then you can create the following ACL and apply it to the router as shown below: Now, in order for the two hosts to communicate between them, they must set as default gateway the IP address of the corresponding router subinterface address (e.g for host in VLAN 10 the gateway must be 10.10.10.2 and for host in VLAN 20 the gateway must be 20.20.20.2). This command should not be used if the interface is connected to another switch in order to avoid possible spanning-tree loops.

The “ spanning-tree portfast trunk” command on interface FastEthernet1/0/1 is used to bypass spanning-tree delay when connecting the interface to the router. (config-if)# description connection-to-GREEN-VLAN (config-if)# description connection-to-RED-VLAN (config-if)# spanning-tree portfast trunk (config-if)# switchport trunk encapsulation dot1q (config-if)# description trunk-to-router-on-a-stick Lets see the configuration below: SWITCH CONFIGURATION The switch port connected to the router must be a trunk port in order to be able to carry both VLANs towards the router port. The Router interface can be divided into two subinterfaces, with each subinterface belonging to the appropriate VLAN. The router uses just a single interface connected to a trunk port on the switch. In our example we use a router to provide Layer 3 connectivity as shown in our diagram. This can be accomplished either if the switch is Layer 3 (using Layer3 InterVLAN Routing) or if there is a router in place. Thus, if we want to provide network connectivity between the two VLANs we need to have a Layer 3 engine somewhere in the network. The first host belongs to Network 10.10.10.0/24 (VLAN10) and the second one to 20.20.20.0/24 (VLAN20).īy default, if the switch is just a normal Layer 2 switch the two hosts can not communicate between them because they belong to different VLANs and there is no routing. The two ports of the switch with the hosts connected to them (FE1/0/2 and FE1/0/3) must be access ports. Lets see the diagram below to get us started:Ī Cisco Layer 2 switch carries two VLANs (VLAN 10 – RED and VLAN 20 – GREEN) with two hosts connected to them as shown on the diagram above. This configuration is usually asked as a question in CCNA exams, so I hope it will be helpful for people preparing for certification.
#Cisco router on a stick with nat how to#
In this post I will explain how to provide routing between two VLANs on a simple Layer 2 switch using a Cisco router with just one interface.
