Computer Networks

[Day 9] 5. Virtual Local Area Network (VLAN)

D
DITISS Admin
••4 min read

Introduction

A VLAN creates logical partitions within a physical switch, allowing for better traffic management, security, and network organization. By segmenting networks, VLANs reduce broadcast domains and help optimize network performance.

  • Concurrent Sessions: A VLAN supports up to 16 Telnet sessions simultaneously, enabling multiple remote connections to the switch.

  • VLAN Numbering: VLANs are typically numbered from 1 to 1005, but VLANs 1002 to 1005 are reserved for system use. VLANs 1 to 1001 are available for regular configuration, and extended VLANs can go up to 4096.

  • Default VLAN: The default VLAN on a switch is VLAN 1, often referred to as the Management, Parent, or Untagged VLAN, and it is used for general switch management tasks.


Configuration of VLAN 1

  1. Power on the switch:

    switch> on

  2. Enter global configuration mode:

    switch# conf t

  3. Enter the interface configuration mode for VLAN 1:

    switch(config)# int vlan1

  4. Enable the interface (bring it up):

    switch(config-if)# no shut

  5. Assign an IP address and subnet mask to VLAN 1:

    switch(config-if)# ip address 172.16.100.10 255.255.255.0

  6. Exit interface configuration mode:

    switch(config-if)# exit

  7. Set the default gateway for the switch:

    switch(config)# ip default-gateway 172.16.10.1

  8. Enter interface configuration mode for a physical port (e.g., fa1/0):

    switch(config)# int fa1/0

    (This is the switch port configuration)

  9. Configure port security by setting a MAC address:

    switch(config-if)# switchport port-security mac-address <MAC address>

    • Note: Instead of using a static MAC address, the
      sticky
      keyword can be used to automatically learn and assign the MAC address to the port, making it permanent.
      switch(config-if)# switchport port-security mac-address sticky
  10. Set the violation action to shutdown if an unauthorized device tries to access the port:

    switch(config-if)# switchport port-security violation shutdown

    • Explanation: If a device with an unknown MAC address attempts to connect, the port will shut down automatically and will only be re-enabled by an administrator.

Configuration for Multiple Ports at Once

  1. To configure a range of ports (e.g., fa1/0 to fa1/8):

    switch(config)# int range fa1/0 - 8

  2. Apply port security with the

    sticky
    MAC address option to all selected ports:
    switch(config-if)# switchport port-security mac-address sticky

  3. Set the violation action to shutdown for all selected ports:

    switch(config-if)# switchport port-security violation shutdown


Steps to Configure VLANs

  1. Create a new VLAN:

    switch(config)# vlan2

  2. Assign a name to the VLAN:

    switch(config-vlan)# name sales

  3. Exit VLAN configuration mode:

    switch(config-vlan)# exit

  4. Create another VLAN:

    switch(config)# vlan3

  5. Assign a name to the second VLAN:

    switch(config-vlan)# name purchase

  6. Exit VLAN configuration mode:

    switch(config-vlan)# exit

  7. To allocate ports to a VLAN, select an interface:

    switch(config)# int fa1/1

  8. Assign the port to VLAN 2:

    switch(config-if)# switchport access vlan 2


Alternatively, you can use the range command to configure multiple ports at once:

  1. Select a range of ports:

    switch(config)# int range fa1/1-8

  2. Assign the selected ports to VLAN 2:

    switch(config-if-range)# switchport access vlan 2


Read Next

8/26/2026

[Day 9] 6. VTP (VLAN Trunking Protocol)

**VLAN Trunking Protocol (VTP)** is a Cisco proprietary protocol developed by Cisco Systems. **Definition & Purpose:** VTP (VLAN Trunking Protocol)...

8/26/2026

[Day 9] 7. Inter-VLAN Connection

### **Inter-VLAN Routing (Router-on-a-Stick Configuration)** **Explanation:** Inter-VLAN routing is necessary when devices in different VLANs ne...