MultiLayer Switching (MLS) is a key component of high performance at Layer 3 with the Catalyst 5000 switches. It also is a marvelous opportunity to review what happens when packets pass through a router. Understanding this is very useful in understanding router and switch performance optimization(s), also in troubleshooting network design and configuration issues.
Once again, for the ultimate reference on this sort of thing, I'm going
to refer you to the book by Mentor Technologies' Kennedy Clark and Kevin
Hamilton: CCIE Professional Development: Cisco Lan Switching (The
Cisco Press CCIE Professional Development Series) . This article is (as always)
going to try to briefly give you the idea of what's going on and how
to configure it, without getting bogged down in too many details. There is
also a chapter and lab on this topic in the BCMSN switching course, which
Mentor Technologies has been teaching since September. (I hear most Training
Partners are stuck on the less useful old CLSC course, at least until January
2000).
Prior articles on switching or related topics:
The particular form of Layer 3 switching (hardware-assisted routing) we'll be looking at is implemented with the Netflow Feature Card (NFFC) functionality in Catalyst 5000 series switches. This requires that you have either the Supervisor III engine with NFFC daughter-board, or the Supervisor IIG or IIIG card (no daughter-board required). It also requires that you have either a suitable external router or the internal Route-Switch Module (RSM) blade (or Route-Switch Feature Card -- RSFC -- with the Sup IIG or IIIG blade). Suitable external routers are those implementing the router component of MultiLayer Switching, which is now all the models of larger size / more capability, equipped with an IOS image that is MLS-capable. The online documentation specifies that this is the Cisco 7500, 7200, 4700, 4500, or 3600 series router with an IOS image that supports IP MLS. (IPX MLS is also available, but of less general interest. Ditto, IP multicast MLS).
The MLS functionality is also supported (with greater simplicity, and fewer configuration options) in the 6000 series!
To understand what's going on, let's first talk through what happens when a packet is forwarded by a router. There's lots that goes on in addition to what follows, but let's not muddle things with unrelated detail. These steps are the ones we're interested in:
The key operation that is needed to understand MLS is the de-encapsulation / re-encapsulation. The router strips off the old Layer 2 header, slaps on the new one, and queues the packet for transmission. The Layer 2 headers are per-hop (from router to router across a subnet). The MAC addresses in those Layer 2 headers are per-hop, local to the Layer 2 segment (broadcast domain; VLAN). IP addresses in the Layer 3 IP header are end to end: the ultimate sender and recipient.
In doing MLS, a NFFC switch blade (or Supervisor IIG / IIIG with built-in comparable functionality) is doing the job of emulating the router, without actually sending the packets to the router. In order to simulate a router transparently, the NFFC has to de-encapsulate and re-encapsulate the packet, and also re-calculate the Layer 2 checksum (FCS).
A requirement for the MLS functionality to work is that you enable it in both the participating router and switch components. (With the 6000, MLS on the switch is enabled by default, and is only disabled when you disable MLS on the switch router component, the MSM or MSFC). Furthermore, MLS only applies to packets where the switch is in position to observe the packet before and after it passes through the router. See the figure below.
My analogy for MLS is a manager with a smart assistant. The manager and assistant agree that certain responsibilities are delegated to the assistant. When the assistant observes how the manager handles certain tasks, the assistant will step in and imitate the manager's previous decision(s). The manager agrees to this, and will let the assistant know when the policy changes.
In the case of MLS, the router is the manager, with packet switching at Layer 3 being delegated to the switch. When a packet passes through the switch, the switch snoops (in effect) to see what the router does with the packet. As it comes back through the switch (post-router, after de-encapsulation and re-encapsulation), the switch learns the new Layer 2 header. When subsequent packets reach the switch bound for the same IP destination, the switch can then just imitate the router, by replacing the Layer 2 header with the cached (stored) Layer 2 header, just as the router previously did. If routing changes, the router does need to notify the switch, which flushes the cached Layer 2 header, since a new routing policy is now in effect.
I hope you're wondering, "but switches make forwarding decisions based on MAC addresses". True! When does a router get involved in forwarding packets? When they are headed for a different subnet. Within the same subnet, MAC address is all that is relevant. That's where switches forward -- within the same VLAN. But when a PC or host computer is sending to another subnet, it does something differently. The destination MAC address is no longer that of the destination computer. It is instead the MAC address of the default gateway router interface.
This is another function of enabling MLS in the router. It can in effect tell the switch (or we can configure into the switch) the MAC address of the router. The switch needs to know that the router's MAC address is special. The frames sent to that MAC address are the frames where the switch needs to subsequently snoop to "observe" the router's imposition of a new Layer 2 header!
Let's re-visit this in more detail now.
Now suppose a host or PC attached to the MLS switch sends a packet destined for a different subnet. Assuming that the MLS-RP is also the PC's default gateway, the switch observes that the router's MAC address is the destination of the Layer 2 frame. Since the router is a MLS-RP, the switch checks its cache, to see if it already knows what to do for packets from that flow (we'll talk about flows later). If there is a cache entry, the switch replaces the Layer 2 header, then uses normal switching procedures to deliver the frame (Layer 2 destination MAC lookup and forwarding).
If there is no cache entry, the switch creates a temporary cache entry, a place holder for when the post-router frame is seen. (A candidate cache entry). The switch forwards the frame to the router. The router does its thing. The frame comes back to the switch (different VLAN, same switch). The switch sees the candidate entry, records the Layer 2 header in the cache. And forwards the frame.
Subsequently, packets from the same flow have Layer 2 headers rewritten (and checksums recalculated and rewritten) by the switch hardware, and are forwarded without actually having gone through the router.
Should a router get disconnected from the switch, the XTAG provides a fast way for the switch to invalidate entries learned from a particular router.
interface fastethernet 0/0Note that we've made the subinterface (101 or 105) match the VLAN number in the encapsulation isl (or dot1q) statement. This convention means not having to track which subinterface goes with which VLAN. A best practice!
no ip addressinterface fastethernet 0/0.100
encapsulation isl 100
ip address 172.16.1.1 255.255.255.0interface fastethernet 0/1.105
encapsulation isl 105
ip address 172.16.5.1 255.255.255.0
The "encapsulation isl" and the subinterfaces is your clue that this router thinks the FastEthernet is a trunk and that it is doing ISL VLAN's.
interface vlan 100Referring to the above figure, the trunk in the picture is now instead the internal backplane of the switch. Both the router and switch components are inside the chassis.
ip address 172.16.1.1 255.255.255.0interface vlan 105
ip address 172.16.5.1 255.255.255.0
mls rp ipIf the switch has a VTP domain, the MLS physical (primary) interface must agree:
interface fastethernet 0/0You then enable MLS per interface:
mls rp vtp-domain domain-name
interface fastethernet 0/0.100You also need one interface which is connected to the switch set up as the MLS management interface:
mls rp ip
interface fastethernet 0/0.100If the external router has only non-trunk links to the switch, you need to configure an associated VLAN id with each:
mls rp management-interface
interface ethernet 0(With trunk interfaces, the ISL or 802.1q tag provides VLAN info, needed in the MLS-RP hello).
mls rp vlan-id 100
mls rp ipinterface vlan 100
mls rp vtp-domain domain-name
mls rp ipinterface vlan 105
mls rp ip
mls rp management-interface
set mls enableWith an external router, you need to tell the switch the router's IP address:
set mls include ip-address(where ip-address is the address shown on the router with the " show mls rp" command).
interface vlan 100
no mls ip
If you want, you can configure the switch to force it to cache more specifically. This may impact performance, and would be a fairly odd thing to configure. For instance, with no access lists on the router component, you could configure the switch component to force at least source-destination-ip mask:
set mls flow destination-sourceThe other keyword options for minimal flow mask are destination and full, corresponding to destination-ip and ip-flow above.
There is also a "clear mls" command (or set of commands).
You can configure cache aging time, which is how long an idle period between packets before a cache entry ages out. You can also tweak the fast aging time, which is the length of time a new entry stays in the cache if the configured switch packet threshold isn't passed. (The idea is to conserve resources by using cache entries for flows with many packets. Those with few packets fail to meet the packet threshold and so their cache entry gets dropped more quickly).
There are also a number of fine points to MLS behavior, some caveats (warnings), and some situations where MLS becomes disabled. For details on all these, see the documentation.
I'm still considering doing an article on switched network design. See you in a month!
Dr. Peter J. Welcher (CCIE #1773, CCSI #94014) is a Senior Consultant with Chesapeake NetCraftsmen. NetCraftsmen is a high-end consulting firm and Cisco Premier Partner dedicated to quality consulting and knowledge transfer. NetCraftsmen has nine CCIE's, with expertise including large network high-availability routing/switching and design, VoIP, QoS, MPLS, network management, security, IP multicast, and other areas. See http://www.netcraftsmen.net for more information about NetCraftsmen. Pete's links start at http://www.netcraftsmen.net/welcher . New articles will be posted under the Articles link. Questions, suggestions for articles, etc. can be sent to pjw@netcraftsmen.net .