Computer networking is the backbone of modern communication, enabling devices to share resources and exchange information seamlessly. Understanding the fundamental concepts of switching, routing, and wireless technologies is crucial for anyone aspiring to master network infrastructure. This guide will break down these core components, providing a comprehensive overview for students delving into computer networking.
Understanding Switching: The Foundation of Local Networks
Switches operate at Layer 2 (Data Link Layer) of the OSI model, connecting devices within a local area network (LAN). They intelligently forward data frames based on MAC addresses.
MAC Address Learning and Forwarding
When a switch powers on, its MAC address table is empty. It builds this table by examining the source MAC address of incoming frames. If a frame's source MAC is not in the table, the switch adds it along with the incoming port number. If the source MAC is already in the table but associated with a different port, the switch updates the entry with the new port and refreshes the timer. If the source MAC is in the table on the same port, only the refresh timer is updated.
For forwarding, if the destination MAC address is unicast and found in the table, the frame is sent out only the specified port. If the destination MAC is not in the table, the switch floods the frame out of all ports in the same VLAN, except the incoming port. If the destination MAC is a broadcast or multicast, the frame is also flooded out all ports except the incoming port.
Collision and Broadcast Domains
Connecting multiple Cisco LAN switches expands the broadcast domain to all interconnected switches. However, each switch port typically represents a separate collision domain, thanks to microsegmentation. This enhances user bandwidth by allowing full-duplex connectivity between directly attached devices.
VLANs: Segmenting Networks for Efficiency and Security
VLANs (Virtual Local Area Networks) logically segment a network, isolating traffic between segments and creating more broadcast domains. Key VLAN types include:
- Data VLANs: Carry user-generated traffic.
- Default VLAN: All switch ports are assigned here after initial bootup (VLAN 1).
- Native VLAN: Carries untagged traffic on an 802.1Q trunk port.
- Management VLAN: Assigned an IP address and subnet mask for remote switch management (HTTP, Telnet, SSH, SNMP).
VLAN Trunking Protocol (VTP)
VTP is a Cisco-proprietary protocol for synchronizing and managing the VLAN database across multiple switches. Switches can operate in three modes:
- Server mode (default): Create, modify, or delete VLANs and propagate this information.
- Client mode: Receive and store VLAN information from a VTP server; cannot make local changes.
- Transparent mode: Create, modify, delete VLANs locally, but do not propagate or synchronize VTP information.
To manage VLANs effectively, standard range VLANs (1-1005) are stored in vlan.dat in flash memory, which must be manually deleted to remove them after erasing startup-config.
Dynamic Trunking Protocol (DTP)
DTP is a Cisco-proprietary protocol that automatically manages trunk negotiation between neighboring switches. Common modes for establishing a functional trunk link include:
dynamic desirable(active) withtrunk,dynamic desirable, ordynamic auto.trunk(manual) withtrunk,dynamic desirable, ordynamic auto.
If both ends are in dynamic auto, they both wait passively, resulting in a non-trunking access link. To mitigate VLAN attacks, DTP should be disabled on access ports by setting them to static access mode (e.g., switchport mode access) and on trunk ports using switchport nonegotiate.
EtherChannel: Aggregating Links
EtherChannel bundles multiple physical Ethernet links into a single logical link, increasing bandwidth and providing redundancy. It allows data to transmit over redundant paths simultaneously, bypassing STP blocking. Load balancing can be implemented using mechanisms like source IP to destination IP or source MAC to destination MAC.
EtherChannel supports two negotiation protocols:
- PAgP (Port Aggregation Protocol): Cisco-proprietary. Modes:
on,desirable,auto. - LACP (Link Aggregation Control Protocol): Open standard. Modes:
on,active,passive.
Spanning Tree Protocol (STP) and its Enhancements
STP (Spanning Tree Protocol) is a loop-prevention protocol designed to eliminate Layer 2 loops in redundant switched networks. It blocks redundant physical paths to ensure only one logical path, automatically unblocking paths if an active link fails.
- Root Bridge Election: The switch with the lowest Bridge ID (BID) becomes the root bridge. The BID is formed by bridge priority, extended system ID, and MAC address.
- Port Roles (STP/RSTP): Root port (best path to root), Designated port (forwarding on a segment), Alternate port (blocking, backup path).
Rapid PVST+ automatically determines link types (point-to-point, shared, edge), though they can be specified manually. STP and RSTP can cause suboptimal traffic flows because they assume only one spanning-tree instance for the entire bridged network, regardless of VLANs. PVST+ provides a separate instance per VLAN.
STP Stability Mechanisms
To enhance STP stability and mitigate attacks:
- PortFast: Immediately transitions an interface to the forwarding state, bypassing listening and learning states. Designed for ports connected to end devices. Enabled via
spanning-tree portfast. - BPDU Guard: Immediately error-disables a port if a BPDU is received. Should be enabled on all PortFast-enabled end-user ports (
spanning-tree portfast bpduguard defaultglobally or per interface) to prevent rogue switches. - Root Guard: Prevents a switch from becoming the root switch. Applied to ports where the root should not be located.
- Loop Guard: Detects unidirectional links to prevent alternate or root ports from becoming designated ports.
Routing: Connecting Diverse Networks
Routing operates at Layer 3 (Network Layer), forwarding packets between different networks based on IP addresses.
Static Routing Fundamentals
Static routes are manually configured on a router. Compared to dynamic routes, they improve network security (no route updates exchanged) and use fewer router resources (less bandwidth, no CPU cycles for route calculation). However, they must be manually reconfigured if the network topology changes. A static route remains in the routing table until manually removed with no ip route.
- Default Static Route:
ip route 0.0.0.0 0.0.0.0 [exit-interface | next-hop-ip](IPv4) oripv6 route ::/0 [exit-interface | next-hop-ipv6-address](IPv6). This route acts as a gateway of last resort for packets with unknown destinations. - Floating Static Route: A static route with a higher administrative distance (AD) than a primary route. It acts as a backup, only becoming active if the primary route fails. For example, an EIGRP route has an AD of 90, so a floating static route needs an AD greater than 90.
- Host Route: An IPv4 address with a
/32subnet mask or an IPv6 address with a/128mask, directing traffic to a specific device. Automatically added for active interfaces.
IPv6 Specifics
- Link-Local Addresses: Used for communication on the same local network link, not routable. The IPv6 prefix is
FE80::/10. - Fully Specified Static Route (IPv6): When the next hop is an IPv6 link-local address, the static route command must explicitly identify the exit interface (
ipv6 route [destination-prefix/length] [exit-interface] [next-hop-link-local-address]). This is because link-local addresses are unique per link and not in the routing table.
Cisco Express Forwarding (CEF)
CEF is the fastest packet forwarding mechanism on Cisco routers and multilayer switches. It builds a Forwarding Information Base (FIB) and an adjacency table to route packets quicker, eliminating recursive lookups. If CEF is disabled, Ethernet multi-access interfaces require fully specified static routes to avoid routing inconsistencies.
Inter-VLAN Routing
Inter-VLAN routing allows devices in different VLANs to communicate. Two common methods:
- Router-on-a-Stick: A single router interface connects to a switch via a trunk link, and subinterfaces are configured for each VLAN. The switch port connecting to the router must be an 802.1Q trunk port. The
encapsulation dot1q [vlan-id]command is used on subinterfaces. - Layer 3 Switch: Uses Switched Virtual Interfaces (SVIs) and routed ports to perform routing functions. Configuration steps include creating SVI interfaces, enabling IP routing (
ip routing), assigning ports to VLANs, and configuring routed ports (no switchporton the interface).
DHCP Relay Agent
To allow clients on a LAN to receive IP addresses from a DHCP server on a different subnet, a router can act as a DHCP relay agent. The ip helper-address [dhcp-server-ip] command is applied to the router interface connected to the client's LAN, forwarding DHCP requests as unicast packets.
DHCPv6 Server
Under stateless DHCPv6 operation (ipv6 nd other-config-flag), the DHCPv6 server does not maintain state information. Clients configure their IPv6 addresses by combining the prefix from Router Advertisement (RA) messages and a self-generated interface ID. The ipv6 dhcp pool configuration does not need an address range.
Hot Standby Router Protocol (HSRP)
HSRP is a Cisco-proprietary First Hop Redundancy Protocol (FHRP) providing default gateway redundancy. It groups multiple physical routers into a single virtual router. One router is active (forwarding packets), and another is standby (monitoring and ready to take over). Hosts use the virtual IP and virtual MAC address for their default gateway.
Wireless Networking: Connectivity Without Wires
Wireless networks offer flexibility and mobility, using various standards and security measures.
Wi-Fi Standards and Frequencies
- 2.4GHz Band: 802.11b, 802.11g, and 802.11n (can also use 5GHz). In North America, non-overlapping channels are 1, 6, and 11.
- 5GHz Band: 802.11a, 802.11ac, and 802.11n (can also use 2.4GHz). This band has more channels and is less crowded, making it better for high-bandwidth, time-sensitive traffic like streaming multimedia.
Optimizing performance can involve a