11.1 Layer 3 Devices 11.1.1 Routers Instructor Note This target indicator reviews a simple definition of router functionality -- a device which makes best path routing decisions based on layer 3 addressing. The students have just finished studying the dominant Layer 3 Addressing scheme -- IP addressing. The purpose of this chapter is to illuminate how those best path decisions are made. In networking, there are two addressing schemes: one uses the MAC address, a data link (Layer 2) address; the other uses an address located at the network layer (Layer 3) of the OSI model. An example of a Layer 3 address is an IP address. A router is a type of internetworking device that passes data packets between networks, based on Layer 3 addresses. A router has the ability to make intelligent decisions regarding the best path for delivery of data on the network. 11.1 Layer 3 Devices 11.1.2 Layer 3 addresses Instructor Note The purpose of this target indicator is to compare and contrast bridges, switches, and routers. It should be noted that while routers make their decisions based on Layer 3 addresses, Layer 2 addresses remain important. For example, the router will strip off layer 2 source addresses and replace them with its OWN layer 2 source address when forwarding a packet. Also, some routers can perform bridging functions. Bridges and switches use physical, or MAC addresses, to make data forwarding decisions. Routers use a Layer 3 addressing scheme to make forwarding decisions. They use IP, or logical addresses, rather than MAC addresses. Because IP addresses are implemented in software, and refer to the network on which a device is located, sometimes these Layer 3 addresses are referred to as protocol addresses, or network addresses. Physical, or MAC addresses, are usually assigned by the NIC manufacturer and are hard-coded into the NIC. The network administrator usually assigns IP addresses. In fact, it is not unusual for a network administrator to group devices together in the IP addressing scheme, according to their geographical location, department, or floor within a building. Because they are implemented in software, IP addresses are fairly easy to change. Finally, bridges and switches are primarily used to connect segments of a network. Routers are used to connect separate networks and to access the worldwide Internet. They do this by providing end-to-end routing. 11.1 Layer 3 Devices 11.1.3 Unique network numbers Instructor Note This seemingly simple example -- one router connecting two simple LANs -- must be fully understood if the student is to progress very far in their understanding of more complex and realistic networks. The router switches packets to the appropriate interface based on the destination IP address. It should also be noted that the router interfaces themselves must have addresses. A very appropriate kinesthetic activity is to have students play the roles of hosts and router and pass packets -- with Layer 2 and Layer 3 addresses -- back and forth across the network. The person portraying the router should remove the Layer 2 source address and replace it with its own. Routers connect two or more networks, each of which must have a unique network number in order for routing to be successful. The unique network number is incorporated into the IP address that is assigned to each device attached to that network. Example: A network has a unique network number - A. It has four devices attached to it. The IP addresses of the devices are A1, A2, A3, and A4. Since the interface where the router connects to a network is considered to be part of that network, the interface where the router connects to network A has an IP address of A5. Example: Another network, with a unique network number - B - has four devices attached to it. This network is also attached to the same router, but at a different interface. The IP addresses of the devices on this second network are B1, B2, B3, and B4. The IP address of the router's second interface is B5. Example: You want to send data from one network to another. The source network is A; the destination network is B; and a router is connected to networks A, B, C, and D. When data (frames), coming from network A, reaches the router, the router performs the following functions:It strips off the data link header, carried by the frame. (The data link header contains the MAC addresses of the source and destination.) It examines the network layer address to determine the destination network. It consults its routing tables to determine which of its interfaces it will use to send the data, in order for it to reach its destination network. In the example, the router determines that it should send the data from network A to network B, from its interface, with address B5. Before actually sending the data out interface B5, the router would encapsulate the data in the appropriate data link frame.