Post: VLAN

1 minute read

Before we can fully understand VLAN we should first explores other components that are related to it.

What is a subnet (L3)

  • A subnet a segment of a larger network.
  • Host in the same network must be able to reach each other through L2 protocol (L2 switch)
  • Physical constraint - host in the same network must be able to reach each other through L2 protocol
  • ARPing across subnet:
    1. the process/kernel will recognise that IP address is outside of its subnet mask.
    2. Process will send ARP request for gateway router
    3. Process will send an IP datagram to the desired destination ip address with the gateway router’s mac address as the destination mac address.
  • Are higher level routers (LAN of just routers) in a subnet?

What is a LAN (L2)

  • A LAN is a collection of devices that are connected together
    • Usually within the same geographical location
    • There maybe L2 switches in the LAN
      • Switches are used in LAN to connect devices
  • LAN is a L2 concept.
  • Routing traffic between different LAN uses a L3 router

LAN vs Subnet:

  • LAN is a network of devices can communicate to each other through L3 protocol.
  • Subnet is a IP addressing concept. Different IP address are grouped together using subnet mask.
  • Many subnets can be in the same LAN

What is a VLAN tagging

  • Main purposes:
    • Traditionally a switch will forward (broadcast and multicast) an ether frame to all ports except the sending port.
    • VLAN helps this by only forwarding to ports that configured for the VLAN
  • VLAN tagging: adding a vlan tag to an ethernet frame
  • Trunk links:
    • Pass frames with any VLAN tag to be passed through
    • When sending into a trunk link, the switch will add a VLAN tag
    • When the frame is leaving the trunk link, the switch will remove the VLAN tag and the receiving switch will know which VLAN it belongs to
  • Access links:
    • based on the vlan tag, the receiving switch on a trunk linke will know which access link to forward it to
    • switch will remove the vlan tag from ethernet frame and forward to the corresponding access link
  • Useful references:
    • https://www.firewall.cx/networking/vlan-networks/vlan-tagging.html