Back to the Basics — Networking — Can you imagine what Switches can do?
Every Network has one switch and one router, and all but the smallest networks have more than one switch. These components are the basic building blocks of the networks
Understanding Switches —
We do know the hub is a layer-1 device that simply repeats all incoming network data to all its output ports. A hub in an unintelligent device and does not know or care of all its ports, hoping the intended recipient is one of the ports
As we all know as the network has more and more devices and the collisions increases exponentially, and the broadcast messages are likely to increase. Security is difficult to enforce because every device on the network must examine every packet that comes its way.
A switch is essentially an intelligent hub that has the ability to actually look at the contents of the packets it processes and make intelligent decisions about what to do with them. A hub is a layer-1 device which means it can do nothing bu amplifying and repeating electrical signals. In contrast, switch is an layer-2 device which means that they are actually inspect the layer-2 packets and act intelligently based on content of each packet.
A switch examines the destination MAC address of every packet it receives and forwards the packet only to the port that leads to the packet’s intended destination. Thus, packets are not repeated on ports that does not contain the packets destination.
How does switch learns what devices are connected to each of its ports?
For switch to do its job, it should know what devices are connected to each of its ports. More specifically, switch needs to know what MAC addresses are reachable via each of its ports. It simply learns. Whenever a packet is received on any of the switch ports the switch examines the sending MAC address in the packet. The switch rightly assumes that if it received a packet from a given MAC address on a given port, the switch can reach that MAC address via that port.
For Example, if a switch receives a packet from Computer C on port 3, the switch has learned from computer C is reachable via the port 3.
The switch adds this information to the MAC address table. This table is sometimes referred as Forwarding database, because it keeps track of which port packets intended for a given destination should forward to. The table simply keeps a tally of which MAC addresses are reachable on each port of the switch.
It is important to keep in mind that a switch port might actually connect to more than one device. For Example, suppose port 5 is not connected to a computer but has another switch which in turn has three other computers connected to it. In that case, the first switch can receive packets from three different computers on port 5. Then the switch records each distinct MAC address in its MAC address table.
The process of building MAC address table is called learning. This is one of the basic functions of Switch and other 2 are forwarding and flooding
Forwarding
Now that we know how switch knows which ports to forward the packet to. The switch simply looks up the destination MAC address in the table and sends the packet out through the corresponding port. Then it forwards the packet to the destination address.
Switches has memory buffers associated with each port that allows the switch to store a complete packet before forwarding it to the destination port. This allows the switch to hold onto the packet for a bit if necessary before forwarding it.
For Example, the destination port may be busy sending out packet received from a different port or the destination port may be busy receiving the packet. In either case, when the port becomes free, the switch can transmit the packet to its destination.
It is important to note that the switch does not modify the packet in any way prior to sending it. It sends exact replica. When the destination device receives the packet, the device has no idea that the packet passed through the switch. No tracing information is added to the packet by the switch. Also, they do not worry about the payload in the packet. Layer -2 is concerned about the MAC address.
What if switch does not recognize the MAC address in forwarding database?
When a switch receives a packet that is intended for a MAC address that is not in the switch’s internal MAC address table, the switch has no way to know what port to forward the packet to. In this case, the switch has no option but to revert to acting like hub. The switch simply forwards the packet on all available ports other than the one the packet arrives on. This is called flooding.
The packet will be forwarded even to the ports for which the switch has already learned a MAC address. This is necessary because single port can be a pathway to many more than one MAC address.
Flooding is similar to broadcasting, but is not quite the same. A broadcast packet that is intended to every recipient on the network.
There is high chance that on receiving the packet the destination device will receive the packet and send a reply back to the sender. So the MAC address is then added to the table and can be used going forward.
Collision Domains
The reduction of collisions is so fundamental to what a switch does. A switch is a device that divides collision domains. A collision domain is a segment of a network on which collisions are possible. In hub, it is single collision domain as all the network interfaces that connect to the network will see all packets that travel on the network. But when the switch is used, the network is divided into separate collision domains.
In a switched network, each collision domain consists of just two network interfaces: the port on the switch and the port on the destination device. Switches don’t completely eliminate collisions. If suppose a switch has received a packet intended for a computer, and the computer attempts to send a packet at the same moment that the switch attempts to forward the received packet to the computer. In that case, the two packets collide, and both the switch and computer must wait a bit and try again.
Bridging
A bridge is a device that is very similar to switch but it typically has fewer ports — perhaps as few as two. The primary purpose of a bridge is to provide a link between two networks. Like switch bridge examines the MAC address of every packet it receives and forwards the packet to the other side of the bridge only if the bridge knows that the destination is on the other side.
A switch is simply a multiport repeaters bridge. Bridges usage is less as the switch has come into the market. But the bridge can be used to connect two different types of networks. For Example, suppose your main network uses Cat-5e cable, but you also have a smaller network that uses fiber-optic cable. You can use a bridge to link these two types of networks. The bridge would have two ports: One Cat-5e port and one fiber-optic port. When the bridge receives a packet on the Cat-5e port, it forwards it to the fiber-optic port and vice versa
All switches can perform this type of bridging to connect Cat-5e devices that operate at different speeds. For example, most computers have network interfaces that operate at 1gigabit per second(Gbps). But many printers have slower 100 megabits per second ( Mbps) connections. The port on the switch can automatically detect the speed of the device on the other end of the cable, so you can plug a 1Gbps computer or a 100 Mbps printer into a switch port. The switch will automatically take care of buffering and forwarding packets received from the 1Gbps devices to the slower 100 Mbps devices
SFP Ports and uplinks
Some switches have special ports called small form-factor pluggable ports. You can use an SFP port to connect a variety of different types of high-speed networks including 10Gb Ethernet or 8 Gb Fiber Channel, which uses fiber-optic cables. In this way, the SFP ports allow the switch to bridge 100 Mbps or 1Gbps Cat-5e networks with faster copper or fiber-optic networks.
One of the most common uses of SFP ports is to connect switches to each port at speeds faster than 1Gbps.
The interconnection between two switches is called uplink
Uplink ports are likely to be the busiest ports on the switch. If a computer on switch A sends a packet to a computer on switch B, that packet must travel through the uplink ports to get from switch A to switch B. So, you can expect that the uplink ports will carry as much as 40 times the amount of traffic that the other ports carry.
Another use of SFP is to connect switches to server computers. This also makes sense, because the ports that connect to your servers will carry much more traffic than the ports that connect to workstations. In order to connect a switch to a server using a SFP port both the switch and the server must have SFP ports.
Broadcast Domains
The packets whose destination MAC addresses are all ones (FF-FF-FF-FF-FF-FF) are intended to be received by all devices that see the packet. Such packets are called broadcast packets.
The scope of the devices that broadcast packets are intended for is called broadcast domain. Ordinarily, a switch forwards broadcast packets to all the ports on the switch except the port on which the broadcast packet was received. This, the broadcast domain consists of all the devices connected to the switch, either directly or indirectly through another switch.
If the network is large, broadcast packets may consume a significant amount of the total bandwidth available on the network, slowing down other more important traffic.
The most common type of broadcast packet is an Address Resolution Protocol(ARP) request. ARP is the protocol used to determine the MAC address of a given IP address. If one IP device wants to send a packet to another IP device, the sender needs to know the AMC address of the recipient. So the sender broadcasts an ARP request .
Managed and unmanaged Switches
Most advanced switches have management features built on them which means hat you can monitor and configure the switch remotely, usually by logging in to a web console. To accomplish this, the switch has a small web server built into it to provide the management console. In addition, the switch itself must have an IP address.
Unmanaged switches are often appropriate for small networks, but if you have more than a few dozen computers on network, we go for managed switches which gives more control over your network.
With managed switch, you can monitor trafic over the switch, which can be useful when troubleshooting network issues. In addition, you can often configure certain functions for each port of the switch. The important feature that can be configured is VLANs which allows you to actually separate layer-2 networks on a single switch.
Happy Learning!!