Now I will be able communicate between the hosts in the 2 VLANs. Once the hosts are configured with valid IP addresses and subnet masks (as shown in the diagram) they are given the default gateway of the IP address that the sub-interface was configured with. Router2(config-subif)# encapsulation dot1Q 128 Router2(config)# interface fastEthernet 0.128 You can add a 'preempt' option to force the IP back to the priority router after the failure has been corrected, otherwise the IP will stay on the secondary router until another failure occurs. Router2(config-subif)# encapsulation dot1Q 64 The router with the higher priority will keep the gateway IP address unless there some sort of failure. Router2(config)# interface fastEthernet 0.64 I also configure the sub-interfaces to support dot1q trunking. I name these the same as the VLANs, again to keep thing simple. On Router2 I create 2 sub-interfaces off the FastEthernet interface (fa0). Port Vlans in spanning tree forwarding state and not pruned Port Vlans allowed and active in management domain Port Mode Encapsulation Status Native vlan
This tells me which interfaces are trunking and for which VLANs. I check the configuration using a show command. R3conf t R3(config)no ip routing R3(config)interface f0/0 R3(config-if)ip address 192.168.20.254 255.255.255.0 R3(config-if)no shut R3(config-if)exit R3(config)ip default-gateway 192.168.20. Switch2(config-if)# switchport mode trunk
Switch2(config)# interface fastEthernet 0/2
#Router on a stick config cisco full#
I also configure the port to be fixed at 100Mb full duplex. On switch2 I configure the port that will be connected to the router as a trunk port. Switch1(config-if-range)# switchport access vlan 128 Switch1(config)# interface range fastEthernet 0/17 - 23 Switch1(config-if-range)# switchport access vlan 64 Switch1(config)# interface range fastEthernet 0/9 - 16
I have named the VLANs to be the same as the networks to keep things simple.Įnter configuration commands, one per line. Two sub-interfaces are created on Eth1/0/0 of the router and assigned IP. These commands will also create the VLANs because the don't already exist. AR1200-S, AR2200-S, and AR3200-S CLI-based Typical Configuration Examples. To begin with I will configure the ports on Switch1 to be in the correct VLANs. This subinterface uses the 802.1q tagging protocol Router(config-subif) ip address 192.168.10.1 255.255.255. To do this my router and switch must use a fastethernet port running at 100Mb full duplex. Router(config-subif) encapsulation dot1q 10 Assigns VLAN 10 to this subinterface. My goal is for UserA in VLAN 64 to communicate with UserB in VLAN 128. If, for some reason, the native VLAN on the switchport is something other than one (1), change the encapsulation statement on the router, or the trunk may not form.In this post I will configure a router to route traffic between VLANs using just one router interface, this is commonly referred to as a Router on a Stick.īelow is a diagram of the network I'll be working with in this post. Now, we will configure the switchport to connect to the router:Īt 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.
VLAN 1 exists by default, so we will add a couple of other VLANs: This configuration is known as a router-on-a-stick.įirst, let us start with the switch. You can connect a Cisco switch and router via 802.1q trunking.