NET201Lesson3 ConfigureSwitchPortsandPortSecurity
NET201Lesson3 ConfigureSwitchPortsandPortSecurity
In this lesson, you will learn how ports configured to better meet the needs of the network. This includes adjusting port speed,
bandwidth, and security requirements. Port configuration starts with the basics of duplex and speed. Sometimes switch ports must
manually have their duplex mode and speed manually configured. Most of the times the technician simply connects a cable and let the
network device and switch automatically negotiate these parameters. There are also times when things go awry and there are issues.
This lesson helps you with these basic concepts.
Lesson Objectives:
At the end of this lesson, you will be able to:
1. configure switch ports to meet network requirements, and
2. configure the port security feature to restrict network access.
Duplex Communication
Full-duplex communication improves the performance of a switched LAN. Full-duplex communication increases effective
bandwidth by allowing both ends of a connection to transmit and receive data simultaneously. This is also known as bidirectional
communication. This method of optimizing network performance requires micro-segmentation. A micro-segmented LAN is created
when a switch port has only one device connected and is operating in full-duplex mode. When a switch port is operating in full-duplex
mode, there is no collision domain associated with the port.
Unlike full-duplex communication, half-duplex communication is unidirectional. Sending and receiving data does not occur at
the same time. Half-duplex communication creates performance issues because data can flow in only one direction at a time, often
resulting in collisions. Half-duplex connections are typically seen in older hardware, such as hubs. Full-duplex communication has
replaced half-duplex in most hardware.
Gigabit Ethernet and 10Gb NICs require full-duplex connections to operate. In full-duplex mode, the collision detection circuit
on the NIC is disabled. Frames that are sent by the two connected devices cannot collide because the devices use two separate circuits
in the network cable. Full-duplex connections require a switch that supports full-duplex configuration, or a direct connection using an
Ethernet cable between two devices.
Standard, shared hub-based Ethernet configuration efficiency is typically rated at 50 to 60 percent of the stated bandwidth.
Full-duplex offers 100 percent efficiency in both directions (transmitting and receiving). This results in a 200 percent potential use of
the stated bandwidth (Cisco Networking Academy, 2014).
35
Switch ports can be manually configured with specific duplex and speed settings. Use the duplex interface configuration mode
command to manually specify the duplex mode for a switch port. Use the speed interface configuration mode command to manually
specify the speed for a switch port.
In Figure 1-32, port F0/1 on switch S1 and S2 are manually configured with the full keyword for the duplex command, and
the 100 keyword for the speed command.
Auto-MDIX
As shown in Figure 1-33, some switches have the automatic medium-dependent interface crossover (auto-MDIX) feature that
allows an interface to detect the required cable connection type (straight-through or crossover) and configure the connection
appropriately.
Figure 1-34 illustrates how verify auto-MDIX in Cisco switch. Using the command show controllers Ethernet-controller
verifies the auto-MDIX settings
36
Figure 1-36 shows an example of show interfaces and show running-config command output. The CLI example
shows counters and statistics for the FastEthernet0/1 interface.
Figure 1-36. Example of show interfaces and show running-config commands output
Some media errors are not severe enough to cause the circuit to fail, but do cause network performance issues. Figure on the
left explains some of these common errors which can be detected using the show interfaces command.
37
The input errors are the sum of all errors in datagrams that were received on the interface being examined. This includes runts,
giants, CRC, no buffer, frame, overrun, and ignored counts. The reported input errors from the show interfaces command include
the following:
a) Runt Frames - Ethernet frames that are shorter than the 64-byte minimum allowed length are called runts. Malfunctioning
NICs are the usual cause of excessive runt frames, but they can also be caused by collisions.
b) Giants - Ethernet frames that are larger than the maximum allowed size are called giants.
c) CRC errors - On Ethernet and serial interfaces, CRC errors usually indicate a media or cable error. Common causes include
electrical interference, loose or damaged connections, or incorrect cabling. If you see many CRC errors, there is too much noise
on the link and you should inspect the cable. You should also search for and eliminate noise sources.
The output errors is the sum of all errors that prevented the final transmission of datagrams out the interface that is being examined.
The reported output errors from the show interfaces command include the following:
d) Collisions - Collisions in half-duplex operations are normal. However, you should never see collisions on an interface
configured for full-duplex communication.
e) Late collisions - A late collision refers to a collision that occurs after 512 bits of the frame have been transmitted. Excessive
cable lengths are the most common cause of late collisions. Another common cause is duplex misconfiguration. For example,
you could have one end of a connection configured for full-duplex and the other for half-duplex. You would see late collisions
on the interface that is configured for half-duplex. In that case, you must configure the same duplex setting on both ends. A
properly designed and configured network should never have late collisions.
SSH Operation
Secure Shell (SSH) is an alternative protocol to Telnet. Telnet uses unsecure plaintext of the username and password as well
as the data transmitted. SSH is more secure because it provides an encrypted management connection. A switch must have an IOS
version (k9 at the end of the IOS file name) that includes cryptographic capabilities in order to configure and use SSH. Figure 1-37
shows the use the show version command to see the IOS version.
Figure 1-37. use the show version command to see the IOS version
Configuring SSH
Before configuring SSH, the switch must be minimally configured with a unique hostname and the correct network connectivity
settings.
Step 1. Verify SSH support. Use the show ip ssh command to verify that the switch supports SSH. If the switch is not running an
IOS that supports cryptographic features, this command is unrecognized.
Step 2. Configure the IP domain. Configure the IP domain name of the network using the ip domain-name domain-name global
configuration mode command. In Figure 1-38, the domain-name value is cisco.com.
Step 3. Generate RSA key pairs. Not all versions of the IOS default to SSH version 2, and SSH version 1 has known security flaws. To
configure SSH version 2, issue the ip ssh version 2 global configuration mode command. Generating an RSA key pair automatically
enables SSH. Use the crypto key generate rsa global configuration mode command to enable the SSH server on the switch and generate
an RSA key pair. When generating RSA keys, the administrator is prompted to enter a modulus length. The sample configuration in
Figure 1 uses a modulus size of 1,024 bits. A longer modulus length is more secure, but it takes longer to generate and to use.
38
Note: To delete the RSA key pair, use the crypto key zeroize rsa global configuration mode command. After the RSA key pair is deleted,
the SSH server is automatically disabled.
Step 4. Configure user authentication. The SSH server can authenticate users locally or using an authentication server. To use the
local authentication method, create a username and password pair using the username username secret password global
configuration mode command. In the example, the user admin is assigned the password ccna.
Step 5. Configure the vty lines. Enable the SSH protocol on the vty lines using the transport input ssh line configuration
mode command. The Catalyst 2960 has vty lines ranging from 0 to 15. This configuration prevents non-SSH (such as Telnet) connections
and limits the switch to accept only SSH connections. Use the line vty global configuration mode command and then the login
local line configuration mode command to require local authentication for SSH connections from the local username database.
Step 6. Enable SSH version 2. By default, SSH supports both versions 1 and 2. When supporting both versions, this is shown in
the show ip ssh output as supporting version 1.99. Version 1 has known vulnerabilities. For this reason, it is recommended to enable
only version 2. Enable SSH version using the ip ssh version 2 global configuration command.
Verifying SSH
On a PC, an SSH client, such as PuTTY, is used to connect to an SSH server. For the examples in Figures 1-39, the following
have been configured:
SSH enabled on switch S1
Interface VLAN 99 (SVI) with IP address 172.17.99.11 on switch S1
PC1 with IP address 172.17.99.21
Figure 1-39. Configure PuTTY with SSH client connection parameters and remote
management SSH connection
To check the SSH connections to the device, use the show ssh command
(see Figure 1-40).
39
Figure 1-40. Verify SSH Status and Settings Packet Tracer Activity
Port security is the process of enabling specific commands on switch ports to protect against unauthorized wired devices being
attached to the network. An easy way for an intruder to gain access to a corporate network is to plug into an unused Ethernet jack or to
unplug an authorized device and use that connector. Cisco provides ways to protect against such behavior.
As part of the DHCP configuration process, switch ports can be identified as trusted and untrusted. Trusted ports can source any type of
DHCP message; untrusted ports can source DHCP requests only. This configuration protects the network from someone attacking a device by acting
as a rogue DHCP server as shown in Figure 1-42.
Note on a switch port, switchport port-security commands will not function until port security is enabled.
Learned dynamically, converted to sticky secure MAC addresses stored in the running-config.
Removed from the running-config if port security is disabled.
Lost when the switch reboots (power cycled).
Saving sticky secure MAC addresses in the startup-config makes them permanent, and the switch retains them after a
reboot.
41
Disabling sticky learning converts sticky MAC addresses to dynamic secure addresses and removes them from the
running-config.
An interface can be configured for one of three violation modes, specifying the action to be taken if a violation occurs. Figure
1-43 presents which kinds of data traffic are forwarded when one of the following security violation modes are configured on a port:
1. Protect: When the number of secure MAC addresses reaches the limit allowed on the port, packets with unknown source
addresses are dropped until a sufficient number of secure MAC addresses are removed or the number of maximum
allowable addresses is increased. There is no notification that a security violation has occurred.
2. Restrict: When the number of secure MAC addresses reaches the limit allowed on the port, packets with unknown source
addresses are dropped until a sufficient number of secure MAC addresses are removed or the number of maximum
allowable addresses is increased. In this mode, there is a notification that a security violation has occurred.
3. Shutdown: In this (default) violation mode, a port security violation causes the interface to immediately become error-
disabled and turns off the port LED. It increments the violation counter. When a secure port is in the error-disabled state,
it can be brought out of this state by entering the shutdown and no shutdown interface configuration mode commands.
Before configuring port-security features, place the port in access mode and use the switchport port-security interface
configuration command to enable port security on an interface.
Figure 1-45 shows the Cisco IOS CLI commands needed to configure port security on the Fast Ethernet F0/18 port on the S1
switch. Notice that the example does not specify a violation mode. In this example, the violation mode is the default mode of shutdown.
Likewise, Figure 1-46 shows the commands needed to enable sticky secure MAC addresses for port security on Fast Ethernet
port 0/19 of switch S1. As stated earlier, a specific maximum number of secure MAC addresses can be manually configured. In this
42
example, the Cisco IOS command syntax is used to set the maximum number of MAC addresses to 50 for port 0/19. The violation mode
is set to the default mode of shutdown.
Figure 1-45. Cisco Switch IOS CLI Commands for Dynamic Port
Security
Figure 1-46. Cisco Switch IOS CLI Commands for Sticky Port Security
Figure 1-47. Cisco Switch IOS CLI Commands for Sticky Port Security
The Sticky MAC addresses are added to the MAC address table and to the running configuration. Figure 1-48 shows the
output of the sticky MAC address for PC2 has been automatically added to the running configuration for S1
To display all secure MAC addresses configured on all switch interfaces, or on a specified interface with aging information
for each, use the show port-security address command. As shown in the output (see Figure 1-49), the secure MAC addresses are listed
along with the types.
Figure 1-48. The sticky MAC address for PC2 has been Figure 1-49. Verifying secure MAC addresses
automatically added to the running configuration for S1
43
Summary
Secure Shell (SSH) is used to provide a secure (encrypted) management connection to a remote device to prevent the sniffing of
unencrypted user names and passwords which is possible when using protocols such as Telnet.
One of the advantages of a switch is that it allows full-duplex communication between devices effectively doubling the
communication rate. Although it is possible to specify the speed and duplex settings of a switch interface, it is recommended that
the switch be allowed to set these parameters automatically to avoid errors.
Switch port security is a requirement to prevent such attacks as MAC Address Flooding and DHCP Spoofing.
Switch ports should be configured to allow only frames with specific source MAC addresses to enter. Frames from unknown source
MAC addresses should be denied and cause the port to shut down to prevent further attacks.
Port security is only one defense against network computer.
Best practices that represent the best insurance for a network are: develop a written security policy for the organization, shut down
unused services and ports, use strong passwords and change them often, control physical access to devices, avoid using standard
insecure HTTP websites, especially for login screens. Instead use the more secure HTTPS, perform backups and test the backed-up
files on a regular basis, educate employees about social engineering attacks, and develop policies to validate identities over the
phone, via email, and in person, encrypt sensitive data and protect it with a strong password, implement security hardware and
software, such as firewalls, and keep IOS software up-to-date by installing security patches weekly or daily, if possible.