Switches

Nerd Cafe

Introduction to Network Switches

A network switch is a fundamental device in networking that connects multiple devices within a local area network (LAN) and manages data traffic efficiently. Unlike hubs, which broadcast data to all devices, switches forward data only to the specific device that needs it, reducing network congestion and improving performance.

Lesson 1: Understanding Network Switches

1.1 What is a Network Switch?

A network switch is a multi-port device that uses MAC addresses to forward data frames to the correct destination. It operates at Layer 2 (Data Link Layer) of the OSI model, but some advanced switches can also function at Layer 3 (Network Layer), performing routing functions.

1.2 Key Features of a Network Switch

  • MAC Address Learning: Switches build a MAC address table by learning the source MAC addresses from incoming frames.

  • Frame Forwarding: Based on the MAC address table, switches send frames only to the intended recipient.

  • Collision Domain Separation: Each port of a switch creates a separate collision domain, unlike hubs, which share a single collision domain.

  • Full-Duplex Communication: Switches support full-duplex communication, allowing simultaneous sending and receiving of data.

  • VLAN Support: Virtual LANs (VLANs) segment networks logically, improving security and efficiency.

1.3 Types of Network Switches

  1. Unmanaged Switch: Basic plug-and-play switch with no configuration options.

  2. Managed Switch: Allows customization, VLANs, security settings, and traffic monitoring.

  3. Layer 2 Switch: Operates at the Data Link Layer, forwarding based on MAC addresses.

  4. Layer 3 Switch: Has routing capabilities and can forward data based on IP addresses.

  5. PoE (Power over Ethernet) Switch: Supplies power to connected devices like IP cameras and VoIP phones.

Lesson 2: Practical Setup of a Network Switch

Topology

2.1 Required Equipment

  • A network switch (managed or unmanaged)

  • Ethernet cables (Cat5e, Cat6, or Cat7)

  • Devices such as computers, routers, and access points

  • (For managed switches) A PC with a web browser or terminal for configuration

2.2 Step-by-Step Setup

Step 1: Physical Connection

  1. Power on the switch and ensure the LED indicators are working.

  2. Connect devices to the switch using Ethernet cables.

  3. Connect the switch to a router if internet access is needed.

Step 2: Basic Testing

  1. Check if the devices get an IP address (if DHCP is enabled on the router).

  2. Use the ping command to test connectivity between devices:

ping 192.168.1.10

Lesson 3: Configuring a Managed Network Switch

3.1 Accessing the Switch

  1. Find the switch's IP address (usually in the user manual or assigned by DHCP).

  2. Open a web browser and enter the IP address.

  3. Login with default credentials (admin/admin or admin/password).

  4. Change the default username and password for security.

3.2 Creating VLANs (Virtual LANs)

VLANs separate traffic logically, increasing security and reducing congestion.

  1. Navigate to VLAN Settings.

  2. Create VLANs (e.g., VLAN 10 for HR, VLAN 20 for IT).

  3. Assign ports to VLANs.

  4. Save and apply settings.

Switch>en
Switch>enable 
Switch#configure terminal 
Switch(config)#vlan 10
Switch(config-vlan)#name HR
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 20
Switch(config-if)#^Z
Switch#write memory 
Building configuration...
[OK]
Switch#

3.3 Enabling Port Security

To prevent unauthorized access, enable port security on switch ports.

Switch#configure terminal 
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport port-security 
Switch(config-if)#switchport port-security maximum 2
Switch(config-if)#switchport port-security violation shutdown 

Lesson 4: Troubleshooting a Network Switch

4.1 Common Issues and Solutions

Issue
Possible Cause
Solution

No network connectivity

Bad cable or incorrect port

Replace the cable, check port connections

High network latency

Congested ports

Enable Quality of Service (QoS)

Intermittent connectivity

Duplex mismatch

Set correct duplex settings

Unauthorized devices

Security threat

Enable port security

4.2 Checking MAC Address Table

To see the MAC addresses learned by a switch:

Switch#show mac-address-table 
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

  10    0030.f280.261b    STATIC      Fa0/1
  20    0030.a3a5.9637    DYNAMIC     Fa0/2
Switch#

4.3 Checking VLAN Configuration

Switch#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24
10   HR                               active    Fa0/1
20   IT                               active    Fa0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
Switch#

Conclusion

  • Network switches are essential in LANs, enabling efficient data transfer.

  • Managed switches offer more control, security, and VLAN segmentation.

  • Basic troubleshooting and security settings are crucial for a stable network.

Keywords

Network switch, Ethernet switch, Layer 2 switch, Layer 3 switch, VLAN, MAC address table, Port security, Managed switch, Unmanaged switch, PoE switch, Network topology, Collision domain, Full-duplex, Packet forwarding, Network segmentation, Switch configuration, STP (Spanning Tree Protocol), QoS (Quality of Service), Trunking, Switch troubleshooting, نتورک پلاس

Last updated