Switch and Router Configuration
Switch and Router Configuration
Configuration
UT Solutions PLC
Yadel Bayou, Jr. Network Engineer
IOS Command Modes
• User exec, Privileged EXEC, and the global configuration modes.
• User Exec - most of the commands available are used to show statistics and perform
some basic troubleshooting.
• Privilege Exec Mode - This IOS mode is also called enable mode because you must
enter the enable command from a user EXEC mode if you want to access this mode, s
the system administrator mode. In this mode configuration files can be read, the router
can be rebooted, and operating parameters can be changed.
• Subnet mask also consists of 32 bits. Computers use it to determine the network part and
the host part of an address
• Aside from the dotted decimal format, we can also write the subnet mask in slash notation.
It is a slash ‘/’ then followed by the subnet mask bits. To determine the slash notation of the
subnet mask, convert the dotted decimal format into binary, count the series of 1s, and add
a slash on the start.
IP Address classes
• TCP/IP defines five classes of IP addresses: class A, B, C, D, and E. Each class has a
range of valid IP addresses
• IP addresses from the first three classes (A, B and C) can be used for host addresses.
The other two classes are used for other purposes – class D for multicast and class E for
experimental purposes.
0.0.0.0/8 – addresses used to communicate with the local network
127.0.0.0/8 – loopback addresses
169.254.0.0/16 – link-local addresses (APIPA)
Subnetting
• Subnetting is the practice of dividing a network into two or more smaller networks. It increases
routing efficiency, enhances the security of the network and reduces the size of the broadcast
domain.
• 192.168.0.0/25 – the first subnet has the subnet number of 192.168.0.0. The range of IP
addresses in this subnet is 192.168.0.0 – 192.168.0.127.
• 192.168.0.128/25 – the second subnet has the subnet number of 192.168.0.128. The range of IP
addresses in this subnet is 192.168.0.128 – 192.168.0.255.
Cisco Discovery Protocol(CDP)
• CDP (Cisco Discovery Protocol) is a proprietary protocol developed by Cisco used to discovers
information about the locally attached Cisco equipment. With CDP, the administrator can gather
hardware and protocol information about neighboring devices, which can be helpful when
troubleshooting or documenting the network.
• To get even more information about the neighbors, use the show cdp neighbors detail command
• LLDP (Link Layer Discovery Protocol) is the Open Standard version of this protocol.
Networking Device Management
• IOS Boot Sequence
1. The device performs the power-on self-test (POST) process to discover and verify its hardware components.
2. If the POST test is successful, the bootstrap program is copied from ROM into RAM.
3. The bootstrap program decides which IOS image to load from the flash memory into RAM, and then loads
the chosen IOS.
4. IOS finds the startup configuration file, usually located in NVRAM, and loads it into RAM as the running
configuration.
• Factory Reset
1. Create a hostname
2. Verify the configuration
3. Save the configuration
4. Resetting the Cisco router to factory default involves erasing the NVRAM. (write erase), reload.
Networking Device Management (2)
• Password Recovery
Before we proceed with password recovery, we will take a look first at the configuration register. We can use the ‘show
version’ command to check the configuration register setting on our device. Configuration Register is a special 16 bits
value that can be configured in Cisco routers. It is mainly used to determine how the router boots, to determine boot
options, and to set console speed. The following are the most commonly used configuration register settings:
1. config-register 0x2102 – boot normally (default configuration register setting)
2. config-register 0x2120 – boot into ROM Monitor (ROMMON)
3. config-register 0x2142 – ignore contents of NVRAM (startup-configuration)
Steps
1. Goto RoMMon Mode
2. rommon 1 > confreg 0x2142 2. rommon 2 > reset
3. Set the new password
4. config-register 0x2102
Network Device Management (3)
Backup
• TFTP is a client-server network protocol used to send and receive files. To backup files to a TFTP
server, you will have to set it up first.
• To backup the running configuration to a TFTP server, you can use the copy running-config tftp:
command:
Upgrade
• transfer the file from the TFTP server to the flash memory of the switch. This can be done by
issuing the copy command on the switch.
Network Device Management (4)
Management
• Simple Network Management Protocol (SNMP) is an application layer protocol that is used for
network device management. This protocol can collects and manipulate valuable network
information from switches, routers, servers, printers, and other network-attached devices.
Network management station (NMS) – the software which runs on the administrative computer.
This software gathers SNMP data by requiring the devices on the network to disclose certain
information. Devices can also inform the NMS about problems they are experiencing by sending an
SNMP alert (called a trap).
Agent – the software which runs on managed devices and reports information via SNMP to the
NMS.
Network Device Management (5)
Remote Management
• Telnet is a network protocol that allows a user to communicate with a remote device. It is a virtual
terminal protocol used mostly by network administrators to remotely access and manage devices.
Administrator can access the device by telnetting to the IP address or hostname of a remote device.
• SSH is a network protocol used to remotely access and manage a device. The key difference
between Telnet and SSH is that SSH uses encryption, which means that all data transmitted over a
network is secure from eavesdropping. SSH uses the public key encryption for such purposes.
• Every Cisco router or switch has a single console port that is used to connect it to a computer
directly for configuration and management. A console cable or a rollover cable is used to connect to
the router or switch console port and is typically used during initial configuration as there is no
network connection and remote access, such as Telnet, SSH, or HTTPS, configured on the device yet.
• A router or switch has one console port only. The console port has a line number of 0, thus ‘line
console 0’. To secure the console port connections to our networking device, we can set a password.
Cisco three-layer hierarchical model
Cisco three-layer hierarchical model
• Access – controls user and workgroup access to the resources on the network. This layer usually incorporates
Layer 2 switches and access points that provide connectivity between workstations and servers. You can
manage access control and policy, create separate collision domains, and implement port security at this
layer.
• Distribution – serves as the communication point between the access layer and the core. Its primary
functions are to provide routing, filtering, and WAN access and to determine how packets can access the
core. This layer determines the fastest way that network service requests are accessed – for example, how a
file request is forwarded to a server – and, if necessary, forwards the request to the core layer. This layer
usually consists of routers and multilayer switches.
• Core – also referred to as the network backbone, this layer is responsible for transporting large amounts of
traffic quickly. The core layer provides interconnectivity between distribution layer devices it usually consists
of high speed devices, like high end routers and switches with redundant links.
VLANs and Trunks
• VLANs (Virtual LANs) are logical grouping of devices in the same broadcast domain. VLANs are usually
configured on switches by placing some interfaces into one broadcast domain and some interfaces into
another. Each VLAN acts as a subgroup of the switch ports in an Ethernet LAN.
• VLANs can spread across multiple switches, with each VLAN being treated as its own subnet or
broadcast domain. This means that frames broadcasted onto the network will be switched only
between the ports within the same VLAN.
Benefits of VLANS
1. VLANs increase the number of broadcast domains while decreasing their size.
2. VLANs reduce security risks by reducing the number of hosts that receive copies of frames that the
switches flood.
2. you can keep hosts that hold sensitive data on a separate VLAN to improve security.
4. you can create more flexible network designs that group users by department instead of by physical
location.
5. network changes are achieved with ease by just configuring a port into the appropriate VLAN.
VLANs and Trunks
If you intend to use VLANs in your network, you will need to configure some ports on a switch as
access ports and other as trunk ports. Here is a description each port type:
1. access port – a port that can be assigned to a single VLAN. This type of interface is configured on
switch ports that are connected to end devices such as workstations, printers, or access points.
2. trunk port – a port that is connected to another switch. This type of interface can carry traffic of
multiple VLANs, thus enabling you to extend VLANs across your entire network. Frames are tagged
by assigning a VLAN ID to each frame as they traverse between switches. Allowed VLANS can be
configured.
VLANs and Trunks
• Most corporate networks today use IP telephony. This means that the phones are connect to the
same network and use the same cabling as other network devices, such as workstations or
routers. Since offices usually have only a single UTP cable to each desk, most of the IP phones
today include a small switch that enable you to connect your PC to the phone sitting on the desk,
and then connect the phone to the local network.
• The port on the phone connected to the switch can carry both data and
voice traffic. To enable this, we need to define two VLANs on the switch
port – data VLAN and voice VLAN. Here is how we can do that:
SW1(config)#vlan 5
SW1(config)#vlan 20
SW1(config)#int fa0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 5
SW1(config-if)#switchport voice vlan 20
Spanning Tree Protocol
• Spanning Tree Protocol (STP) is a network protocol designed to prevent layer 2 loops. It is
standardized as IEEE 802.D protocol. STP blocks some ports on switches with redundant links to
prevent broadcast storms and ensure loop-free topology. With STP in place, you can have
redundant links between switches in order to provide redundancy.
• SW1 sends a broadcast frame to SW2 and SW3. Both switches receive the frame and forward the
frame out every port, except the port the frame was received on. So SW2 forwards the frame to
SW3. SW3 receives that frame, and forwards it to SW1. SW1 then again forwards the frame to
SW2! The same thing also happens in the opposite direction. Without STP in place, these frames
would loop forever. STP prevents loops by placing one of the switch ports in blocking state.
Spanning Tree Protocol (2)
STP uses the Spanning-Tree Algorithm (SPA) to create a topology database of the network. To prevent loops,
SPA places some interfaces in forwarding state and other interfaces in blocking state. How does STP decides in
which state the port will be placed? A couple of criteria exist:
• 1. all switches in a network elect a root switch. All working interfaces on the root switch are placed in
forwarding state.
• 2. all other switches, called nonroot switches, determine the best path to get to the root switch. The port
used to reach the root switch (root port) is placed in forwarding state.
• 3. on the shared Ethernet segments, the switch with the best path to reach the root switch is placed in
forwarding state. That switch is called the designated switch and its port is known as the designated port.
• 4. all other interfaces are placed in blocking state and will not forward frames.
Let’s say that SW1 is elected as the root switch. All ports on SW1 are placed into forwarding state. SW2 and
SW3 choose ports with the lowest cost to reach the root switch to be the root ports. These ports are also
placed in forwarding state. On the shared Ethernet segment between SW2 and SW3, port Fa0/1 on SW2 has
the lowest cost to reach the root switch. This port is placed in forwarding state. To prevent loops, port Fa0/1
on SW3 is placed in blocking state.
Spanning Tree Protocol (3)
STP Root Bridge Election
The switch assigns a root bridge within the interconnected switches. A root bridge is the central
point of all switches and will be responsible for forwarding the traffic. The switch selects a root
bridge by using the switch priority and the MAC address. Each switch has its own bridge ID and has
a default priority value of 32768. The root bridge is taking precedence over the MAC address. If a
switch has the lowest bridge priority value among the switches within the LAN, then it will be
elected as the spanning tree root bridge.
If all the spanning tree bridge priority has the same priority value on all the switches, then the MAC
address will be the tiebreaker. The lowest MAC address will be elected as the Root Bridge. Most of
the older switches have a lower value of MAC address and have lower bandwidth and limited
CPU/memory as compared to newer switches. Electing an older switch as the root bridge will cause
a suboptimal operation on your network.
We could configure secondary STP root bridge to prepare for when the primary fails.
Spanning Tree Protocol (4)
As we’ve mentioned before, all working interfaces on the root switch are placed in forwarding state. All
other switches (called nonroot switches) determine the best path to get to the root switch and the port
used to reach the root switch is placed in forwarding state. The best path is the one with the lowest
cost to reach the root switch. The cost is calculated by adding the individual port costs along the path
from the switch to the root.
SW1 has won the election process and is the root switch. Consider the SW3’s perspective for choosing
its root port. Two paths are available to reach the root switch, one direct path over Fa0/1 and the other
going out Fa0/2 and through SW2. The direct path has a cost of 19, while the indirect path has the cost
of 38 (19+19). That is why Fa0/1 will become the root port on SW3.
In case the best root cost ties for two or more paths, the following tiebreakers are applied: