Saturday, December 17, 2011

Emulating a Managed Switch With Dynamips/GNS3

To clarify one thing at the beginning, there is no version of dynamips or GNS3 currently that has the capability of running a Cisco Switch IOS image. Why is this? Cisco has designed a number of application specific integrated circuits (ASICs) that have not been reversed engineered by the Dynamips team or anyone else in the community to create a viable software emulation. GNS3 and Dynamips are not good testing and training platforms for the CCNA, CCNP, or CCIE switching topics and not good tools for any IT training courses that need to cover switching related exam objectives.

There are ways to perform some of the important features of the layer 2 network that managed switches provide when working with a routed (layer 3) network in GNS3. In this post, I will show how a Cisco c3725 with an NM-16ESW module can be configured to perform specific layer 2 functions such as Spanning Tree Protocol (IEEE [802.1d], but not Rapid STP [802.1w] or Multipe STP [802.1s]), VLANs, VLAN Trunking, VLAN Trunk Protocol (VTP). In all of the examples, I will be working with the following topology using the Advanced Enterprise Services version of 12.4(15)T7,

The connections are configured this way...

S0 - FastEthernet 1/0 S1 - FastEthernet 1/0
S0 - FastEthernet 1/1 S1 - FastEthernet 1/1
S0 - FastEthernet 1/2 S2 - FastEthernet 1/0
S0 - FastEthernet 1/3 S2 - FastEthernet 1/1
S1 - FastEthernet 1/2 S2 - FastEthernet 1/2
S1 - FastEthernet 1/3 S2 - FastEthernet 1/3

Let's get started with the basics of the layer 2 network.

Configuring the NM-16ESW for Switch-mode Operation

Use the switchport command to make the ports switched (rather than routed) ports,
S0(config)#interface range fastethernet 1/0 - 15

Virtual Local Area Networks (VLANs)

VLANs allow broadcast domains to be isolated to specific ports across a number of switches in a layer 2 topology. Multiple VLANs travel across a single link using a trunking protocol such as the industry standard 802.1Q or the Cisco-proprietary Inter-Switch link (ISL). The familiar commands from the global configuration mode of the router are available to configure VLANs and VLAN Trunking Protocol (VTP) settings. In this example I configure 2 VLANS named MikesBlog (10) and Internet (20) on all of the routers. Based on many industry recommendations, I configure the switches to be in VTP transparent mode (effectively disabling VTP on the particular switch, but allowing VTP frames to be forwarded through the switch for switches that support VTP version 2).

;Configuration on S0, this is the same on S1 and S2
S0(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
S0(config)#vlan 10
S0(config-vlan)#name MikesBlog
S0(config-vlan)#vlan 20
S0(config-vlan)#name Internet 

Unlike a switch, there is no show vlan command on the router IOS.     The show vlan-switch command is used instead

S0#show vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/1, Fa1/2, Fa1/3, Fa1/4
                                                Fa1/5, Fa1/6, Fa1/7, Fa1/8
                                                Fa1/9, Fa1/10, Fa1/11, Fa1/12
                                                Fa1/13, Fa1/14, Fa1/15
10   MikesBlog                        active    Fa1/0
20   Internet                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0 

Trunking is different on the router IOS. Dynamic Trunking Protocol     is not supported,  so there is no switchport mode dynamic desirable     or switchport mode dynamic auto command. 

S0(config-if)#switchport mode ?
  access  Set trunking mode to ACCESS unconditionally
  trunk   Set trunking mode to TRUNK unconditionally 

Spanning Tree Protocol

Spanning Tree Protocol was developed to help prevent layer 2 loops within a network that has redundant links. For the c3725 image that I used, the spanning tree mode command was not available, so the only spanning tree mode that is available is 802.1d (known in Cisco IOS as Per-VLAN Spanning Tree, PVST+).

Ultimately, GNS3 and Dynamips are good tools for building and troubleshooting router configurations, but switch configuration testing requires actual Cisco switches. It is possible to connect to a Cisco switch using a host system interface and the cloud object in GNS3. This is a similar technique to this post.

See Also,
Connecting GNS3 and Hyper-V
Router on a Stick with GNS3
The Road to the CCIE 

No comments:

Post a Comment