Tag: Cisco

  • Static vs. Dynamic Trunking in VLANs

    In VLAN configurations, trunking allows multiple VLANs to be transmitted over a single physical link between switches. Trunking can be set up using static trunking or dynamic trunking.


    1. Static Trunking

    Static trunking means manually configuring a switch port as a trunk. This ensures that the port remains in trunk mode, allowing multiple VLANs to pass through it.

    Advantages of Static Trunking

    βœ… More secure (prevents unauthorized devices from negotiating trunks).
    βœ… No risk of dynamic negotiation failures.
    βœ… Preferred in enterprise networks for stability.

    Configuration of Static Trunking (Cisco Switch Example)

    bashCopyEditinterface GigabitEthernet0/1
      switchport mode trunk
      switchport trunk allowed vlan 10,20,30
      switchport trunk native vlan 99
      exit
    

    πŸ‘‰ This command sets GigabitEthernet0/1 as a static trunk, allowing VLANs 10, 20, and 30, and setting VLAN 99 as the native VLAN.


    2. Dynamic Trunking (DTP – Dynamic Trunking Protocol)

    Dynamic trunking allows ports to negotiate whether to become a trunk or remain an access port. Cisco switches use DTP (Dynamic Trunking Protocol) to automate trunk formation.

    DTP Modes

    ModeBehavior
    AccessForces the port into access mode (no trunking).
    TrunkForces the port into trunk mode (like static trunking).
    Dynamic AutoWaits for the other side to initiate trunking but does not actively negotiate.
    Dynamic DesirableActively tries to negotiate trunking with the other device.

    Configuration of Dynamic Trunking (Cisco Example)

    interface GigabitEthernet0/2
    switchport mode dynamic desirable
    exit

    πŸ‘‰ The desirable mode will actively try to establish a trunk if the other side supports it.

    interface GigabitEthernet0/3
    switchport mode dynamic auto
    exit

    πŸ‘‰ The auto mode waits for the other side to initiate trunking. If both sides are set to auto, the trunk will not form.


    3. Key Differences: Static vs. Dynamic Trunking

    FeatureStatic TrunkingDynamic Trunking (DTP)
    ConfigurationManually set to trunk modeUses DTP to negotiate trunking
    SecurityMore secureLess secure (vulnerable to VLAN hopping attacks)
    StabilityAlways trunkMay fail to negotiate a trunk
    Best Use CasesEnterprise networks, high-security environmentsSimple setups or mixed vendor environments

    Best Practice Recommendation

    πŸ”Ή Disable DTP on all trunk ports and configure static trunking for security.
    πŸ”Ή Use switchport nonegotiate to prevent DTP from running:

    interface GigabitEthernet0/4
    switchport mode trunk
    switchport nonegotiate
    exit
  • Introduction to 802.1Q, Native VLAN, and Allowed VLANs

    1. What is 802.1Q?

    IEEE 802.1Q is the standard for VLAN tagging in Ethernet networks. It allows multiple VLANs to exist on a single physical network by inserting a VLAN tag in the Ethernet frame header. This tagging enables switches to distinguish between VLANs and forward traffic accordingly.

    Key Features of 802.1Q:

    • Adds a 4-byte VLAN tag to Ethernet frames.
    • Supports up to 4094 VLANs (VLAN IDs 1-4094).
    • Trunk links carry multiple VLANs between switches.
    • Defines a Native VLAN (untagged traffic).

    2. What is a Native VLAN?

    A Native VLAN is the VLAN that carries untagged traffic on a trunk port. Any frame received without a VLAN tag is assumed to belong to the Native VLAN of that trunk.

    By default, VLAN 1 is the Native VLAN on most switches, but best practice is to change it to another VLAN for security reasons.

    Example Configuration (Changing the Native VLAN):

    bashCopyEditinterface GigabitEthernet0/1
      switchport mode trunk
      switchport trunk native vlan 99
      exit
    

    πŸ‘‰ This sets VLAN 99 as the Native VLAN for trunk port GigabitEthernet0/1.


    3. What is an Allowed VLAN?

    An Allowed VLAN is a VLAN that is explicitly permitted on a trunk link. By default, all VLANs are allowed on a trunk, but administrators can restrict the VLANs allowed on a specific trunk port to enhance security and reduce unnecessary traffic.

    Example Configuration (Restricting Allowed VLANs on a Trunk Port):

    bashCopyEditinterface GigabitEthernet0/2
      switchport mode trunk
      switchport trunk allowed vlan 10,20,30
      exit
    

    πŸ‘‰ This command allows only VLANs 10, 20, and 30 on trunk port GigabitEthernet0/2.


    Summary of Key Concepts

    ConceptDescription
    802.1QStandard for VLAN tagging on Ethernet frames.
    Native VLANThe VLAN for untagged traffic on a trunk port (default is VLAN 1).
    Allowed VLANsVLANs that are explicitly permitted on a trunk link.
  • Introduction to VLANs (Virtual Local Area Networks)

    A VLAN (Virtual Local Area Network) is a logical segmentation of a physical network that allows multiple networks to exist within the same physical infrastructure. VLANs enhance network performance, security, and manageability by grouping devices logically rather than based on physical location.

    Benefits of VLANs

    1. Improved Security – Devices in different VLANs cannot directly communicate unless explicitly configured.
    2. Better Network Performance – Reduces broadcast traffic and congestion.
    3. Simplified Management – Allows easier reconfiguration of networks without changing physical cabling.
    4. Enhanced Scalability – Supports large networks by dividing them into smaller segments.

    How to Configure VLANs

    Step 1: Define VLANs on a Switch

    Access the switch using the CLI (Command Line Interface) or Web GUI.

    Enter privileged EXEC mode:enable

    Enter global configuration mode:configure terminal

    Create a VLAN and assign it a number:

    vlan 10
    name Sales
    exit

    for additional VLANs as needed.

    Step 2: Assign Ports to VLANs

    Enter interface configuration mode for a specific port:

    interface GigabitEthernet0/1

    Assign the port to VLAN 10 (Access Mode):

    switchport mode access switchport

    access vlan 10

    exit

    Repeat for other interfaces and VLANs as needed.

    Step 3: Configure Trunk Ports (for VLAN Communication Between Switches)

    Enter interface configuration mode for the uplink port:

    Edit interface GigabitEthernet0/24

    Set the port as a trunk:

    switchport mode trunk

    switchport trunk allowed vlan 10,20,30

    exit

    Step 4: Verify VLAN Configuration

    Check VLAN assignments:

    show vlan brief

    Check trunk status:

    show interfaces trunk

    Verify VLAN connectivity using ping or other network tools.

  • Weighted Random Early Detection (WRED) in QoS

    1. Introduction

    Weighted Random Early Detection (WRED) is a congestion avoidance QoS mechanism that randomly drops packets before the queue is full, helping to prevent global TCP synchronization and optimize network performance.

    πŸ“Œ Key Benefits of WRED:
    βœ… Prevents queue tail drops, reducing congestion
    βœ… Improves TCP traffic performance
    βœ… Differentiates traffic by priority levels
    βœ… Works best in TCP-based networks


    2. How WRED Works

    WRED monitors queue depth and randomly drops packets based on:

    • Queue occupancy (how full the queue is)
    • Packet marking (DSCP/IP Precedence)
    • Minimum and maximum drop thresholds

    πŸ”Ή WRED Drop Logic:

    Queue StatusBehavior
    Queue < Min ThresholdNo drops βœ…
    Queue between Min & MaxRandom drops based on priority 🎲
    Queue > Max ThresholdAll new packets dropped (Tail Drop) 🚫

    πŸ“Œ Higher-priority traffic has higher thresholds, reducing drop probability.


    3. WRED vs. Tail Drop

    FeatureWREDTail Drop
    Packet Drop BehaviorGradual, based on queue depthDrops all packets when full
    Effect on TCPPrevents global TCP synchronizationCauses synchronization issues
    QoS DifferentiationPrioritizes important trafficNo differentiation

    4. Configuring WRED on a Cisco Router

    A. Basic WRED Configuration

    To enable WRED on an interface:

    interface GigabitEthernet1/0/1
    random-detect

    πŸ“Œ This applies default WRED settings, treating all traffic equally.


    B. WRED with IP Precedence-Based Drop Probabilities

    To prioritize higher-priority traffic:

    interface GigabitEthernet1/0/1
    random-detect precedence 3 20 40
    random-detect precedence 5 30 60

    πŸ“Œ Explanation:

    • Precedence 3 packets β†’ Start dropping at 20% queue, full drop at 40%.
    • Precedence 5 packets β†’ Start dropping at 30%, full drop at 60%.
    • Higher precedence = Less chance of being dropped.

    C. WRED with DSCP-Based Drop Probabilities

    To configure WRED based on DSCP values:

    interface GigabitEthernet1/0/1
    random-detect dscp-based

    Then, define DSCP drop thresholds:

    • DSCP 10 (low priority) β†’ Drops start at 20%, full drop at 50% queue depth.
    • DSCP 46 (VoIP, high priority) β†’ Drops start at 40%, full drop at 70%.

    D. WRED with Class-Based QoS

    1️⃣ Define a Traffic Class:

    class-map MATCH-VIDEO
    match ip dscp af41

    2️⃣ Create a Policy with WRED:

    policy-map WRED-POLICY
    class MATCH-VIDEO
    random-detect dscp-based

    3️⃣ Apply Policy to an Interface:

    interface GigabitEthernet1/0/1
    service-policy output WRED-POLICY

    πŸ“Œ Now, WRED is applied only to DSCP AF41 traffic!


    5. Verifying WRED

    βœ… Check WRED settings on an interface:

    show interfaces GigabitEthernet1/0/1 random-detect

    βœ… Monitor packet drops with WRED:

    show policy-map interface GigabitEthernet1/0/1

    6. Summary

    ScenarioConfiguration
    Enable WRED on an interfacerandom-detect
    Prioritize traffic based on IP Precedencerandom-detect precedence X min max
    Prioritize traffic based on DSCPrandom-detect dscp-based
    Class-Based WREDpolicy-map WRED-POLICY + random-detect dscp-based
    Verify WRED settingsshow interfaces random-detect

    πŸš€ WRED improves congestion management by preventing queue overflows and TCP synchronization issues!

  • QoS Policing in Cisco Networks

    1. Introduction

    Traffic policing is a QoS mechanism that limits the rate of traffic by dropping or marking excess packets when the defined limit is exceeded. Unlike traffic shaping, which buffers excess traffic, policing discards or reclassifies packets immediately.

    πŸ“Œ Key Benefits of Traffic Policing:
    βœ… Enforces bandwidth limits on applications/users
    βœ… Prevents network abuse (e.g., users setting high DSCP values)
    βœ… Protects critical traffic by limiting non-essential traffic
    βœ… Can mark or drop excess traffic to maintain QoS policies


    2. How Does Policing Work?

    Policing uses the Token Bucket Algorithm to monitor the rate of incoming traffic.

    πŸ“Œ Behavior of Policing:

    • Traffic within the limit β†’ Allowed βœ…
    • Traffic exceeding the limit β†’ Dropped or marked 🚫
    • No buffering (unlike shaping)

    Policing vs. Shaping

    FeaturePolicingShaping
    PurposeLimits and enforces a strict rateSmooths out bursts
    Effect on Excess TrafficDrops or marks packetsBuffers packets in a queue
    Delay ImpactNo delayCan introduce delay
    Best Use CaseIngress (incoming) trafficEgress (outgoing) traffic

    3. Configuring QoS Policing on Cisco Routers & Switches

    Cisco uses Class-Based Policing to enforce bandwidth limits.

    A. Policing All Traffic on an Interface

    To police all traffic on an interface to 5 Mbps:

    interface GigabitEthernet1/0/1
    police 5000000 conform-action transmit exceed-action drop
    • conform-action transmit β†’ Allowed traffic goes through.
    • exceed-action drop β†’ Traffic beyond 5 Mbps is dropped.

    B. Class-Based QoS Policing

    1️⃣ Define a Class to Match Traffic:

    class-map MATCH-VIDEO
    match ip dscp af41

    2️⃣ Create a Policy Map to Apply Policing:

    policy-map POLICE-VIDEO
    class MATCH-VIDEO
    police 2000000 250000 exceed-action drop

    3️⃣ Apply to an Interface:

    interface GigabitEthernet1/0/1
    service-policy input POLICE-VIDEO

    πŸ”Ή Explanation:

    • Limits AF41-marked traffic (video) to 2 Mbps.
    • Bursts up to 250 Kbps are allowed.
    • Excess traffic is dropped.

    C. Marking Instead of Dropping (Two-Color Policing)

    Instead of dropping excess traffic, mark it with a lower priority (DSCP 10):

    policy-map POLICE-WEB
    class MATCH-WEB
    police 1000000 200000
    conform-action transmit
    exceed-action set-dscp-transmit 10

    πŸ“Œ This means:

    • Traffic under 1 Mbps is transmitted normally.
    • Traffic above 1 Mbps is marked as DSCP 10 (lower priority) instead of being dropped.

    D. Three-Color Policing (CIR, PIR, Drop)

    Three-color policing allows three actions:
    βœ” Conform (Transmit βœ…)
    βœ” Exceed (Mark lower priority ✏️)
    βœ” Violate (Drop 🚫)

    policy-map POLICE-TRAFFIC
    class class-default
    police 5000000 1000000 2000000
    conform-action transmit
    exceed-action set-dscp-transmit 10
    violate-action drop

    πŸ“Œ Explanation:

    • Traffic ≀ 5 Mbps β†’ Allowed βœ…
    • Traffic between 5 Mbps – 7 Mbps β†’ Marked as DSCP 10 ✏️
    • Traffic > 7 Mbps β†’ Dropped 🚫

    4. Verifying Policing

    βœ… Check if policing is applied:

    show policy-map interface GigabitEthernet1/0/1

    βœ… Check interface traffic rate:

    show interfaces GigabitEthernet1/0/1 | include rate

    5. Summary

    ScenarioConfiguration
    Police all traffic to 5 Mbpspolice 5000000 conform-action transmit exceed-action drop
    Limit Video (AF41) to 2 MbpsClass-based policing with exceed-action drop
    Mark excess traffic instead of droppingexceed-action set-dscp-transmit 10
    Three-color policing (Transmit, Mark, Drop)conform-action transmit, exceed-action set-dscp-transmit 10, violate-action drop
    Verify policingshow policy-map interface

    πŸš€ Traffic policing enforces bandwidth limits and protects network resources!

  • Traffic Shaping in QoS

    1. Introduction

    Traffic shaping is a QoS mechanism that controls the rate of outbound traffic to prevent network congestion and packet loss. It smooths traffic bursts by buffering and delaying packets to maintain a steady transmission rate.

    πŸ“Œ Key Benefits of Traffic Shaping: βœ… Prevents network congestion
    βœ… Ensures consistent bandwidth allocation
    βœ… Helps with Service Level Agreements (SLAs)
    βœ… Reduces packet drops in bursty traffic


    2. How Does Traffic Shaping Work?

    Traffic shaping buffers excess packets in a queue instead of dropping them, then sends them at a regulated rate.

    Shaping vs. Policing

    FeatureShapingPolicing
    PurposeSlows down trafficDrops or marks excess traffic
    Effect on PacketsBuffers packets in a queueDiscards or reclassifies packets
    Use CaseWAN links, avoiding congestionEnforcing strict bandwidth limits
    Typical DeploymentOutbound (egress)Inbound (ingress) & outbound

    3. Configuring Traffic Shaping on Cisco Routers

    Cisco uses Class-Based Traffic Shaping (CBTS) to configure shaping per class of traffic.

    A. Shaping All Traffic on an Interface

    To shape all traffic on an interface to 5 Mbps:

    interface Serial0/0/0
    traffic-shape rate 5000000

    B. Class-Based Traffic Shaping

    1️⃣ Define a Class to Match Traffic:

    class-map MATCH-VOICE
    match ip dscp ef

    2️⃣ Create a Policy Map to Shape Traffic:

    policy-map SHAPE-POLICY
    class MATCH-VOICE
    shape average 1000000

    3️⃣ Apply to an Interface:

    interface GigabitEthernet1/0/1
    service-policy output SHAPE-POLICY

    πŸ”Ή Explanation:

    • Traffic matching DSCP EF (VoIP) is shaped to 1 Mbps.
    • Other traffic is not affected unless added to the policy.

    C. Configuring Hierarchical Shaping

    For multiple traffic types, use Hierarchical QoS:

    policy-map CHILD-POLICY
    class MATCH-VOICE
    priority 500
    class MATCH-VIDEO
    shape average 2000000

    policy-map PARENT-POLICY
    class class-default
    shape average 5000000
    service-policy CHILD-POLICY

    πŸ“Œ This means:

    • The parent policy shapes all traffic to 5 Mbps.
    • The child policy shapes VoIP to 500 Kbps and Video to 2 Mbps.

    4. Verifying Traffic Shaping

    βœ… To check if shaping is working:

    show policy-map interface GigabitEthernet1/0/1

    βœ… To monitor traffic rates:

    show interfaces GigabitEthernet1/0/1 | include rate

    5. Summary

    ScenarioConfiguration
    Shape all traffic to 5 Mbpstraffic-shape rate 5000000
    Shape VoIP to 1 Mbpsshape average 1000000
    Hierarchical shaping for multiple classesParent + Child Policy Maps
    Verify shapingshow policy-map interface

    πŸš€ Traffic shaping ensures a smooth and stable network experience by preventing congestion!

  • QoS Trust Boundary in Networking

    1. Introduction

    The QoS Trust Boundary defines where and how QoS markings (such as DSCP or CoS) are trusted, modified, or discarded in a network. It ensures that only trusted devices (like IP phones or network switches) can set QoS values, while preventing unauthorized or misconfigured endpoints from affecting network performance.


    2. Why is the Trust Boundary Important?

    If the network blindly trusts all QoS markings:
    🚨 Security Risk – End users could set high-priority DSCP values to get more bandwidth.
    🚨 Misconfiguration – Incorrect markings from endpoints can cause congestion.
    🚨 Unfair Bandwidth Usage – A normal PC could mark its traffic as VoIP, starving real-time applications.

    To prevent these issues, network devices must determine where to trust or overwrite QoS markings.


    3. Where Should the Trust Boundary Be Set?

    Trust Scenarios

    Trust ModelDescriptionExample Devices
    Trust at the EdgeQoS markings from endpoints are acceptedCisco IP Phones
    Trust at Access SwitchSwitch verifies and applies QoS policiesCisco Catalyst Switch
    Trust at Distribution/CoreOnly backbone switches/routers enforce QoSCore Routers

    Best Practices

    βœ… Endpoints (PCs, users) – 🚫 DO NOT TRUST (Override QoS values).
    βœ… IP Phones, APs – βœ… Trust QoS Markings (Mark and prioritize voice traffic).
    βœ… Access Switches – ⚠️ Conditional Trust (Verify markings, modify if needed).
    βœ… Core/Distribution Layer – βœ… Strictly Enforce QoS Policies.


    4. Configuring the QoS Trust Boundary on Cisco Switches

    Cisco switches allow administrators to set trust levels on interfaces:

    A. Trust DSCP from an IP Phone, Not from a PC

    Most Cisco IP Phones mark their own traffic correctly, but connected PCs should not be trusted.
    To trust only the phone’s QoS markings:

    interface GigabitEthernet1/0/1
    switchport mode access
    switchport voice vlan 10
    mls qos trust dscp
    • mls qos trust dscp β†’ Trust DSCP values from IP phones.
    • switchport voice vlan 10 β†’ Ensures that phone traffic is correctly prioritized.

    B. Remove Trust from an Untrusted Device (PC)

    To override markings from PCs:

    interface GigabitEthernet1/0/2
    mls qos trust cos
    mls qos trust device cisco-phone
    • mls qos trust cos β†’ Trust CoS (only if it’s coming from a phone).
    • mls qos trust device cisco-phone β†’ Trust markings only from a Cisco IP phone, not a PC.

    C. Rewriting QoS Markings (Reclassify Traffic)

    If untrusted devices send incorrect markings, we can override them:

    policy-map RECLASSIFY
    class class-default
    set dscp default

    interface GigabitEthernet1/0/3
    service-policy input RECLASSIFY
    • This resets all traffic to DSCP 0 (Best Effort) unless explicitly classified.

    5. Verifying Trust Settings

    To check trust settings on an interface:

    show mls qos interface GigabitEthernet1/0/1

    To see traffic classification:

    show policy-map interface GigabitEthernet1/0/1

    6. Summary

    ScenarioConfiguration
    Trust DSCP from IP Phonemls qos trust dscp
    Trust CoS from Cisco Phones Onlymls qos trust cos; mls qos trust device cisco-phone
    Remove Trust from a PCApply policy to reset DSCP to default
    Check Trust Settingsshow mls qos interface

    βœ… Proper trust boundary configuration prevents abuse and ensures fair traffic prioritization! πŸš€

  • QoS Classification and Marking

    1. Introduction

    Quality of Service (QoS) ensures that critical traffic like VoIP, video streaming, and business applications get higher priority over less important traffic like bulk data transfers or web browsing.

    Key Concepts

    • Classification: Identifying and categorizing network traffic.
    • Marking: Assigning a priority value (like DSCP or CoS) to traffic.

    2. QoS Classification

    What is Classification?

    Classification identifies and groups network traffic based on parameters such as:
    βœ… Source/Destination IP or Port
    βœ… Application type (VoIP, Video, Web, FTP)
    βœ… Protocol (TCP, UDP, ICMP)
    βœ… Interface (LAN, WAN, VPN)

    Traffic Classification Methods

    MethodExample
    Access Control Lists (ACLs)Match traffic based on IP, protocol, or port
    Class MapsDefine traffic classes in QoS policies
    Network-Based Application Recognition (NBAR)Identifies applications dynamically (Skype, Zoom, etc.)
    802.1p (CoS)Layer 2 VLAN tagging
    Differentiated Services Code Point (DSCP)Layer 3 IP header marking

    πŸ“Œ Example of Traffic Classification Using ACLs:

    ip access-list extended VOICE-TRAFFIC
    permit udp any any range 16384 32767

    πŸ“Œ Using Class Maps to Classify Traffic:

    class-map MATCH-VOICE
    match access-group name VOICE-TRAFFIC

    3. QoS Marking

    What is Marking?

    Marking assigns priority values to packets so that network devices (routers, switches) can prioritize traffic accordingly.

    Common Marking Methods

    Marking TypeLayerBitsValue Range
    802.1p (CoS)Layer 2 (VLAN)3 bits0-7
    DSCP (Differentiated Services Code Point)Layer 3 (IP)6 bits0-63
    IP PrecedenceLayer 3 (IP)3 bits0-7

    πŸ“Œ Marking Traffic with DSCP (Layer 3):

    class-map MATCH-VOICE
    match ip dscp 46 # Expedited Forwarding (EF) for VoIP

    πŸ“Œ Marking Traffic with CoS (Layer 2 VLAN):

    class-map MATCH-VIDEO
    match cos 5 # High priority video

    4. DSCP Marking Values

    DSCP values define traffic priority levels:

    DSCP ClassDSCP ValueTraffic Type
    EF (Expedited Forwarding)46VoIP (Low Latency)
    AF41, AF42, AF4334, 36, 38Video Streaming
    AF31, AF32, AF3326, 28, 30Mission-Critical Apps
    AF21, AF22, AF2318, 20, 22Bulk Data
    CS0 (Default)0Best Effort

    πŸ“Œ Example Configuration – Mark VoIP Traffic as EF (DSCP 46):

    policy-map MARK-VOICE
    class MATCH-VOICE
    set dscp ef

    πŸ“Œ Trust DSCP on a Switch Port:

    interface GigabitEthernet1/0/1
    mls qos trust dscp

    5. Applying Classification and Marking on an Interface

    1️⃣ Create an ACL to Match VoIP Traffic

    ip access-list extended VOICE-TRAFFIC
    permit udp any any range 16384 32767

    2️⃣ Create a Class Map

    class-map MATCH-VOICE
    match access-group name VOICE-TRAFFIC

    3️⃣ Create a Policy Map to Mark Traffic

    policy-map MARK-VOICE
    class MATCH-VOICE
    set dscp ef

    4️⃣ Apply QoS Policy to an Interface

    interface GigabitEthernet1/0/1
    service-policy input MARK-VOICE

    6. Summary

    StepCommand
    Classify Trafficclass-map MATCH-VOICE
    Mark DSCP Valuesset dscp ef
    Mark CoS Valuesset cos 5
    Apply to Interfaceservice-policy input MARK-VOICE

    Conclusion:

    • Classification helps identify network traffic.
    • Marking assigns priority values (DSCP, CoS).
    • Proper QoS policies ensure that voice, video, and critical data traffic get prioritized over non-essential traffic.
  • IP Precedence and DSCP Values in QoS

    1. Introduction

    In Quality of Service (QoS), traffic is classified and prioritized to ensure better performance for critical applications. Two common packet marking mechanisms used in QoS are:

    1. IP Precedence (Legacy – 3 Bits)
    2. Differentiated Services Code Point (DSCP – 6 Bits)

    These values are set in the Type of Service (ToS) byte in the IP header to indicate priority levels.


    2. IP Precedence (Legacy)

    • 3-bit field (values: 0-7)
    • Used in older networks (before DSCP)
    • Higher values = Higher priority
    IP PrecedenceBinaryPriority LevelTraffic Type
    7111HighestNetwork Control
    6110HighInternetwork Control
    5101CriticalVoIP, Video
    4100HighStreaming Media
    3011MediumTransactional Traffic
    2010NormalBulk Data
    1001LowScavenger Traffic
    0000DefaultBest Effort

    πŸ“Œ Example Configuration (Mark Traffic with IP Precedence 5 – VoIP):

    class-map VOICE
    match ip precedence 5

    policy-map QOS-POLICY
    class VOICE
    priority 1000

    3. Differentiated Services Code Point (DSCP)

    • 6-bit field (values: 0-63)
    • More granular control than IP Precedence
    • Backward-compatible with IP Precedence

    DSCP Classes

    DSCP values are divided into different categories:

    1️⃣ Expedited Forwarding (EF – High Priority)

    DSCPBinaryDescription
    EF (46)101110VoIP, real-time apps

    🟒 EF (Expedited Forwarding) is used for low-latency traffic like VoIP.


    2️⃣ Assured Forwarding (AF – Prioritized Traffic)

    Assured Forwarding (AF) provides four service classes (AF1-4) with three levels of drop probability (Low, Medium, High).

    AF ClassDSCP ValueBinaryDrop Probability
    AF1110001010Low
    AF1212001100Medium
    AF1314001110High
    AF2118010010Low
    AF2220010100Medium
    AF2322010110High
    AF3126011010Low
    AF3228011100Medium
    AF3330011110High
    AF4134100010Low
    AF4236100100Medium
    AF4338100110High

    πŸ”΅ Example Use Case:

    • AF41 is used for video streaming.
    • AF31 is used for mission-critical applications.

    3️⃣ Default & Best Effort (Low Priority)

    DSCPBinaryDescription
    CS0 (0)000000Best Effort (Default)
    CS1 (8)001000Background Traffic

    🚫 CS0 (Best Effort) is used for general internet traffic without priority.


    4. Mapping Between IP Precedence and DSCP

    IP PrecedenceEquivalent DSCP
    0CS0 (0)
    1CS1 (8)
    2CS2 (16)
    3CS3 (24)
    4CS4 (32)
    5CS5 (40)
    6CS6 (48)
    7CS7 (56)

    5. Configuring DSCP on Cisco Devices

    Marking Packets with DSCP

    class-map MATCH-VOICE
    match ip dscp 46

    policy-map QOS-POLICY
    class MATCH-VOICE
    priority 1000

    Trust DSCP on an Interface

    conf t
    interface GigabitEthernet1/0/1
    mls qos trust dscp
    exit

    6. Summary

    • IP Precedence (Legacy): 3-bit field (0-7), basic priority levels.
    • DSCP (Modern QoS): 6-bit field (0-63), more flexibility.
    • EF (46) for VoIP, AF41 for Video, CS0 for Best Effort.
  • Introduction to QoS (Quality of Service) in Networking

    What is QoS?

    Quality of Service (QoS) is a set of technologies and techniques used in networking to manage and prioritize traffic, ensuring efficient data transmission, reduced latency, and improved performance for critical applications.

    Why is QoS Important?

    Without QoS, all network traffic is treated equally, which can lead to:
    βœ… Poor VoIP call quality (jitter, latency, packet loss)
    βœ… Slow video streaming (buffering)
    βœ… Delayed critical applications (business or cloud apps)

    QoS ensures that high-priority traffic (like voice and video) gets preferential treatment over less critical traffic (like file downloads or emails).


    Key QoS Concepts

    1. Bandwidth, Delay, Jitter, and Packet Loss

    TermDefinition
    BandwidthMaximum data transfer rate (measured in Mbps or Gbps).
    Delay (Latency)Time taken for packets to travel from source to destination.
    JitterVariation in packet delay (problematic for VoIP and video).
    Packet LossPercentage of lost packets, impacting data integrity.

    QoS helps reduce delay, jitter, and packet loss to improve network performance.


    2. Traffic Classification & Marking

    QoS classifies packets into different categories and assigns them priorities using Differentiated Services Code Point (DSCP) or Class of Service (CoS).

    Example of DSCP values:

    Traffic TypeDSCP Value
    VoiceEF (Expedited Forwarding – 46)
    VideoAF41 (Assured Forwarding – 34)
    Best Effort (Default)0
    Background TrafficCS1 (Class Selector – 1)

    To mark packets:

    class-map VOICE
    match ip dscp 46

    3. QoS Mechanisms

    QoS is implemented using multiple techniques:

    A. Traffic Classification & Marking

    • Identifies and labels packets based on type (voice, video, data).
    • Uses DSCP (Layer 3) or CoS (Layer 2).

    B. Queuing and Scheduling

    • Priority Queuing (PQ): Highest-priority packets are sent first.
    • Weighted Fair Queuing (WFQ): Fair distribution among multiple traffic types.
    • Low Latency Queuing (LLQ): Guarantees bandwidth for real-time applications like VoIP.

    C. Congestion Management

    • Random Early Detection (RED): Prevents congestion by dropping packets early.
    • Weighted Random Early Detection (WRED): Prioritizes higher-priority packets.

    D. Policing and Shaping

    • Policing: Drops excess traffic above a configured rate.
    • Shaping: Buffers excess traffic instead of dropping it.

    Example of policing:

    policy-map POLICE-TRAFFIC
    class VIDEO
    police 1000000 conform-action transmit exceed-action drop

    QoS Configuration on Cisco Devices

    1. Enable QoS on an Interface

    conf t
    interface GigabitEthernet1/0/1
    mls qos trust dscp
    exit

    2. Create a Class Map (Traffic Classification)

    class-map MATCH-VOICE
    match ip dscp 46

    3. Create a Policy Map (Traffic Treatment)

    policy-map QoS-POLICY
    class MATCH-VOICE
    priority 1000
    class class-default
    fair-queue

    4. Apply QoS Policy to an Interface

    conf t
    interface GigabitEthernet1/0/1
    service-policy output QoS-POLICY
    exit

    Conclusion

    QoS is essential for ensuring a smooth network experience, especially for real-time applications like voice, video, and business-critical services. By using traffic classification, marking, queuing, and congestion management, QoS optimizes performance and prevents network slowdowns.