To support ISL or 802.1Q routing on a Fast Ethernet interface, the router’s interface is divided into logical interfaces—one for each VLAN. These are called subinterfaces.
To switch frames between LAN ports efficiently, the switch maintains an address table called MAC address Table or CAM Table (Content Addressable Memory Table). When the switch receives a frame, source MAC address is learned and recorded in the CAM table along with the port of arrival, VLAN and time stamp. The switch dynamically builds the MAC address table by using the Source MAC address of the frames received. Than this table is used by switch to determine where to forward trafic on a LAN.
In Hub there is one collision domain and one broadcast domain.
In Switch there is multiple collision domain and one broadcast domain.
When a frame reaches to the port of a switch, the switch reads the MAC address of the source device from Ethernet frame and compares it to its MAC address table (also known as CAM (Content Addressable Memory) table). If the switch does not find a corresponding entry in MAC address table, the switch will add the address to the table with the port number at which the Ethernet frame is received.
If the MAC address is already available in the MAC address table, the switch compares the incoming port with the port already available in the MAC table. If the port numbers are different, the switch updates the MAC address table with the new port number.
Broadcast Domain - Broadcast is a type of communication, where the sending device send a single copy of data and that copy of data will be delivered to every other device in the network segment. A Broadcast Domain consists of all the devices that will receive every broadcast packet originating from any device within the network segment. All ports on a hub or a switch are by default in the same broadcast domain. All ports on a router are in the different broadcast domains and routers don't forward broadcast.
Collision Domain - is a network scenario where one particular device sends a packet on a network segment forcing every other device on that same segment to pay attention to it. At the same time, if a different device tries to transmit simultaneously, it will lead to a collision after which both devices must retransmit, one at a time. This situations is often in a hub environment, because each port on a hub is in the same collision domain. By contrast, Each port on a bridge, a switch or router is in a seperate collision domain.
A Switch is a device which is used to connect multiple devices inside Local Area Network (LAN). Unlike hubs, switches examine each packet and process it accordingly rather than simply repeating the signal to all ports. Switches operate at Layer Two (Data Link Layer) of the OSI model.
The function of Switching is to Switch data packets between devices on the same network.
If the destination MAC address is not found in the MAC address table, the switch forwards the frame out all of its ports except the port on which the frame was received. This is known as flooding.
The Switch performs three major functions:-
When a Layer2 Ethernet frame reaches a port on the Switch, it not only reads the source MAC address of the Ethernet frame as a part of learning function, but also reads the destination MAC address as a part of forwarding function. The destination MAC address is important to determine the port which the destination device is connected to.
As the destination MAC address is found on the MAC address table, the switch forwards the Ethernet frame via the corresponding port of the MAC address.