Home > Articles > CompTIA > Network+

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:

Rack15SW4#show VLAN
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/18, Gi0/1, Gi0/2

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:

Rack15SW4#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Rack15SW4(config)#interface FastEthernet0/15
Rack15SW4(config-if)#switchport access VLAN 2
% Access VLAN does not exist. Creating VLAN 2
Rack15SW4(config-if)#end

Observe that the switch actually creates VLAN 2 for use. This can be seen by looking at the output of show VLAN again:

Rack15SW4#show VLAN 
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/16, Fa0/17, Fa0/18
                                                Gi0/1, Gi0/2
2    VLAN0002                         active    Fa0/15

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:

Rack15SW4#show run interface VLAN 1
Building configuration...
Current configuration : 48 bytes
!
interface Vlan1
 no ip address
 shutdown
end

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:

Rack15SW4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Rack15SW4(config)#ip default-gateway 10.10.10.254
Rack15SW4(config)#end

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:

Rack15SW4(config)#interface FastEthernet0/15
Rack15SW4(config-if)#speed 10
Rack15SW4(config-if)#duplex half 
Rack15SW4(config-if)#end

We can see the effects of this configuration using the following show command:

Rack15SW4#show interfaces FastEthernet0/15
 <output omitted>
  Half-duplex, 10Mb/s, media type is 10/100BaseTX
 <output omitted>

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.

Pearson IT Certification Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Pearson IT Certification and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Pearson IT Certification products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.pearsonitcertification.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020