Typical Switch Setup for CompTIA Network+

Transparent switches are a major part of any sized modern network. These devices find their way into the access layer, and even the core layers of network infrastructures. This important article details the basic setup of one of these important devices, and describes key concepts such as VLANs and management interfaces that any Network + candidate should master.

Like this article? We recommend

Like this article? We recommend

There is nothing like getting a new switch shipped to your desk. The smell of the packing peanuts and the static resistant wrapping material is enough the make the head swim with excitement. Well in all honesty, that is all very cool, but does not really compare to the exhilaration of powering it up, connecting the serial cables to your trusty admin machine, and bending it to your will. Okay you get the idea, you just got a new device, and you need to set it up so that it can fit into your networking environment. We are going to discuss typical things that will or should be done to get a switch ready for your infrastructure. The news here is that unlike routers, switches offer a wide range of services and capabilities right out of the box. This means that switches are virtually plug and play devices; but just like everything else in the technology world, there comes a time when all the automatic features and capabilities under the sun just are not going to be enough; as engineers, we need to step up and take control. We are going to look at the most basic configurations, commands and verifications we will need to get started.

VLANs

Almost everyone has heard of a LAN or local area network, but if you have not, a good working definition of a LAN is a group of devices that operate in a single broadcast domain. This is an important definition, especially for aspiring network engineers, because it gets the very heart of the nature of the two principle devices used in networking, routers stop broadcasts and switches forward them. But now we are going to put a very creative spin on the generic notion of a LAN. Many higher end switches support the capability to assign groups of ports into what are called VLANs. In effect, a VLAN in a virtual broadcast domain created by a switch itself. Administrators can assign ports on a switch to many different VLANs, or to just one.

In fact, there is already a notion of a “default VLAN” in Cisco switches the default VLAN is VLAN 1. This means that by default a new switch will have all of its ports operating in VLAN1. The behavior can be changed base on individual needs in the network. Instances where it may be necessary or advisable to create more than one VLAN on a switch would be:

There are more than 200 devices on the LAN

There is a tremendous amount of broadcast traffic on the LAN (like in stock trading environments)

Where groups of users need to be isolated from the general users for security purposes

Where groups of users need to be in separate broadcast domains using different broadcast or multicast applications or appliances

Where a single switch can be divided into two or more virtual switches

The important thing to keep in mind here is that once we change the VLAN on a switchport to another VLAN, that switchport will no longer be able to communicate with the devices in any other VLAN. Below we can see an example of a default VLAN configuration:

We see what ports are operating in the default VLAN, we see the VLAN, the name and the status of the VLAN. At this point we could place any of these ports into a different VLAN by going to the interface and assigning any VLAN other than 1:

Now there are two VLANS, the original default VLAN of 1 and now VLAN 2. In effect we now have two switches; one with 18 ports (VLAN1) and one with 1 port (VLAN2).

Management Interface

Now is the perfect time to think about how we are going to manage our switch. Right now we have a serial cable connected from a laptop directly to the switch. This is more often than not how a switch will be initially configured. But when you take into account the fact that we have hundreds of switches in dozens of locations in a campus, traveling to each individual device to do normal maintenance and configuration isto say the leastimpractical.

The answer to this problem is to be able to remotely manage our switches over the network. Just like computers and servers need IP addresses to operate on the LAN, our switches are no different. We need to keep in mind that if we have multiple VLANs on a switch and we want to be able to manage the switch from each of these VLANs it will be necessary to configure an interface with an IP address from each of the separate networks. In our case we are only going to focus on the default VLAN.

To manage a switch using VLAN 1, or any VLAN for that matter, we need to configure an interface that will support the assignment of an IP address. In the case of the default VLAN, our Cisco switches provide an interface for this purpose by default:

This interface is called a Switched Virtual Interface, because it does not have a corresponding physical port on the device. But once an address is assigned and the port is in the “no shutdown” mode, it can be used to telnet to the switch remotely, a very useful and powerful tool when it comes to efficiently managing our devices.

Default Gateway

If you need to communicate to a switch using a different subnet, it will be necessary to configure a default gateway on the switch. This instructs the switch on how to reach its local LAN switch, and it is only used when a switch is not configured for IP routing. For the purposes of this article we are looking at only the Layer 2 capabilities of the switch. To assign a default gateway you would use the following commands:

PortFast

A switch provides connectivity at the data link layer, not at the physical layer and as such can and will introduce delays when you connect a device to it. This delay is caused by the time it takes the switch to decide if packets it receives on a port need to be transmitted out other ports. The bridging algorithm used by Cisco switches is susceptible to physical loops in the network topology. Because of this susceptibility to loops, switches run Spanning-tree Protocol (STP). STP eliminates the possibility of loops in a topology. When you run STP, all ports that are included in the spanning tree process become active slowly as STP detects and blocks loops. How does this process take place?

After a port on a switch initialized and seen a link connection, STP runs on that port. A port that runs STP can be in one of five states:

blocking STP dictates that ports start out in this state, and will remain so for 20 seconds. While blocking the port does not send or receive user data in order to eliminate loops.

listeningIn this state the switch tries to determine where the port fits in the spanning-tree topology. If a loop is found the port returns to the blocking state. This stage lasts 15 seconds by default.

learningIn this state the port learns which MAC addresses are connected to this port.

forwarding  In this state the port works as expected and forwards packets. STP still monitors incoming BPDUs that would indicate it should return to the blocking state to prevent a loop.

disabled  Not strictly part of STP, a network administrator can manually disable a port.

This means that apart from the blocking stage the entire STP initialization process takes 30 seconds by default. This is a long time to wait when you consider how fast modern Operating Systems boot. IOS provides a solution for this problem called PortFast.

If you connect just one device with a single network interface card to a switch it is impossible for a physical loop to form. This type of connection is called a leaf node. There is no reason to make these leaf node devices wait 30 seconds while the switch checks for loops that can never form. Applying PortFast to a given interface forces STP to assume that the port is not part of a loop and immediately moves to the forwarding state and does not go through the blocking, listening, or learning states. Please note that this command does not turn deactivate STP. This command makes STP skip any unnecessary steps on the selected port. PortFast operation can be configured at both the global and interface configuration levels like so:

Rack15SW4(config)#spanning-tree portfast default
%Warning: this command enables portfast by default on all interfaces. You
should now disable portfast explicitly on switched ports leading to hubs,
switches and bridges as they may create temporary bridging loops.
Rack15SW4(config)#
At interface level the command would look like the following:
Rack15SW4(config)#interface FastEthernet0/15
Rack15SW4(config-if)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/15 but will only
have effect when the interface is in a non-trunking mode.
Rack15SW4(config-if)#exit

The impact of activating the PortFast feature is so significant that the IOS warns clearly that what we are doing could lead to the creation of a bridging loop if done incorrectly.

Port Speed and Duplex

The role of a switch revolves around connecting a device to a LAN, and there are a huge number of devices that may need connecting. These devices may have different operational characteristics. Some devices operate at 10Mbps while others at 100Mbp and some at 1Gbps additionally duplex operation has a significant impact on a switch. Older and slower devices always seem to find a way of getting connected to networks, and bring with them issues that cause problems with Cisco default auto negotiation, most notably the negotiation of speed and duplex settings. In these situations, we will want to manually change these settings on a port-by-port basis:

Conclusion

Switches are very feature rich devices that provide a tremendous amount of capability “out of the box.” But this also means that there is a significant amount of knowledge required of us as administrators to manipulate how they operate. An understanding of the basics of switch operations will better allow us to understand why a specific behavior is taking place in our network, as well as give us a starting point to manipulate default operation.