A switch, however, keeps a record of the MAC addresses of all the devices connected to it. With this information, a switch can identify which system is sitting on which port. So when a frame is received, it knows exactly which port to send it to, without significantly increasing network response times. And, unlike a hub, a 10/100Mbps switch will allocate a full 10/100Mbps to each of its ports. So regardless of the number of PCs transmitting, users will always have access to the maximum amount of bandwidth. (layer 2)
A router is typically connected to at least two networks, commonly two Local Area Networks (LANs) or Wide Area Networks (WAN) or a LAN and its ISP's network . for example, your PC or workgroup and EarthLink. Routers are located at gateways, the places where two or more networks connect. Using headers and forwarding tables, routers determine the best path for forwarding the packets. Router use protocols such as ICMP to communicate with each other and configure the best route between any two hosts.
Virtual LANs (VLANs) are an abstraction to permit a single physical network to emulate the functionality of multiple parallel physical networks. This is handy because there may be situations where you need the functionality of multiple parallel physical networks but you'd rather not spend the money on buying parallel hardware. (VLAN protocol 802.1Q) http://serverfault.com/questions/188350/how-do-vlans-work 46down voteaccepted If you have more than one VLAN on a port (a "trunk port"), you need some way to tell which packet belongs to which VLAN on the other end. To do this you are "tagging" a packet with a VLAN tag (or VLAN header if you like). In reality a VLAN tag is inserted in the Ethernet frame like this: VLAN Header
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9wnCOwbRdJkaQ-XHRUfSZh5xX5qNwbxdbZ9hX0AF8A0il_t0pLaDbp0GFoDL2f3_QStLya8zDOSNHaaNvyOHfkK0bND7AtITps-ZuWmEx3_OgFhvkwGUwKwORd2uxbgFcpsH3VFnF_msE/s320/vlan_frame.png)
The 802.1Q (dot1q, VLAN) tag contains a VLAN-ID and other things explained in the 802.1Q Standard. The first 16 bits contain the "Tag Protocol Identifier" (TPID) which is 8100. This also doubles as the EtherType 0x8100 for devices that don't understand VLANs. So a "tagged" packet contains the VLAN information in the Ethernet frame while an "untagged" packet doesn't. A typical use case would be if you have one port from a router to a switch which multiple customers are attached to: VLAN Trunking
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRlBlUYLEfO5XohFCB2Zl7us_FBlXuUFPRFt_X3dOtttF7T7UYyjQCby6SRcqHmWwE0m7BPOW1H_0wWr-wT8qzoNFqTREO-dpcnLIPcOKV_6tRBQ25rv6DGMfC_MIk08NzgpEVRV8Y5AuD/s320/vlan_trunk.png)
In this example customer "Green" has VLAN 10 and Customer "Blue" has VLAN 20. The ports between switch and customers are "untagged" meaning for the customer the arriving packet is just a normal Ethernet packet. The port between router and switch is configured as a trunk port so that both router and switch know which packet belongs to which customer VLAN. On that port the Ethernet frames are tagged with the 802.1Q tag.