Reza Farashahi — NZSE
Switches, hubs, frames, collision domains, broadcast domains, and CSMA/CD.
MAC learning, unknown-unicast flooding, forwarding, and aging.
VLANs, Layer 3 switches, port mirroring, PoE, and Lab 10.
CSMA/CD stands for Carrier Sense Multiple Access with Collision Detection. Think of it as courtesy rules in a shared conversation where everyone shares one microphone:
CSMA/CD & CSMA/CA Explained — PowerCert Animated Videos
| Unmanaged | Managed |
|---|---|
| Plug in devices and it works. | Administrator can configure behavior. |
| Common in homes and very small offices. | Common in business and enterprise networks. |
| No VLAN control or monitoring features. | Supports VLANs, port monitoring, security, PoE controls, and more. |
Separate departments or roles on one physical switch.
Inspect port status, MAC tables, statistics, and mirrored traffic.
Control ports, power, priority, and security settings.
How a switch learns MAC addresses — step-by-step tutorial
| MAC | Port |
|---|---|
| - | - |
| - | - |
The switch learns from the source MAC of incoming frames.
Each physical switch port is assigned directly to a VLAN ID. Connected devices don't need any special configuration—the switch isolates their traffic automatically.
| Switch Ports | Assigned VLAN | Department | Behavior |
|---|---|---|---|
| Fa0/1 – Fa0/2 | VLAN 20 | Sales | Isolated to Sales VLAN |
| Fa0/3 – Fa0/4 | VLAN 10 | HR | Isolated to HR VLAN |
! ── 1. ENTER CONFIGURATION MODE ──
Switch# configure terminal ! Enter global configuration mode
! ── 2. CREATE VLANs & ASSIGN NAMES ──
Switch(config)# vlan 10 ! Create VLAN 10 database entry
Switch(config-vlan)# name HR ! Name VLAN 10 as "HR"
Switch(config-vlan)# vlan 20 ! Create VLAN 20 database entry
Switch(config-vlan)# name Sales ! Name VLAN 20 as "Sales"
Switch(config-vlan)# exit ! Return to global config mode
! ── 3. ASSIGN PORTS Fa0/1 - 2 TO SALES (VLAN 20) ──
Switch(config)# interface range Fa0/1 - 2 ! Select switch ports Fa0/1 to Fa0/2
Switch(config-if-range)# switchport mode access! Set port mode to access (end devices)
Switch(config-if-range)# switchport access vlan 20 ! Assign ports to Sales (VLAN 20)
Switch(config-if-range)# exit ! Exit interface range config
! ── 4. ASSIGN PORTS Fa0/3 - 4 TO HR (VLAN 10) ──
Switch(config)# interface range Fa0/3 - 4 ! Select switch ports Fa0/3 to Fa0/4
Switch(config-if-range)# switchport mode access! Set port mode to access (end devices)
Switch(config-if-range)# switchport access vlan 10 ! Assign ports to HR (VLAN 10)
Switch(config-if-range)# end ! Return to privileged EXEC mode
! ── 5. VERIFY CONFIGURATION ──
Switch# show vlan brief ! View VLAN table & assigned ports
A Trunk port is a connection between two switches (or a switch and a router) that carries traffic for multiple VLANs over a single physical link.
! ── 1. HOW TO CONFIGURE TRUNK (IN CODE) ──
Switch# configure terminal ! Enter global configuration mode
Switch(config)# interface GigabitEthernet 0/1 ! Select trunk uplink port
Switch(config-if)# switchport mode trunk ! Set port to trunk mode (carries multiple VLANs)
! (Optional) Restrict allowed VLANs across trunk:
Switch(config-if)# switchport trunk allowed vlan 10,20 ! Allow only VLANs 10 and 20
Switch(config-if)# end ! Return to privileged EXEC mode
! ── 2. HOW TO CHECK / VERIFY TRUNK STATUS ──
! Method A: Summary of all active trunk ports
Switch# show interfaces trunk ! List active trunks, encapsulation & VLANs
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Gi0/1 10,20
! Method B: Detailed switchport check for one interface
Switch# show interfaces Gig0/1 switchport ! Check operational status of Gig0/1
Operational Mode: trunk ! Confirms port is operating as trunk
Trunking Encapsulation: dot1q ! Confirms 802.1Q tagging protocol
VLAN segmentation keeps traffic isolated by default. When departments need to communicate, the router controls and filters the path.
Configure Router-on-a-Stick sub-interfaces. The router acts as the default gateway for each VLAN and forwards IP packets between them automatically.
Method 1 (Default): Do not create a gateway for that VLAN on the router (Layer 2 isolation remains total).
Method 2 (Filtered): Apply an Access Control List (ACL) to deny specific cross-VLAN traffic while still permitting internet access.
! ── 1. HOW TO LET TWO VLANs COMMUNICATE (ROUTER-ON-A-STICK) ──
Router# configure terminal ! Enter global configuration mode
Router(config)# interface GigabitEthernet 0/0 ! Select physical trunk port to switch
Router(config-if)# no shutdown ! Enable / power on the physical port
! Sub-interface gateway for VLAN 10 (HR)
Router(config)# interface Gig0/0.10 ! Create virtual sub-interface for VLAN 10
Router(config-subif)# encapsulation dot1Q 10 ! Tag & recognize 802.1Q VLAN 10 frames
Router(config-subif)# ip address 192.168.10.1 255.255.255.0 ! Default gateway IP for HR subnet
! Sub-interface gateway for VLAN 20 (Sales)
Router(config)# interface Gig0/0.20 ! Create virtual sub-interface for VLAN 20
Router(config-subif)# encapsulation dot1Q 20 ! Tag & recognize 802.1Q VLAN 20 frames
Router(config-subif)# ip address 192.168.20.1 255.255.255.0 ! Default gateway IP for Sales subnet
! → Both VLANs can now communicate through the router!
! ── 2. HOW NOT TO LET THEM COMMUNICATE (BLOCK WITH ACL) ──
! Rule 1: Deny Sales (192.168.20.0/24) packets destined to HR (192.168.10.0/24)
Router(config)# access-list 100 deny ip 192.168.20.0 0.0.0.255 192.168.10.0 0.0.0.255
! Rule 2: Permit all other IP traffic (Internet, DNS, printers, etc.)
Router(config)# access-list 100 permit ip any any
! Apply ACL inbound on the Sales sub-interface
Router(config)# interface Gig0/0.20 ! Enter Sales sub-interface configuration
Router(config-subif)# ip access-group 100 in ! Inspect & filter packets entering from Sales
! → Sales is blocked from HR, but can still access the Internet!
| Device | Power need | Count | Total |
|---|---|---|---|
| IP phones | 7 W | 8 | 56 W |
| Access points | 18 W | 4 | 72 W |
| Cameras | 12 W | 6 | 72 W |
| Needed | 200 W |
| Scenario | Best feature |
|---|---|
| Separate HR and Sales on one physical switch. | |
| Copy traffic to a Wireshark laptop for troubleshooting. | |
| Power cameras without separate electrical outlets. | |
| Route between VLANs inside the campus LAN. |