What is a VLAN?

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. VLANs can be 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.

A VLAN acts like a physical LAN, but it allows hosts to be grouped together in the same broadcast domain even if they are not connected to the same switch. Here are the main reasons why you should use VLANs in your network:

  • VLANs increase the number of broadcast domains while decreasing their size.
  • VLANs reduce security risks by reducing the number of hosts that receive copies of frames that the switches flood.
  • you can keep hosts that hold sensitive data on a separate VLAN to improve security.
  • you can create more flexible network designs that group users by department instead of by physical location.
  • network changes are achieved with ease by just configuring a port into the appropriate VLAN.


The following topology shows a network with all hosts inside the same VLAN:

topology without vlan

Without VLANs, a broadcast sent from host A would reach all devices on the network. By placing interfaces Fa0/0 and Fa0/1 on both switches into a separate VLAN,  a broadcast from host A would reach only host  B, since each VLAN is a separate broadcast domain and only host B is inside the same VLAN as host A. Hosts in VLAN 3 and VLAN 5 will not even be aware that the communication took place. This is shown in the picture below:

topology with vlan

To reach hosts in another VLAN, a router is needed.

Access & trunk ports

Each port on a switch can be configured as either an access or a trunk port. An access port is a port that can be assigned to a single VLAN. This type of interface is configured on switch ports that are connected to devices with a normal network card, for example a host on a network. A trunk interface is an interface that is connected to another switch. This type of interface can carry traffic of multiple VLANs.

In the example network pictured above, the link between SW1 and SW2 would be configured as a trunk interface. All other switch ports connect to end user devices, so they would need to be configured as access ports.