9.8 The Benefits of Virtual LANs (VLANs)
9.8.3 Routing and VLANs
Just like subnetworks, (remember subnetworks = VLANs) a router is needed to route information between different VLANs. There are several different ways to do this with the router.

One way is to have a router with a separate Ethernet interface for every VLAN (i.e. subnetwork). Figure shows the router with two Ethernet interfaces. The Ethernet 0 interface is configured with an IP address of 172.30.1.1/24 and will be a member of VLAN 1 on the switch, while the Ethernet 1 interface is configured with an IP address of 172.30.2.1/24 and will be a member of VLAN 2 on the switch.

Figure shows how the switch and router interconnect.

If information is needed to be sent from a host on one VLAN (subnetwork) to a host on another VLAN (subnetwork), these packets will need to be sent to and routed through the router.

Note: The router must be running a routing protocol to route between the two subnetworks.

Example:

Router(config)# router rip
Router(config-router)# network 172.30.0.0

One of the disadvantages to this type of router configuration is that the router must have a separate Ethernet interface for every VLAN (subnetwork). This may not scale well for networks with a lot of different VLANs. One solution to this problem is to use “Router-on-stick” or “One-Armed-Router” (OAR).

With the Router-on-stick method, only one physical Ethernet interface is used. The physical interface is divided into sub-interfaces, one for each VLANs (subnetworks). (Note: You may use secondary addresses instead of sub-interfaces to accomplish this, but secondary addresses will eventually be no longer supported in future versions of the Cisco IOS.)

Notice that with the use of Router-on-a-stick, that only one physical interface is need. The disadvantage to this is that this single link between the router and the switch will be used for all VLAN traffic to and from the switch. The port on the switch which is connected to the router’s Ethernet interface will also need to be capable of doing “trunking,” either with Cisco’s proprietary ISL (InterSwitch Link) or IEEE 802.1Q.

Here is the router configuration (also shown in Figure ):

Router# config t
Router(config)# interface ethernet 0.1

Router(config-subif)# ip address 172.30.1.1 255.255.255.0
Router(config-subif)# encapsulation isl 1 {1 = VLAN 1}

Router(config-subif)# no ip redirects {recommended}
Router(config)# interface ethernet 0.2
Router(config-subif)# ip address 172.30.2.1 255.255.255.0
Router(config-subif)# encapsulation isl 2 {2 = VLAN 2}
Router(config-subif)# no ip redirects {recommended}