What?! Single one LAN interface to service 3 VLANs? Yes, no problem! We only have to configure it with new commands we have not learned!
Remember that in a trunk connection among switches, we have to "tag" every frame so switches can tell which frame belongs to which VLAN. If a router can also recognize and add the same tags just like switches, we can make this router "virtually" connect to all the VLANs on the switches, and thus providing across VLAN routing, using single physical LAN interface!
We usually call such router a nick name: "Router on a stick". That is, a (LAN) router with only one interface (leg)!
Since VLAN tagging is a hardware functionality, we have to remember in mind that not all routers and not all LAN interface card can support this function: router's LAN interface has to be at least 100Mbps (FastEthernet, in Cisco's term). If your router is bought recently, such as the new ISR (Integrated Service Routers) models, then this requirement is quite enough.
Our "Router on a stick" routes packets among sub-interfaces. Each sub-interface stands for a logical (virtual) interface plugged in a VLAN. The configuration is like this:
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.100
encapsulation dot1Q 10
ip address 172.17.10.1 255.255.255.0
!
interface FastEthernet0/0.200
encapsulation dot1Q 20
ip address 172.17.20.1 255.255.255.0
!
interface FastEthernet0/0.300
encapsulation dot1Q 30
ip address 172.17.30.1 255.255.255.0
!
The numbers after "encapsulation dot1q 10", "encapsulation dot1q 20", and "encapsulation dot1q 30" are exactly the VLAN's ID number, used in 802.1Q tagging.
However, the number of sub-interface has no special meaning at all. I intentionally choose different sub-interface numbers (100, 200, 300) from VLAN numbers in this example.
We also have to do some configuration on switch side. We have to configure the switch port connected to the router as "Trunk mode". Router needs this to receive and send frames from and to different VLANs.
interface FastEthernet0/11
switchport mode trunk
!
"Router on a stick" in fact solves one additional problem: scalability. No matter across how many VLANs we have to route packets, we always need only one physical LAN interface!
Consider this then you will see the problem: suppose we have to provide routing among 100 VLANs and without this function, we would be in serious trouble finding a router with 100 LAN interfaces!
The example trunk port at switch S1 should be Fa0/11. I corrected it right inside the post.
ReplyDeleteinterface FastEthernet0/11
switchport mode trunk
!