Switching is process to forward packets coming in from one port to a port leading towards the destination. When data comes on a port it is called ingress, and when data leaves a port or goes out it is called egress. Switching occurs at Layer2 Data Link Layer. Frames are forwarded using specialized hardware, called application-specific integrated circuits (ASICs Switches occupy the same place in the network as hubs. Unlike hubs, switches examine each frame and process it accordingly rather than simply repeating the signal to all ports. The switch learning and forwarding process as follows: As a PC or other networked device sends a frame to another device through the connected switch; the switch captures the source MAC address of the frame and the interface that received it. The switch adds the MAC address and the port to the CAM table in this way switch update the CAM table to route the frame to an appropriate destination. Switches map the Ethernet addresses of the nodes as residing on each network segment and then allow only the necessary traffic to pass through the switch. When a frame is received by the switch, the switch examines the destination and source hardware addresses in CAM (Content addressable memory) table and compares them to a table of network segments and addresses. If the segments are the same, the frame is dropped or “filtered”; if the segments are different, then the frame is “forwarded” to the proper segment.
Layer 3 Switching – Packets are forwarded at Layer 3, just as a router would do. Packets are switched using specialized hardware, application-specific integrated circuits (ASICs) for high-speed and low latency. Packets can be forwarded with security control and quality of service (QoS) using Layer 3 address information.
Layer 4 Switching – Packets are forwarded using hardware switching, based on both Layer 3 addressing and Layer 4 application information. (Layer 2 addressing is also inherently used. Layer 4 protocol types (UDP or TCP, for example) in packet headers are examined. Layer 4 segment headers are examined to determine application port numbers. A Layer 4 switch must also allocate a large amount of memory to its forwarding tables. Layer 2 and
Layer 3 devices have forwarding tables based on MAC and network addresses, making those tables only as large as the number of network devices. Layer 4 devices, however, must keep track of application protocols and conversations occurring in the network.
Types of Switching:
Circuit Switching: An indirectly connected network in which actual electrical circuits are maintained for the duration of the communication. Circuit switching sets up a physical, end-to-end connection between the endpoints. The Bandwidth is dedicated to this point-to-point connection. The current telephone system is still, in part, circuit-switched, although the telephone systems in many countries now are concentrating less on circuit-switched technologies. Because this is not a shared environment, there are no collisions.
Packet Switching: Instead of dedicating a link as an exclusive circuit connection between two communicating hosts, the source sends messages in packets. Each packet contains enough information for it to be routed to the proper destination host. Packet-switched networks frequently share physical media, but because logical point-to-point connections are created, there are no collisions.
Switching Forwarding method:
Store and Forward Method: In this method the switch receives a frame into a buffer and stores it until it receives the complete frame. After it receives the complete frame then it looks to the destination address and then forwards the frame.
Cut Through Switching: In this method switch does not buffer the entire packet instead it waits until it has received the part of frame containing the destination address and as soon as it finds the destination address it starts forwarding the message.