Introduction to Switching
Introduction To Switching
1. Layer 2 Technology and problems.
2. Switch and its Functions.
3. Features of Switches:-
3.1. Maintains Mac or CAM table.
3.2. Prevents Layer 2 loops.
3.3. Forwarding.
(a). Unicasting.
(b). Broadcasting.
(c). Multicasting.
3.4. Duplexing and Speed.
4. Difference Between Switch and Hub.
5. VLAN (Virtual Local Area Network).
6. VLAN Connections.
6.1. Access Links.
6.2. Trunk Links.
(a). DTP (Dynamic Trunking Protocol).
7. Interview questions for Network Engineer L1 asked from Switching basic.
• Layer 2 Technology and problems:-
The most common Layer 2 LAN technology is Ethernet and Ethernet comes with 2 main disadvantages-
Distance- Depending on the cabling type the distance to which signal can travel is limited. One solution is to connect a repeater to repeat the signal to increase the range of the signal and other would be to use Fibre cabling instead of copper.
Collisions- The other main problem with Ethernet is the collisions. The devices in a collision domain send signals at random time intervals so there are high chances that at a point of time more than one device sends signals through the link and the signals collide in between. Although there is more to it but for the interview perspective this much is enough. The more devices connected into a segment the more collisions experienced generally and the more collisions means less efficiency.
Earlier Bridges were used to resolve collision problems but now we have switches which are more efficient at it.
Before moving further its important to understand collision domains and broadcast domains first.
Collision Domains- All the devices sharing the same media type at layer 1 of the OSI model Physically or Logically is referred to be in the same collision domain. For example, all the devices sharing a single ethernet cable or all the devices connected with different cables but using a hub for connection
Broadcast domain- All the devices connected logically on layer 2 and the broadcast signals reaching all the devices in the domain are referred to be in a broadcast domain. Mainly layer 3 switches or routers are used to separate the broadcast domains such as the network efficiency could be increased and bandwidth could be used in a more optimized manner.
** For more clarity on these, go to google and search ‘collision and broadcast domains’ > then click on images.
• Switch and its Functions:-
Switches are basically responsible for LAN connectivity, eradicating Layer 2 loops using STP and smart forwarding based on mac-addresses. Switches use ASICs (Application Specific Integrated Circuits) Hardware based specialized processors designed to perform few specific tasks. As switches performs only few tasks.
All the endpoint devices like- PC’s, Printers, etc are connected to the switch and then switch would be connected to core switch or router or firewall based on your network architecture. There are different models of switches and the number of ports vary according the requirements, there are 24 port switches and 48 ports and then there is stacking in order to provide redundancy and increase the number of ports.
• Features of Switches:-
1.Maintains Mac or CAM table:-
A switch maintains Mac or CAM table which consists of ports and Mac addresses. This table provides the information of which port is connected to which Mac address. So, if you have the mac address of a device and wants to find out on which port that device is connected then you can refer the Mac table and you’ll find on which port of the switch that mac address is learned. When a data packet arrives on the switch through a particular port, the switch adds the source mac address received with the port number into its mac table.
2.Prevents Layer 2 loops:-
The companies demand for Zero downtime makes them use multiple links to provide redundancy in the network and using multiple links makes the network prone to layer 2 loops (How the loop is formed will be discussed in the coming STP article). Hence, this loop formation issue is resolved by the switches with the help of STP which is a cisco proprietary protocol and works on layer 2.
3.Forwarding:-
Switches use smart forwarding in which they use the destination mac-address to forward the frames smartly. Switches forwards frames in 3 ways-
Unicasting- Unicasting is when the frame is forwarded to a specific known destination (One to One). When there is a specific known mac-address of a device present in the destination, the switch matches its mac table and checks to which port the destination mac is bind or learned and transmits the frame through that port.
Broadcasting- Broadcasting is when the frame is forwarded to all the devices in a network or subnet or vlan, whichever is applicable (One to all). Broadcasting happens in 2 scenarios-
When there is a unknown unicast mac-address in the destination- In this case the switch reads the destination mac and matches it with its mac table but doesn’t find a match in the table. Hence, decides to transmit or broadcast it through all the ports except the one it received.
When there is a broadcast mac-address in the destination- In this scenario the switch reads the destination mac and straight away knows that it’s a broadcast mac (FFFF.FFFF.FFFF) and broadcasts the frame.
Multicasting- Multicasting is when the frame is forwarded to a specific group of devices or ports (One to many). When there is a multicast mac-address in the destination of the frame, the switch straightaway realizes and multicasts the frame. The multicast mac-addresses starts with 01-00-5E and rest digits depends on the application you are using.
4.Duplexing and Speed:-
The switches support Half-Duplex, Full-Duplex and Auto. You can set the duplex setting according to your need, by default its on ‘Auto’ in cisco switches and most other vendors as well. The Duplex and speed setting should be same and correct on both sides else you would encounter issues with your data transmission, incorrect speed setting configuration could even result in link failure as well.
Half-Duplex: Half-duplex is a communication mode where data transmission can occur in both directions, but only one direction at a time. It’s like a walkie-talkie: one person talks while the other listens, but not both at once.
Full-Duplex: Full-duplex is a communication mode where data can be sent and received simultaneously between two devices on a network link.
Auto: Auto mode, or auto-negotiation, is a feature that automatically determine and agree on the best possible speed and duplex settings for communication.
• Now lets see the differences between Switch and Hub:-
|
Switch |
Hub |
|
|
|
Speed |
Fast (Uses ASIC) |
Slow |
Layers |
2 or 3 |
1 |
Broadcast Domain |
1 per VLAN |
1 |
Collision Domain |
1 per Port |
1 |
Maximum Ports |
8 |
Could go upto
Hundreds |
Duplex |
Half |
Half/Full/Auto |
• VLAN (Virtual Local Area Network):-
Working with physical LAN comes with a issue, lets consider a scenario-
Imagine setting up an office with three departments: IT, Sales, and HR, each with 5 employees. You seat them in separate areas and connect their computers to a network switch.
Without VLANs, the switch treats all connected devices as part of the same network. If you want to move one HR employee to IT (say, due to increased workload), you'd need to physically move the computer and reconnect it to the IT section of the switch. This is time-consuming and not scalable.
With VLANs (Virtual LANs), you can create logical groupings on the switch:
VLAN 10 for IT
VLAN 20 for Sales
VLAN 30 for HR
You assign 5 ports to each VLAN. Now, if you want to move one HR employee to IT, you don’t need to move the PC physically. You simply reassign the port from VLAN 30 (HR) to VLAN 10 (IT) in the switch configuration. The computer now becomes part of the IT network virtually, even if it's still sitting in the HR area.
** To be direct and specific- VLAN’s are used to restrict broadcast domains.
As we know when a switch receive broadcast traffic it floods the traffic through all the remaining ports even if its not meant for all the devices which isn’t efficient use of bandwidth and can cause slowness. So, we can resolve this issue with VLANs as the broadcast traffic is restricted to its own VLAN. That’s because a VLAN means a network or subnet and communicating among different VLANs means communicating among different networks and for this a layer 3 device is required which doesn’t forward broadcast traffic.
• VLAN Connections:-
Switches supports 2 types of switchports- access links and trunk links. You need to figure out which type of configuration you need to put on the port of the switch depending on your requirements. Lets discuss both the types of link connections now-
1. Access-links:-
An access-link connection is a connection between switch and standardized NIC card which only reads the standard frames that is IEEE 802.3 and Ethernet II which doesn’t understand tagged frames and that’s why the device or devices connected to access port will be in the same broadcast domain or should receive traffic from a single vlan only. For example- PC, Laptop, Printers, etc.
2. Trunk-Links:-
Trunk-links modifies standard ethernet frame to carry Vlan origin or Vlan Identifier (Vlan ID) so that the receiving device can understand the origin Vlan and on the basis of that it can smartly forward the traffic not just on the MAC address basis but on Source Vlan also. Hence, the trunk link can carry or forward multiple Vlan traffic.
Since information is added to the original Ethernet frame, normal NICs will not understand this information and will typically drop the frame. Therefore, you need to ensure that when you set up a trunk connection on a switch’s interface, the device at the other end also supports the same trunking protocol and has it configured. If the device at the other end doesn’t understand these modified frames or is not set up for trunking, it will, in most situations, drop them.
Cisco supports two Ethernet trunking methods:
■ Cisco’s proprietary InterSwitch Link (ISL) protocol for Ethernet
■ IEEE’s 802.1Q, commonly referred to as dot1q for Ethernet
However, ISL is not supported on all the cisco devices that’s why 802.1Q is mainly used.
** Important Conclusions:-
Access port can pass only single Vlan traffic. Hence, if you are gonna pass a single Vlan traffic through a switchport then make it an access port. Or if you are gonna connect an endpoint device (Such as- PC, Laptop, Printer, etc) to the port, make it an access port.
Trunk port can pass multiple vlan traffic. Hence, if you are gonna pass multiple vlan traffic through a switchport then make it a trunk. Or the port connecting 2 switches, switch with a router, switch with a server should be made trunk.
** Trunks don’t work with Port Security and 802.1x authentication features. These features are used on access links.
• DTP (Dynamic Trunking Protocol):-
DTP is the protocol that is used to form and verify Trunk connections dynamically between two switches. It’s a cisco proprietary trunking protocol.
Although the modes aren’t generally asked in L1 interview, it an Informational thing that would help in configuration stuff. DTP has 5 modes:-
On/ Trunk:- If the mode is set to on or trunk on an interface, it generates DTP messages and tag frames on the interface assuming the remote end device or the device on the other end to be supporting Trunk connections even if it doesn’t. So, if the other end device doesn’t support trunk connections then you will face problems with your setup.
Desirable:- In this mode the interface generates DTP messages but assumes the remote end doesn’t support trunk, so it starts the link as an access link and if receives the DTP message indicating trunk capability it will form trunk and start tagging the frames. If remote device doesn’t support trunking the link will remain access.
Auto:- In this mode the interface passively listens DTP messages leaving the connection as access. If it receives DTP message from the remote end stating trunking capabilities then the interface will be changed to trunk connection and would start tagging frames.
*This is the default mode in cisco switches.
4. No Negotiate:- In this mode the interface is set as trunk connection and tag frames with VLAN information but won’t generate DTP messages as DTP is disabled in this mode. This mode is generally used to connect cisco devices with other vendor devices as DTP is a cisco proprietary so other vendors won’t be able to understand the messages of DTP.
Off:- If the interface mode is set to off. The interface will be configured as access connection and no DTP messages will be generated nor will be the frames tagged.
Off:- If the interface mode is set to off. The interface will be configured as access connection and no DTP messages will be generated nor will be the frames tagged.
l Interview questions for Network Engineer L1 asked from Switching basic:-
## DISCLAIMER:- The questions asked in the interview are all scenario based and indirect, So you should try to understand the concept instead of cramming. You will be fortunate if you receive a direct question from the interviewer.
Comments
Post a Comment