Network Devices

Routers

Let’s begin with routers. Our aim here is to give you a firm understanding of the basic functions of routers, so you’ll use this knowledge for more complex hacking techniques and tools. A quick overview of the fundamentals: a router’s main function is to direct packets (layer 3 traffic) to the appropriate location based on network addressing. Because routers direct traffic at the network layer, they are considered layer 3 devices. When talking about routers, we are talking about common protocols such as IP—that is, we are dealing with IP addressing. Routers are also used as a gateway between different kinds of networks, such as networks on different IP ranges or networks that don’t understand each other’s protocol. For example, in an enterprise or business setup, it’s not possible to jam a fiber-run T1 connection into a client computer and expect to have blazingly fast network speeds. The computer, or more accurately the network interface card (NIC), is not capable of speaking the same language as the outside connection. Routers bridge that gap and allow the different protocols on different networks to communicate.

Routers also use Network Address Translation (NAT). This is an extremely useful technology that allows internal network clients to share a single public IP address for access to the outside world. Essentially a router has two interfaces: one for the outside world and one for the internal network. The outside connection, or the public side, is assigned a public IP address purchased from a local Internet service provider (ISP). The internal side of the router is connected to your local intranet, which contains all of your internal IPs and your protected resources. From the internal side you are free to create any IP scheme you want because it’s internal to your site. When an internal client then makes a request for an out- side resource, the router receives that traffic and sends it out the public side with its public IP. This process safeguards the internal client’s IP address and also funnels all outbound requests through the same public IP. Because NAT is so common these days, you rarely notice that it’s actually occurring.

Switches

Switches deliver data (frames) based on the hardware addresses of the destination computers or devices. Hardware addresses, also called media access control (MAC) addresses, are permanent identifiers burned into each NIC by the manufacturer. MAC addresses are broken down into a six-pair hexadecimal value—for example, c0-cb-38-ad-2b-c4. The first half of the MAC is specific to the manufacturer. So, in this case the c0-cb-38 identifies the vendor. The ad-2b-c4 identifies the device or NIC itself. Switches are considered layer 2 devices because they operate just one level below the layer 3 router functions. Remember,  layer 3 is the network layer. The network layer contains all the IP addressing; layer 2 deals strictly with MAC addresses (see Exercise 2.1). Note that quite a few switches are available today that operate at both layer 2 and layer 3, but for simplicity’s sake, and for our pur-poses, switches are at layer 2.