First, let's think about postal system in real life. The system consists of branch office and main office. In branch office, there is one table which records each house hold's detailed address. In main post office, it have one table which records the postal code the corresponding branch office will process. When you want to deliver your mail, you will put the " to" and "from" address onto the envelop. Local postal man collect your mail and send to branch office. At branch office, staff will check whether the destination address of your mail belongs to local postal code. If yes, they will deliver your mail to the address directly; If not, they send your mail to main office. Main office will classify mails according to postal code of "to address", put them into different buckets and ship to next office which is responsible for processing mails with corresponding postal code. The peer main office will deliver those mails to branch office ; the peer branch office will deliver the mail to the local address if the destination address is one of household in its area.
In fact, switch/router works like real postal system. Switch is like branch office; while router like main office. Switch/Router is the device which help the incoming packets find the right outgoing interface, which is closer to the destination of the packet, by checking look-up tables. Switch/router is the key components in all modern communication network such as wireless cellular network, telephone network, ATM network, IP data network and so on.
In today's IP network, Ethernet switch and IP router are 2 important devices. Ethernet switch is responsible for switching the Ethernet packets from the incoming interface to the right outgoing interface. The outgoing interface may be the destination host directly, may be another switch which is closer to the destination, or may be one router who knows better about the destination and can help route the packets closer to their destination. To do the right decision, Ethernet switch depends on source and destination Ethernet MAC address, while IP router depends on the source and destination IP address.
Switch and router are very similar in modern life. For chassis based switch/router, they are composed of chassis, Control engine, line cards, switch fabric, power supply and fan trays. Chassis is the container for all other components with back or middle planes. In one chassis, it could hold multiple line cards, switch fabrics, power supplies and fan trays. Control engine are the brain of modern switch/routing, and its responsibility is to learn network topology information from neighbors , construct a network picture of what it knows and program those knowledge into the look-up engine on the line cards. Line cards are composed of transceivers, PHY/EDCs, MACs, commercial or customized look-up engines, and optional switch fabric chips. Switch fabric connected all the line cards, and provide non-blocking packet delivery between line cards. Power supply provides power for the chassis, while fan tray holds the fans to cool all the electrical devices inside switch/routing.