Building A Local Area Network(LAN) With HUBS And Switches

Home /

Table of Contents

Let’s build our own Local Area Network now that we’ve learned about some networking hardware. Your actual network journey starts from this tutorial.

You and your best friend Hermione are both interested in networking. You have knowledge of some networking devices and how to connect them using cables and connectors. You want to connect your two desktop computers and Hermione’s laptop. You draw the diagram below and show it to Hermione. 

20jZH5zGR2UdfsSuK6O 8j8 ecPCFNBOenDarejsM5h6Y8v7vfN18zLjuN2tPZ3R2 sX1qGBlfcSJ9v89selbBhekNfHn N1IYLcjpNBHy5keXiMMpubJzbuPrMw2 aXrrBQRpEdkJz2Hh9RK82DjROA5ld 71Jyr64IsykAWreHs Yy9FF1ATknshH0zg - Building A Local Area Network(LAN) With HUBS And Switches

This type of small network is called LAN Network. LAN is an abbreviation for local area networks. A network is a collection of two or more connected computers, whereas a LAN is a network that is contained within a small geographic area, typically within the same building. LANs are commonly used in home WiFi networks and small business networks. Although LANs can be quite large, it is usually more accurate to classify them as wide area networks (WAN) or metropolitan area networks (MAN) if they take up multiple buildings (MAN).

A device could be linked to two other devices using one twisted-pair CAT-5 cable and two RJ-45 connectors for each connection. You have not drawn the RJ-45 connector in the diagram(Relax, we know you’re lazy!).

4YMsaWtnkpuSHEM7ciaJtSXKpR6xl3d4VsvYQd7tlf2omHsMpbf46OqDCzcOhTgkXWuSqgZEL1vVS53cPqKQ8d902iYjK8R7lCWudyfp78hnOsrGwOS87VTvFSfCUYOjQjc ojYtgGKiujauxNWxOyOMczk dxAbY YbEnzfmSA SS 6BL7YDEbncbu3vg - Building A Local Area Network(LAN) With HUBS And Switches

And she is right. Networking entails far more than haphazardly stringing cables around. Before you start pulling lines all over the place, you need to figure out what you’re connecting, where everything is going to be, and how to network it all together. So you draw the diagram below and make a list of the devices you’ll need to build your own network.

image - Building A Local Area Network(LAN) With HUBS And Switches
- Building A Local Area Network(LAN) With HUBS And Switches

Yes, You will use a router to connect all the devices together. This is basically what routers do. As we have previously mentioned, a router connects two or more networks or subnetworks. Its primary functions are to manage traffic between these networks by forwarding messages to their intended IP addresses and to allow multiple devices to use the same Internet connection.

rb6WqkFWA2HEdu26LPSRST79of7Mu5waH wV7Wo5PWyWR2gGA5poRdVWpEVmfeB9F8xbayrSIcwZ5B8WfR5pk0etVoMMrtCi2jB0QqLL0BDgyBikqgfbG0U1fCenHtPKhKJsMJds8 42r0vGiML3qpeeGIe LLgb K1aV1j1A3nH4sr V6SPpfC8VZc4qA - Building A Local Area Network(LAN) With HUBS And Switches

The Internet(capital i) and an internet(small i) are not the same thing. The term “Internet” refers to the vast interconnected networks that we use to send data around the world. The term “internet” refers to the connection of at least two intranets via a router. And we are building only one network, not even two. So can we use the router?

Yes, we can. A router can function independently of the Internet by establishing a local area network on which connected devices can communicate. This enables shared services such as file sharing and shared printers to be used even when there is no Internet connection, within the LAN.

However, routers are expensive. Instead of a router, you can use hubs or switches(as you only want to create your own LAN). We have not yet introduced these two networking devices. We will go over them in this tutorial.

What is HUB?

qMZXjNGluCNdW8VkiYC3EZRt35bUU7cltEPYmuzeiP4uDrGO94S EAvUeiJDPZr mI vOHblL sAkJSECR1dXULEQGE2DnRThPtfLcRFz2X901kOwFaitkDd3BIsIMU6kdPApe - Building A Local Area Network(LAN) With HUBS And Switches

Hubs enable us to connect the various machines we want on our network, such as computers and printers. It simply copies an incoming signal to all of its other ports and broadcasts it. A hub is also known as a repeater because it repeats the incoming signal without the use of digital intelligence. It has no memory or processor.

Broadcasting Broadcasting is the process of sending data to all systems regardless of the intended recipient. Broadcast communications can have a significant impact on overall network performance on busy networks.
E1RxzNKJTN5yKc hhDyvhFAb GFOFW2exQZX7Ay8yM cCZMrjcSwoVW037kJWaNHMfN1 l9e02QKqOrM 5sSkec8yUobgVGxycvT0D8Cu 9w9x3vJigOhyr6u1SktqAg27GU5Nib1j2i0cb - Building A Local Area Network(LAN) With HUBS And Switches

Here’s what a hub looks like inside:

Wx3Vaa81Vyx0XV0Ezq05wL VDJ7 WhxVoSnrRHPGtTPykszqwlSu0AGmrTPqdMIv9IVJhAlxdzJrNyXjIJJdacIMzPQA41amUKrykvK42SGpRG7Y6u8X iQiWe525IdNX9SQkZwsEPFgUxilRSwKd3mFAOEZfMA2JsWY Xq bSfDH7Eqii70S08tDQgL9g - Building A Local Area Network(LAN) With HUBS And Switches

A hub is a dumb device because it does not understand network data and does not know about or store MAC addresses. It simply repeats incoming signals across all ports without altering the signal before broadcasting it.

cRQJTWdUTe9y6usvr6VezLL ZL799SaiqsfjSVqAnboS9lxv15GNyQjrtQHggUi0teJ3uU dD1mfVvVEgSe0uTQISSV3hv7eN czWCTohgA8jRgzGqlo0O1s7g9NyCPlBDYeSaDWGS8WBz2FKn43a373wuSQfq - Building A Local Area Network(LAN) With HUBS And Switches

Because a hub simply transmits signals as they are received and has no real understanding of network data, it makes no changes to the source MAC address. It retains the source MAC address as it was when the packet was received. Why the source MAC address is so important will be discussed later.

A hub receives incoming signals and distributes them to all other ports. When multiple devices begin sending signals, the hub’s constant repetition causes heavy traffic and collisions. A collision occurs when two signals collide, resulting in an error. The sending network device must take a step back and wait for the signal to be sent again.

A hub is essentially an electrical repeater. It takes any signal that comes in and sends it to all of the other ports.

A hub lacks processors, which means it has no real understanding of network data. It is not aware of MAC addresses or frames. It recognizes an incoming networking signal as purely electrical and forwards it.

What is a Frame?

TUcZCNJky4gqa0F0pO05w4kbN1ZQf5Vi1yL1v1YAi3oKANMigTA2 09DBNC7 - Building A Local Area Network(LAN) With HUBS And Switches

We knew you’d notice, Hermione. In our next tutorial, we will talk about frames. However, in this tutorial, we will discuss it briefly to demonstrate the significance of MAC Address.

Protocols are used by network devices to communicate effectively. In simple words, protocols mean a set of guidelines or rules for network communication.  These protocols address issues such as how quickly data can be transmitted and how data is structured when it is sent. Most protocols specify a message size limit, which means that messages must be separated into separate packages and labeled with information about where the message came from and where it’s going. 

Network messages come in two kinds of packages: frames and packets..

Frame Protocol #1

a KyjXOa80 pLT0Zy j5aijFBaxt477LCIQNqRLFcPNV8A0jfkdmczBdETLNcA0i Ouz9uiH68pkTP5LjcpD4r9RZ5AVN1ntM vjLzMvRQAYun2PT8vBsxrl4IRXZUnroz2VyvLQUIHqiOfQSurRiBsuRI7ui1Ec2SaND1TuJJ9C7JCYs - Building A Local Area Network(LAN) With HUBS And Switches

A frame is a logical structure of bits that organizes network traffic so that every device can read the information contained within it. A packet is a structure that exists within the frame. It’s the real meat of the frame. Packet contains the data that needs to be sent.

The Destination MAC address is the hardware address of the next network device to which the packet is traveling.

The Source MAC address is the hardware address of the last device that sent the frame.

When we are networking, whether it is our custom network or the big Internet, the address we are most interested in is the MAC Address. Most of the time, we are unaware of this. For example, an IP Address actually retrieves a MAC Address in order for our data to reach its destination.

That discusses the frame for the time being. We’ll go over it in the next tutorial.

The Switch

A network switch is a physical device that operates at the Open Systems Interconnection (OSI) model’s Data Link layer — Layer 2. It receives packets sent by devices connected to its physical ports and forwards them to the devices to which the packets are intended.

Switches are a common component of Ethernet, Fibre Channel, Asynchronous Transfer Mode (ATM), and InfiniBand networks, among others. Most switches today, however, use Ethernet.

Do not worry about the Open Systems Interconnection (OSI) model’s Data Link layer — Layer 2. We’ll talk about it when the time comes.

How Do Switches Function?

A switch sends frames, and only sends them where they need to go. Switches avoid collisions by storing and forwarding intranet frames. Switches can do this by using the frame’s MAC address. Instead of repeating the signal across all ports, it forwards it to the device that requires it.

6ZDhffDd6LBb6 qdb3Sp3B9u1GOBJO20izpSzcm9cS7k7v83NDMGFo8ENF4USH9lBbIHS3rdnrQVEtHABstGI2vCu56vbyIdjRWi8Yoen4I0A8CtzH8Hld2wclQoXhzvwOwak1MM suWrzrmJkBdBIBwZlaXsEHMrPMQy9wwnKpqEUDn6TxJOXttqSd Rw - Building A Local Area Network(LAN) With HUBS And Switches
Switches think in terms of frames

A switch reads the signal as a frame and uses the frame’s information to send it to its intended destination. A switch contains processors, RAM, and ASICS. This means it can properly process network data. It understands MAC addresses and frames, so it can deal with any incoming networking signal intelligently. It can determine where the signal should go and deal with it accordingly. A switch, like a hub, allows us to connect the various machines we want on our networks, such as computers and printers.

Here’s a look inside a switch:

- Building A Local Area Network(LAN) With HUBS And Switches

The way hubs and switches handle signals differs significantly. A switch can process signals in the form of frames and understands MAC addresses. A switch can store packets and forward them to their destinations rather than repeating incoming signals on all ports.

Switches store MAC addresses in a lookup table to keep the frames flowing smoothly. A switch intelligently directs traffic between systems by only sending packets to their intended destination. This is accomplished by keeping track of the MAC addresses of the NICs plugged into each port. For switches to identify different ports and devices, MAC addresses must be unique or highly unlikely to be repeated, which is why manually setting a MAC address can have unexpected consequences in a switched network. Switches typically have a large number of MAC addresses reserved in their MAC address table. When forwarding a frame, the switch first searches the MAC address table for the outgoing port’s destination MAC address. If the outgoing port is found, the frame is forwarded rather than broadcasted, reducing the number of broadcasts.

How Do Switches Acquire Mac Addresses?

Because a switch is intelligent, it can generate the MAC address table automatically. The following section will show how a switch learns MAC addresses.

B4pf07j6JVa5k0nOvECMLUjoHHpYaupSLzJPnr ih8G V0xwEfGNK42gJkj3XL2GV3iRmBYdHVwnCE8XLj9BkPSO3OTqUIg Xx6aVOqMcxSNMpoBKWpkWPUA3jC1Jjfen31SXzidbM1F - Building A Local Area Network(LAN) With HUBS And Switches

We have three computers and a switch in the middle. Every computer has a MAC address. They are abbreviated as AAA, BBB, and CCC in the below diagram for simplicity. 

Assuming Computer A is going to send something to Computer B, consider the following:

PlyccAKdMzkY987kGrgtIhxAbeJhU6MrsxvgjqRim0r633CwuzsAtmQvAQx41I8EXnCMjkvr5z8hw7ypQKp0LHm6 j5NHCWOba3HAilD jGWULLM MfU l5MSCYf8c8ajgJnpwZRkMKGsZ2eQBkGeonMOq8Hfg4tAHPa0qkLF 4M ttSlZB6MY185C525A - Building A Local Area Network(LAN) With HUBS And Switches

Computer A will generate an Ethernet frame with a source MAC address (AAA) and a destination MAC address(BBB). Because the switch has a MAC address table, the following will occur:
oU50UCiBnIXIv8C tVzjBPlmfbdujwVJ04mKE Ifg1 X1A3yqgnFiHfR9UXsry00QgMQjREsBjSNnrNIjXtgfLA3rtXQgMO6qYBo6wX9qolhElkKyHyeBaRLDOnGmHJro34ZD6v0JZ6uyPyEs9AQ92tjDMoI1Qs8bmrZugFcCjSYAeLuFnkE69rbVv6Jkg - Building A Local Area Network(LAN) With HUBS And Switches

The switch will generate a MAC address table and learn only from source MAC addresses. It has only recently discovered that computer A's MAC address is on interface 1. This information will now be added to its MAC address table. However, the switch currently has no idea where computer B is located. There is only one option left: flood this frame out of all of its interfaces except the one from which it originated. This Ethernet frame will be received by computers B and C.
y lByZGGu4xAmnycgcpuR6tfHU OTh RkWuFiKJQQQCHi1oo wMYob96Tff5Tn30niwCRE4gvqGp38nFTmTwvIlRYD XYaLeeaZEozeuzcDTsfNa8 - Building A Local Area Network(LAN) With HUBS And Switches

Because computer B recognizes its MAC address as the destination of this Ethernet frame, computer Computer B will respond to computer A by creating an Ethernet frame and sending it to the switch. The switch will now learn the MAC address of computer B. The computer C will just discard the frame as it does not match its MAC Address. The switch now knows both MAC addresses(A and B) and can "switch" instead of flooding Ethernet frames the next time.

That concludes our story.  Except for the first flooded frame, Computer C will never see any frames between Computer A and B.

Another point worth mentioning is that the switch’s MAC address table employs an aging mechanism for dynamic entries. If Computer A and B’s MAC addresses are not updated within their aging time, they will be deleted to make room for new entries, which means frames between Computer A and B will be flooded to Computer C again if A wants to transfer information to B.

Share The Tutorial With Your Friends

Check Our Ebook for This Online Course

Advanced topics are covered in this ebook with many practical examples.

Other Recommended Article