Basic Networking – Part 1

What is a network hub?

A networkhub serves as a connection point for all devices in a LAN. It is basically a multiple-port repeater because it repeats an electrical signal that comes in one port out all other ports (except the incoming port). Here is an example 4-port Ethernet hub (source: Wikipedia):

Hubs are OSI Layer 1 devices and have no concept of Ethernet frames or addressing. They have no way of distinguishing which port a signal should be sent to; instead, an electrical signal is broadcast to every port. All nodes on the network will receive data, and the data will eventually reach the correct destination, but with a lot ofunnecessary network traffic:

how hub works+

In the picture above you can see that the hub has sent out the receiving signal out all other ports, except the incoming port.

Modern LANs rarely use hubs; switches are used instead. Hubs have many disadvantages, including:

  • they operate in half-duplex.
  • they are prone to collisions.
  • each port on a hub is in the same collision domain.
  • data is forwarded out all ports and can be captured with a network sniffer.

What is a network bridge?

A network bridge is a device that divides a network into segments. Each segment represent a separate collision domain, so the number of collisions on the network is reduced. Each collision domain has its own separate bandwidth, so a bridge also improves the network performance.

A bridge works at the Data link layer (Layer 2) of the OSI model. It inspects incoming traffic and decide whether to forward it or filter it. Each incoming Ethernet frame is inspected for destination MAC address. If the bridge determines that the destination host is on another segment of the network, it forwards the frame to that segment.

Consider the following example network:

network bridge explained+

In the picture above we have a network of four computers. The network is divided into segments by a bridge. Each segment is a separate collision domain with its own bandwidth. Let’s say that Host A wants to communicate with Host C. Host A will send the frame with the Host C’s destination MAC address to the bridge. The bridge will inspect the frame and forward it to the segment of the network Host C is on.

Network bridges offer substantial improvements over network hubs, but they are not widely used anymore in modern LANs. Switches are commonly used instead.

What is a network switch?

A network switch is a device that connects devices together on a LAN. A switch is essentially a multiport network bridge and performs the same basic functions as a bridge, but at much faster speeds and with many additional features. Each port on a switch is in a separate collision domain and can run in the full duplex mode, which means that hosts connected to a switch port can transmit to the switch at the same time that the switch transmits to them

An Ethernet switch usually works at the Data link layer of the OSI model (Layer 2). It manages the flow of data across a network by inspecting the incoming frame’s destination MAC address and forwarding the frame only to the host for which the message was intended. Each switch has a dynamic table (called the MAC address table) that maps MAC addresses to ports. With this information, a switch can identify which system is sitting on which port and where to send the received frame.

To better understand how a switch works, consider the following example:

network switch+

Host A is trying to communicate with Host C and sends a packet with the Host C’s destination MAC address. The packet arrives at the switch, which looks at the destination MAC address. The switch then searches that MAC address in its MAC address table. If the MAC address is found, the switch then forwards the packet only out the port connected to the frame’s destination. Hosts connected to other ports will not receive the frame.

Differences between a switch and a bridge

Switches are basically multiport bridges. Although both types of devices perform a similar function, segmenting a LAN into separate collision domains, there are some differences between them:

  • most bridges have only 2 or 4 ports. A switch can have hundreds of ports.
  • bridges are software based. Switches are hardware-based and use chips (ASICs) when making forwarding decisions, which makes them much faster than bridges.
  • switches can have multiple spanning-tree instances. Bridges can have only one.
  • switches can have multiple broadcast domains (one per VLAN).

To better understand the difference between a bridge and a switch, consider the following example. Let’s say that we have a network of four computers. First, we will connect them together using a two-port bridge:

network with hubs bridge

Because the bridge has only two ports, we need to use hubs in order to connect all computers together. Only two collision domains are created. If Host A wants to send a frame to Host C, all computers on the network will receive the frame, since hubs forward the frames out all ports.

Now consider what happens if we replace the bridge with a switch. Since the switch has plenty of ports, no hubs are necessary. Each port is a separate collision domain and four collision domains are created. If Host A wants to send a frame to Host C, the switch will forward the frame only to Host C. Other hosts on the network will not receive the frame:

network switch

What is a router?

A router is a network device that connects different computer networks by routing packets from one network to the other. This device is usually connected to two or more different networks. When a data packet comes to a router port, the router reads the address information in the packet to determine out which port the packet will be sent. For example, a router provides you with the internet access by connecting your LAN with the Internet.

A router is considered a Layer 3 device of the OSI model because its primary forwarding decision is based on the information of the OSI Layer 3 (the destination IP address). If two hosts from different networks want to communicate with each other, they will need a router between them. Consider the following example:

how routers work

We have a network of three computers. Note that each computer is on a different network. Host A wants to communicate with Host B and sends a packet with Host B’s IP address (10.0.0.20) to the default gateway (the router). The router receives the packet, compares the packet’s destination IP address to the entries in its routing table and finds a match. It then sends the packet out the interface associated with that network. Only Host B will receive the packet. In fact, Host C will not even be aware that the communication took place.

Each port on a router is in a separate collision and broadcast domain and can run in the full duplex mode.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.