test me

Site Search:
Showing posts with label CCNA. Show all posts
Showing posts with label CCNA. Show all posts

Computer networking under the hood

The author created this network study guide by breaking down large subject into small topics, so that we can learn each topic in detail. Computer networking is the foundation of modern society. Here we discuss computer networks built on hardwares, cloud computing, though based on the concepts studied here, is not discussed in this course.

Do It Yourself (DIY) is the best way of learning TCP/IP network, therefore, I highly recommend you to download wireshark and packet tracer. With wireshark, you can capture your network traffic and see exactly what's going on under the hood; with packet tracer, you can set up LAN and WAN virtually and do experiments on them. With some spare bucks, you can even setup a WAN lab at home by purchasing some cisco equipments.

Knowing networking technology is not only fun, it can also get you hired. The most popular network certification is Cisco CCENT and CCNA. If you haven't decided what CCNA test to take, read this post first. Also check out the Cisco device based networking Lab for the labs corresponding to this tutorial.

Whenever you need to learn more about a networking key word, use the Site Search at the upper left conner.

Good luck with your study and test!

(part 1)

Lesson 1
Networking Fundamentals and the Networking Models


In this first lesson, we talk about what is network in general. OSI model and TCP/IP model are visited. These models break network communication into smaller, simpler layers, which make learning easier. Within the context of network layers, the data transmission process is discussed, you will get a bird-view of how the internet makes your web surfing works even at the bit (electromagnetic pulse in cable wires) level. Several famous protocols are introduced: TCP, UDP, IP and ICMP. You will understand the concepts of Ports, Sockets and Port numbers, which are important to software engineers as well as network administrators. Finally, a few common TCP/IP network applications -- FTP, telnet, http are examined with wireshark, so that you get an sense of how these everyday magic happens under the hood.

* The Network We Know about
What is A Network
The TCP/IP Model
The OSI Model
The Data Transmission Process
* Same-Layer and Adjacent-Layer Interactions
TCP And UDP
IP and ICMP protocols
Ports, Sockets and Port Numbers
TCP/IP Applications
Network Topology

Lesson 2
Ethernet Standards and Cable Types


In this foot on the ground lesson, we delve into Ethernet standards and cable types. You will know about connectors such as RJ-11, RJ-45, fiber-optic GBIC and cable types such as UTP, STP, Fiber Optic. You will understand the category of UTP cables, so that when your cable guy says "Your home needs at least Cat 5", you can remain cool. You even gain knowledge about the pins on a cable, able to differentiate a straight-through cable from a crossover cable. Once two computers are connected with a cable, they need to communicate via the electromagnetic pulses in the cable wires. Physicists in the last century took a lot of effort to figured it out. This know how is the foundation of internet. We will learn this know how in topics CSMA/CD, Ethernet frame, ethernet addressing and host-to-host communication. This lesson has a lot of nitty-ditty details, but is crucial for setting up and trouble-shooting a real-world network made of metal and plastics.

What is a LAN
Ethernet Types And Standards
The Need For And Operation of CSMA/CD
Ethernet Frame
Ethernet Addressing
Host-to-Host Communication
Ethernet Connectors and Cable Types
Pins And Transmissions
Crosstalk

Lession 3
Fundamentals of WANs


LAN and WAN are build on OSI layer 1 and layer 2, where cable details such as transmission speeds, encoding, frames and physical links etc. are defined. We have learned LAN before, here lets talk about WAN. Compared with LAN, LAN usually covers a small distance, while WAN spans across a large geographic area. Your party owns LAN, but you most likely share WAN with other parties, so you probably don't have rights to modify the WAN infrastructure.


Lession 4
Switching


Now we know how 2 computers talk to each other, this lesson will study how a group of computers talk to each other. In this lesson we will met layer 1 devices repeaters and hubs, layer 2 devices bridges and switches, layer 3 device routers. While hubs and repeaters allow group computers to share links, switches and bridges divide computer groups in LANs. Routers defines the boundary of LANs.

Ethernet LAN Segments
Repeaters, Hubs, Bridges, Switches and Routers
MAC address learning and filter/forward decisions
Frame Processing Methods
Virtual LANs
Cisco Three-Layer Switching Model
Introduction to STP
Basic Switch Security

Lesson 5
Common Router and Switch Commands


Typical Switch (And Router) Commands are studied here, these commands are used daily by network administrators.

Video Lab - Packet Tracer Interface Overview
Physical Connections and Passwords
Cisco IOS software overview
Physical Side of Cisco Switches
User, Enable and Privilege Modes
Basic Switch managment commands
Switch/Router passwords configurations
Telnet and SSH
Switch Port Security Defaults, Options and Configurations
Banners“logging synch”, and “exec-timeout”
Keystroke Shortcuts and Manipulating History

Lesson 6
IP Addressing and the Routing Process


This lesson covers the fundamental concepts for IP addressing: binary math, subnetting, and working with network and port address translations.

IP Addressing and Binary Conversions
IP Address Classes
Private IP Address Ranges
CIDR network address
Intro to the Routing Process
Routing Process Continued -- Behind the "PING"
* Routing Protocols
Basic Router management commands
Switch/Router Interfaces and Physical Ports

Lesson 7
ARP, DNS and DHCP


DNS Process
The ARP RARP and DHCP Process
Broadcast, Multicast, and Unicast
Intro to Security Device Manager (SDM)

Lesson 8
Memory Components and Config Files


This lesson covers basic password and security configurations, as well as assigning privilege levels, which is the foundation of router security and the basic password recovery process.

ROM, RAM, NVRAM, And Flash
The Boot Process
Setup Mode
Configuration Files and IOS Upgrading
The Configuration Register

Lesson 9
Intro to Wireless Networks (WLANs)


Learn the protocol as well as physics side of wireless.

Wireless LAN overview
Wireless Standards
Spread Spectrum
Antena Types
CA vs. CD
SSID, MAC Address Authentication, WEP, WPA, and WPA2

Lesson 10
Binary Math and Subnetting


The content learned in this lesson is essential for IP addressing and IP address conservation.

Decimal > Binary, Binary > Decimal
Subnetting Basics
Four common subnetting scenarios

Lesson 11
Static Routing and RIP – Part 1


In this lesson, you will see the work done over a Cisco router. You will learn how to manually set up routing.

Static Routing Theory
Floating Static Routing
RIP Routing Theory
Video Lab -Static Routing and RIP Routing

Lesson 12
Wide Area Networks (WANs)


At the end of this course, let's revisit some WAN concepts and get some hands on exercise with cisco equipment

WAN interface of Cisco Router and WAN Cabling
* Layer 2 WAN encapsulations
HDLC and PPP
NAT and PAT
NAT overloading Example
Video Lab - Internet Connections with NAT and PAT
Video Lab - Router as DHCP Server
WAN Trouble-shooting

Lesson 13

Introduction to Network Security


Network security has become more and more important in today's internet. In this lesson, you will learn about network attackers and intruders, how they get in, and how to keep your network save by keeping them out.

The need for network security
Classes of Hacker Attacks
Firewalls and Proxy Servers
The Attacker’s Arsenal
Intro to PIX, ASA, IDS, and IPS
Viruses, Worms, and Trojan Horses
Preventing Virus Attacks

Lesson 14
Troubleshooting


95% of work in the real world is troubleshooting, so it’s necessary for real world success.

Cisco Discovery protocol (CDP)
L1 and L2 Troubleshooting
Telnet and SSH Maintenance Commands
* Administrative Distance
Extended Ping and Traceroute



(part 2)


Lesson 1
Switching II

This lesson revisits the basic concepts of switch and VLAN learned in CCENT, adds more cisco labs about how to configure the switch and router for VLAN.

Switch Basic Concept Review
* STP
* Root Bridges, Root Ports, and Designated Ports
* STP Timers and Port States
* Portfast
* VLANs and Trunking
* Access and Trunk Port Comparison
* VTP
* “Router on a Stick”
* RSTP and PVST
* Etherchannels



Lesson 2
PTP WAN Links, HDLC, PPP, and Frame Relay


This lesson is about Frame Relay.

WAN Trouble-shooting
* HDLC vs. PPP
* WAN Topology
* PPP Features
* PAP and CHAP
* Frame Relay Introduction
* Frame Relay LMI Theory
* Frame Relay Configs, DLCIs, Frame Maps, and Inverse ARP
* Frame Sub-Interfaces3
* Split Horizon
* Frame Relay LMI Show, Debug, and Lab
* FECN, BECN, DE bits
* PVC Status Meanings

Lesson 3
Static Routing and RIP


covering advanced topics about RIP.

* Static Routing Theory and Configuration
* Distance Vector Protocol Behavior – Split Horizon and Route Poisoning
* RIP Theory and Version Differences
* The Joy of “show ip protocols”
* RIP Limitations
* RIP Timers
* Floating Static Routes



Lesson 4
OSPF


OSPF is an Internet protocol we need to know how to configure.

* Link State Routing Protocol Concepts and Basics
* The DR and BDR
* Hello Packets
* Troubleshooting Adjacency Issues
* Hub-and-Spoke NBMA OSPF Networks
* Broadcast Networks
* The OSPF RID
* OSPF Router Types
* Advantages of OSPF
* Point-to-Point OSPF Networks
* Default-Information Originate (always?)
* OSPF Authentication



Lesson 5
EIGRP


this hybrid routing protocol has increased operational efficiency from it predecessor.

* Introduction to EIGRP
* Successors and Feasible Successors
* EIGRP vs. RIPv2
* Basic Configuration
* Wildcard Masks
* Load Sharing (Equal and Unequal-cost)
* EIGRP, RIPv2, and Autosummarization
* Passive vs. Active Routes



Lesson 6
IP Version 6 and NAT


Learn the basic theory and routing protocol of IP version 6.

* IPv6 Theory and Introduction
* Zero Compression and Leading Zero Compression
* IPv6 Reserved Addresses
* The Autoconfiguration Process
* OSPF v3 Basics
* Transition Strategies
* NAT Theory and Introduction
* Static NAT Configuration
* Dynamic NAT Configuration
* PAT Configuration



Lesson 7
VPNs and IPSec


This lesson is about how to setup and run a VPN network.

* Definitions and Tunneling Protocols
* Data Encryption Technologies
* Key Encryption Schemes
* IPSec, AH and ESP
* A VPN in Your Web Browser



Lesson 8
ACLs and Route Summarization


Learn to configure and control ACLs. Learn the basic breakdown and how to summarize routes. Learn common commands for working with RIP & EIGRP.

* ACL Login and the Implicit Deny
* Standard ACLs and Remarks
* “Host” and “Any”
* The Order of the Lines
* Extended ACLs
* Named ACLs
* Telnet Access, Placing ACLs, and Blocking Pings
* Dynamic and Time-Based ACLs
* Port Number Review
* Route Summarization with RIP and EIGRP

See also 640-822 ICND1 Exam Topics (Blueprint)






ISP, POP, NSP, NAP, MAE, IXP

Back>

The following diagram is an overall architecture of internet.

You home PC connects to a home LAN, your home LAN then connects to a tier 3 ISP, the tier 3 ISP have access to a NSP's network infrastructure (fibers, routers etc.) via a POP. These NSPs have peer to peer connections via NAP or IXP, so that the internet made of inter-connected NSPs span the whole globe.
ISP and NAP

  • Local Loop also called "last mile", is a copper or fiber cable that connects the demarc to the closest switching office, called a central office. In the diagram, the local loop is a T1 line.
  • Internet Service Provider (ISP), An Internet Service Provider (ISP) is a company that provides Internet access. The most common ISP is the provider who delivers Internet to your home or business for a fee. 
  • Central office (CO) also called point of presence (POP), connects the customers to the provider's switching network. It is the entry point to the WAN cloud and the exit point from the WAN for called devices. The tier 3 Internet service provider (ISP) often has multiple point-of-presence in major cities, which are connected together by the leased lines from NSP.
  • Network Service Providers (NSP) A network service provider (NSP) is a company that owns, operates and sells access to internet backbone infrastructure and services. They often sell network to tier 3 ISPs, or act as ISP by themselves. NSPs build and maintain the fiber optic cable and core routers. Some of the large NSPs are UUNet, CerfNet, IBM, BBN Planet, SprintNet, PSINet, as well as others. These networks peer with each other to exchange packet traffic via NAP. 
  • Network Access Points (NAP) is a public network exchange facility where Internet Service Providers (ISPs) can connect with one another in peering arrangements. The NAPs are a key component of the Internet backbone because the connections within them determine how traffic is routed. They are also the points of most Internet congestion.
  • Metropolitan Area Exchanges (MAEs). MAEs serve the same purpose as the NAPs but are privately owned. NAPs were the original Internet interconnect points. Both NAPs and MAEs are referred to as Internet Exchange Points (IXs).
  • Tier 1 ISP, Tier 2 ISP and Tier 3 ISP, ISPs are categorized by their size. Tier 3 are generally small ISPs who only purchase their connection to the Internet from NSP. Tier 1 are generally internet giant NSP who owns so much network infrastructure that they don’t need to purchase any connection from other ISPs. These major players “peer” with other to allow the traffic between their networks to flow back and forth. Tier 2 are providers who have some interconnection agreements, but who also purchase some connections. Largest Tier 1 Internet providers are the networks that provide the backbone of the Internet. These providers build infrastructure such as the Atlantic Internet sea cables. These infrastructures allow the data exchange between continent and countries. Examples are Hibernia Networks, Cogent Communications.

WAN Topology

A topology is a description of a layout or arrangement. There are two kinds topology perspective for WANs. One perspective is the physical topology, another perspective is the logical topology, they are different but related.

In physical side of WANs, we talked about he physical layout of the network, which describes the physical arrangement of network devices that allow for data to move from a source to a destination network. In contrast, logical WAN topology describe the path a signal takes through the physical topology. There are 3 types of WAN Topology options.

Star

A star topology involves a central location serving as the hub in the design. In a star topology, while a failure to a regional hub or router will not affect the other sites on the WAN, the central hug or router introduces a single point of failure. The central hub also limited the overall performance for the WAN. Due to the importance placed on the central location serving as the hub, redundant routers often introduced to provide site reliability.

Full Mesh

The advantage of a star topology is low cost on equipment and administration labor, however, it suffers disadvantage of low reliability. A full mesh topology, on the other hand, has every site’s WAN router connected to every other site on the wide area network. With such high level of redundency, full mesh topologies provide a high degree of dependability and fault tolerance with high equipment cost and high administrative complexity. In full mesh topology, many virtual circuits are required to establish at least one independent link between any 2 sites, which brings up the cost.

Partial Mesh

When full mesh removes some redundant connections for cost reduction, we get partial mesh topology. Companies can design a cost effective partial mesh topology that balance the fault tolerance, scalability and budget.

Etherchannels

Etherchannel Concept and configuration




EtherChannel is a port link aggregation technology or port-channel architecture used primarily on Cisco switches. It allows grouping of several physical Ethernet links to create one logical Ethernet link for the purpose of providing fault-tolerance and high-speed links between switches, routers and servers. An EtherChannel can be created from between two and eight active Fast, Gigabit or 10-Gigabit Ethernet ports, with an additional one to eight inactive (failover) ports which become active as the other active ports fail. EtherChannel is primarily used in the backbone network, but can also be used to connect end user machines.

Using an EtherChannel has many advantages
  • Larger bandwidth. By using the maximum of 8 active ports, a total bandwidth is increased 8 fold comparing to a single port. 
  • Scalable. Because EtherChannel takes advantage of existing wiring it makes it very scalable. It can be used at all levels of the network to create higher bandwidth links as the traffic needs of the network increase. All Cisco switches have the ability to support EtherChannel.
  • transparent to network applications. When an EtherChannel is configured, all adapters that are part of the channel share the same Layer 2 (MAC) address. This makes the EtherChannel transparent to network applications and users because they only see the one logical connection; they have no knowledge of the individual links.
  • Fault-tolerance. Should a link fail, the EtherChannel technology will automatically redistribute traffic across the remaining links. This automatic recovery takes less than one second and is transparent to network applications and the end user. This makes it very resilient and desirable for mission-critical applications.

Spanning tree protocol (STP) can be used with an EtherChannel. STP treats all the links as a single one and BPDUs are only sent down one of the links.

EtherChannels can be also configured as VLAN trunks. If any single link of an EtherChannel is configured as a VLAN trunk, the entire EtherChannel will act as a VLAN trunk.

EtherChannel is made up of the following key elements:


  • Ethernet links — EtherChannel works over links defined by the IEEE 802.3 standard, including all sub-standards. All links in a single EtherChannel must be the same speed.
  • Compatible hardware — the entire line of Cisco Catalyst switches as well as Cisco IOS software-based routers support EtherChannel. Multiple EtherChannels per device are supported (Catalyst 6500 and 6000 switches support a maximum of 64 EtherChannels).
  • Configuration — an EtherChannel must be configured using the Cisco IOS on switches and router, and using specific drivers when connecting a server. There are two main ways an EtherChannel can be set up. The first is by manually issuing a command on each port of the device that is part of the EtherChannel. This must be done for the corresponding ports on both sides of the EtherChannel. The second way is using Cisco Port Aggregation Protocol (PAgP) for the automated aggregation of Ethernet ports.

EtherChannel vs. 802.3ad

EtherChannel and IEEE 802.3ad standards are very similar and accomplish the same goal. There are a few differences between the two, other than the fact that EtherChannel is Cisco proprietary and 802.3ad is an open standard, listed below:

Both technologies are capable of automatically configuring this logical link. EtherChannel supports both LACP and Cisco's PAgP, whereas 802.3ad uses LACP.

LACP allows for up to 8 active and 8 standby links, whereas PAgP only allows for 8 active links.


Cisco Lab


[ICND1 and ICND2 break down]


RSTP and PVST

Rapid spanning tree protocol (RSTP)


Rapid Spanning Tree Protocol (RSTP), which was designed to take over the duties of STP was standardized in IEEE 802.1w and 802.1D. Compare to STP, RSTP has shorter converge time both on startup and failure recovery.

(R)STP attempts to avoid this endless loop problem by removing the redundant path. Both RTP and RSTP need to elect a root bridge (or switch) based on priority and bridge ID.

These priorities and bridge IDs are relayed through the exchange of Bridge Protocol Data Units (BPDUs), which are sent by RSTP every “hello” interval—by default, every two seconds. The bridge that has the superior priority or bridge ID is elected the root bridge.

A big difference between the original STP and RSTP is in how they converge. With the original STP, all of the switches must wait as the interfaces go through blocking (at startup), listening, learning port states (total 50 seconds) before transition to forwarding state. With RSTP, a proposal and agreement (P/A) process is put in place, which is automatically used as soon as an interface comes up. This P/A process drastically shortens the time needed for an interface to move into a forwarding state. However, this process only happens on what RSTP calls point-to-point (p2p) links.

Cisco switches use the duplex setting of an interface to determine the link type. Interfaces with a full-duplex setting follow the P/A process; interfaces with a half-duplex setting go through the slower STP convergence process (30 seconds total) before converging. An exception to this rule is root ports, which are automatically pushed into a forwarding state when a switch is brought up. In RSTP, these half-duplex links are referred to as shared (Shr) links. RSTP also defines a third type of link, edge links; these ports operate like older Cisco PortFast ports and are automatically put into a forwarding state.

RSTP has a 4 types of ports. The alternative and backup ports does not exit for for STP. These states are a method of indicating preferred secondary paths. The alternative port state indicates that an interface will be the next potential root port if the current root port fails. The backup port state indicates that an interface will be the next potential designated port; this only happens when a switch has multiple links into the same Ethernet segment.

  1. root port: a forwarding port that forwards frame from Non-root bridge to Root bridge.
  2. designated port: the frame exiting port for every LAN segment.
  3. alternate port: as it name implies, is an alternate path to the root bridge which does not use the root port.
  4. backup port: a redundant path to a segment where another bridge port already connects.

The port states are also referenced differently in RSTP. STP has five port states: disabled, blocking, listening, learning, and forwarding. RSTP combines those states into a total of three: discarding (disabled, blocking, listening), learning, and forwarding.

  1. Discarding – wherein a port discards information received on the interface, discards frames switched from another interface for forwarding, does not learn MAC addresses, and listens for BPDUs.
  2. Learning – a situation where the switch creates a switching table that will map MAC addresses to a port number. It also happens when a port discards frames received on the interface, discards frames switched from another interface for forwarding, learns MAC addresses, and listens for BPDUs.
  3. Forwarding – wherein a port receives and forwards the frames received on the interface, forwards frames switched from another interface, learns MAC addresses, and listens for BPDUs.

PVST -- Cisco’s RSTP Implementation

Cisco’s default implementation of STP differs from the standard. Instead of using a single STP instance that works over all of the network, including over all configured VLANs, Cisco implements an STP instance for each specific VLAN, which is referred to as Per-VLAN Spanning Tree (PVST).

It is based on the 802.1D standard and uses Cisco proprietary ISL trunking protocol. It prevents creating a loop by forwarding some VLANs on another trunk. It is the default spanning-tree mode used on all Ethernet port-based VLANs.

PVST is succeeding by Cisco proprietary extensions like BackboneFast, UplinkFast, and PortFast.

Cisco Lab


Here is an video demonstrating how to configure RSTP on sisco switches.



[ICND1 and ICND2 break down]

“Router on a Stick”

So far we have been exposed to "Router on a Stick" configuration twice. One is the second video in CCENT Virtual LANs, another time is in CCNA VLANs and Trunking.

Router-on-a-stick is a term frequently used to describe a setup up that consists of a router and switch connected using one Ethernet link configured as an 802.1q trunk link.

router on a stick
router on a stick


As the picture shows, a router is used to allow inter-VLAN communication. There is only a single cable connecting the switch and the router, so the router is sitting on a stick (instead of 2 sticks).

the switch config involves:

  • configuring the VLANs 
  • configure a port as trunk mode in order to connect to router


Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#interface FastEthernet0/4
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk


the router config include:

  • select a physical port as the port connecting to switch.
  • configure a sub interface for each VLAN on the switch. 


Router(config)#interface gigabiteEthernet0/0
Router(config-if)#no ip address
Router(config-if)#interface gigabiteEthernet0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip add 192.168.5.1 255.255.255.0
Router(config-subif)#interface gigabiteEthernet0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip add 192.168.10.1 255.255.255.0
Router(config-subif)#interface gigabiteEthernet0/0.30
Router(config-subif)#encapsulation dot1Q 30
Router(config-subif)#ip add 192.168.15.1 255.255.255.0

[ICND1 and ICND2 break down]

VTP

The VLAN trunking protocol (VTP) is a Cisco-proprietary protocol that provides a way to manage Cisco switches as a single group for VLAN configuration. It ease the burden of configuring individual VLANs on multiple switches. VTP defines a VTP management domain where Cisco switches in the domain have VTP enabled. With VTP, you can create a new VLAN on one switch, and have VTP spread the information and configure the same VLAN on all other switches in the same domain automatically.

Each switch in a VTP management domain must be configured in one of four possible VTP modes:


  1. Server mode: A switch configured in server mode can be used to add, delete, and change VLANs within the VTP management domain. It is the default VTP mode. There must be at least one switch with server mode per VTP management domain. Changes in the server are passed to all other switches in the VTP management domain.
  2. Client mode: A switch configured in client mode is the recipient of any changes within the VTP management domain, such as the addition, deletion, and modification of VLANs by a server mode switch. A switch in VTP client mode cannot make any change to VLAN information.
  3. Transparent mode: A witch configured in transparent mode passes VTP updates received by switches in server mode to other switches in the VTP management domain, but does not process the contents of these messages. When individual VLANs are added, deleted, or changed on a switch running in transparent mode, the changes are local to that particular switch only, and are not passed to other switches within the VTP management domain.
  4. Off: The option disable VTP completely on a switch, it is only available after COS version 7.1.1.

Access and Trunk Port Comparison

In last section VLANs and trunking, we have talked about access link and trunk link, here is a recap:

trunk link - frames entering trunk link will be sent with VLAN tag.
access link - frames entering access link will be sent untagged.

The switch ports of a trunk link are trunk ports, the switch ports of the access link are access ports.

A frame received on an access port (i.e., sent from a host) is not VLAN tagged. It is the switch that tags the frame (with the VLAN number that is assigned to the receiving access port). If it needs to send that frame out on the trunk port. If the frame is destined for another access port, the frame is not tagged.

If a frame comes in on a trunk port it should already be tagged with a VLAN number (unless it is in the native VLAN which is not tagged). The switch then strips the VLAN tag and sends it out on the appropriate access port (or ports if broadcast) to its destination.

Depends on the model, the switch port is by default dynamic auto.
we can change the switch port mode to trunk to allows all vlans(pretagged) traffic to flow to and from it. It is most common to use 802.1q as vlan tagging method.

int fa0/0

switchport mode trunk

switchport trunk encapsulation dot1q


We can also change the switch port mode to access then assign a VLAN ID to this port.

int f0/1

switchport mode access

switchport access vlan 10

Here is an cisco lab configuring both access port and trunk port.

[ICND1 and ICND2 break down]

VLANs and Trunking

LAN vs VLAN


Ethernet LANs are broadcast domains where information transmitted by any network device in the domain is received by all devices attached to the LAN via the shared transmission medium. In a LAN with many devices, if only hubs are used in the network, a single large broadcast domain is created and the frequent broadcast messages can easily consumes all the bandwidth. Broadcasts are stopped only at the router, which is the edge of the broadcast domain, before traffic is sent across the WAN.

If we replace the hubs with switches, we can create VLANs within the existing large physical broadcast domain, in order to segment and isolate network traffic, reduce unnecessary broadcast traffic.

A virtual LAN, or VLAN, is a group of computers, network printers, network servers, and other network devices that behave as if they were connected to a single network. Hosts belong to a VLAN share the same VLAN ID,  and hosts with the same VLAN ID behave as if they are on the same physical network. In its basic form, a VLAN is a broadcast domain. The difference between a physical broadcast domain and virtual broadcast domain defined by a VLAN is that a broadcast domain is seen as a distinct physical entity with a router on its boundary. VLANs are similar to broadcast domains because their boundaries are also defined by a router. However, a VLAN is a logical topology, which is independent of the physical topology -- it can contains a group of devices on either the same or different physical LAN segments, those ones physically wired with cables.

Another advantage of VLAN is that users can be grouped according to their logical communication requirement instead of physical location. Your sales team might spread across different floors, different building, or even different cities, as long as their computers belong to the same VLAN, they can communicate to each other as if they are in the same physical LAN segment.

VLAN membership


There are three types of VLANs depending on how they decide VLAN membership.

  1. Port-based VLAN: computers are assigned to a VLAN based on the switch port to which the computer is connected. When the same computer is connected to a different switch port, its VLAN membership might change if the other switch port are assigned to a different VLAN.
  2. MAC-based VLAN: a computer is assigned to a VLAN according to its MAC address. The advantage of MAC-based VLAN is PCs can move around all the time and still belongs to the same VLAN without extra configuration. However, since PC's MAC address is tied to a particular VLAN, changing its VLAN membership is harder comparing to port-based VLAN. Network administrator needs to configure it at switch side or the switch side has special feature to support multiple VLAN membership.
  3. IP-based VLAN: a computer is assigned to a VLAN based on network layer address, such as IP address. IP-based VLAN can keep the PC's IP address when they moves around. Note switches are layer 2 devices. Even though layer 3 IP address is used to differentiate VLAN members, the device is assigned to a layer 2 broadcast domain. The switch still forwards frames instead of packets. Due to additional switch processing, IP-based VLAN tend to have worst performance among the 3 types of VLANs.

VLAN to VLAN communication


When a host in one broadcast domain wants to communicate with another host in a different broadcast domain, the packets have to travel cross the domain border via a router. Since VLANs are basically broadcast domains, inter-VLAN communications also have to involve a router. 

The routing function can either be provided by a router a layer 3 switch. 

In the case of a router, the message delivery process is: 
  • a VLAN A PC1 connected to switch port 1 sends traffic to VLAN B PC2.
  • The traffic leaving the host in VLAN A reaches the switch through the switch port 1.
  • Switch saw the destination belongs to a different broadcast domain, so it pass the traffic to the router via switch port 2.
  • router checks its routing table, passes the traffic back to the switch port 3.
  • switch gives the traffic to the host PC2 in VLAN B via port 4.
A layer 3 switch is essentially a layer 2 switch that can also act as a router. If a switch is capable of being configured to route traffic between VLANs defined within the switch, the inter-VLAN traffic doesn't have to leave the switch for routing decision. Even though layer 3 switch need additional hardware and software feature to support routing, it saves a physical router device as well as reduce unnecessary routing traffic, therefore they are very popular in corporate network.

VLAN trunks


We can interconnecting switches to create bigger VLANs, these interconnections are called trunk links. Trunk links generally are faster than the VLANs they are connecting, because these links sometimes need to carry the traffic of more than one VLANs.

A simple case is extending a VLAN (say VLAN 10) to another switch. In order to do that, we configure VLAN 10 on the second switch, then connect a VLAN 10 port on the first switch to a  VLAN 10 port on the second switch with a cable. By default, these connected ports act as a trunk link between these two switches. However, since these ports pass traffic only for the VLAN 10, this type of link, in which traffic for only a single VLAN is passed, is referred to as an access link, as opposed to a trunk link, which carries traffic for multiple VLANs.

When multiple VLANs need to pass traffic between switches, we need to assign an access link for each VLAN, which occupies lots of switch ports. These VLANs can share a single trunk link instead of having a dedicated access link for each one of them. Now VLANs traffic are mixed in the shared trunk link, therefore, at the receiving switch, in order to identify the destination VLAN's traffic, VLAN tagging is used.

Inter-Switch Link (ISL) and 802.1q are two of the tagging technologies. ISL is a Cisco proprietary VLAN tagging method; 802.1q is an open standard  both cisco and non-cisco switches support.

ISL and 802.1q are similar in operation. ISL for example, tags a frame as it leaves a switch, the tagging adds additional information to the frame about which VLAN the frame belongs to. When the tagged frame reaches the port at the receiving switch, the switch looks at the ISL header, determines which VLAN the frame belongs to, then removes the ISL tag, then forwards the frame into the VLAN specified in the VLAN tagging.

After VLAN tagging has been configured on the ports associated with the link connecting switches, the link is known as a trunk link.

Cisco lab


We have talked enough about VLANs and VLAN trunks, lets put all these concepts together by configure VLANs involving a few PCs, 2 cisco swithces and a router. The following video demonstrates how to configure VLANs and VLAN trunks, it also shows how to configure a router to route traffic between VLANs (router on a stick).



[ICND1 and ICND2 break down]

Portfast



When a new switch port joins STP network, it starts at blocking state, stays as blocking for 20 seconds, then transition to listening state, stay there for 15 seconds, then transition to learning state, stay there for 15 seconds, finally transition to forwarding state and start to forwarding frame.

Portfast is a cisco preparatory feature which allows a port participating STP to skip the first 3 states, namely blocking, listen, learning, and directly go to forwarding state. This allow the port start to work 50 seconds earlier than usual, thus the name portfast.

You can use PortFast to connect a single end station or a switch port to a switch port. If you enable PortFast on a port that is connected to another Layer 2 device, such as a switch, you might create network loops.

The cisco commands for enable portfast on a switch port is as the follows.

Console> (enable) set spantree portfast 4/1 enable
Warning:Connecting Layer 2 devices to a fast start port can cause
temporary spanning tree loops. Use with caution.

Spantree port  4/1 fast start enabled.
Console> (enable) show spantree 4/1
Port      Vlan  Port-State     Cost   Priority  Fast-Start  Group-method
--------- ----  -------------  -----  --------  ----------  ------------
 4/1      1     blocking          19        20   enabled              
 4/1      100   forwarding        10        20   enabled              
 4/1      521   blocking          19        20   enabled              
 4/1      522   blocking          19        20   enabled              
 4/1      523   blocking          19        20   enabled              
 4/1      524   blocking          19        20   enabled              
 4/1      1003  not-connected     19        20   enabled              
 4/1      1005  not-connected     19         4   enabled              

Console> (enable)

You can disable portfast on a switch port as well.
Console> (enable) set spantree portfast bpdu-guard disable
Spantree portfast bpdu-guard disabled on this switch.
Console> (enable) show spantree summary
Summary of connected spanning tree ports by vlan

Portfast bpdu-guard disabled for bridge.
Uplinkfast disabled for bridge.
Backbonefast disabled for bridge.

Vlan  Blocking Listening Learning Forwarding STP Active
----- -------- --------- -------- ---------- ----------
   1         0         0        0          4          4
   2         0         0        0          4          4
   3         0         0        0          4          4
   4         0         0        0          4          4
.
.
.
1003         0         0        0          0          0
1005         0         0        0          0          0

      Blocking Listening Learning Forwarding STP Active
----- -------- --------- -------- ---------- ----------
Total        0         0        0         85         85

Console> (enable) 

There are other portfast command variations, such as enable/disable them in a bulk or set portfast globally, these variations can be retrieved from cisco command line help.


[ICND1 and ICND2 break down]