Wednesday, 18 June 2014

Networking Fundamentals-Hubs, Switches, Routers

Networking Fundamentals
Hubs, Switches, Routers

Recently I started brushing up on some Networking tools and concepts and was really amazed at the depth and complexity of the subject, so decided to put up a few things on the blog as I go along..

NOTE: I found this awesome book on the net called "Network Warrior- 2nd Edition".. don't go by the name, this book really covers the fundamentals as well as the advancements in networking really well.. I really recommend reading this one..

To begin with, I'll just cover the basics starting with what is a Hub, Switch, Router; etc and where would you generally find one in an Organization's network architecture.. Later on posts will cover a bit of in-depth technologies such as MPLS, VPNs etc..

A hub is simply a means of connecting Ethernet cables together so that their signals can be repeated to every other connected cable on the hub. 

A hub is like a repeater, except that while a repeater may have only two connectors, a hub can have many more; that is, it repeats a signal over many cables as opposed to just one. Figure shows a hub connecting several computers to a network.

A repeater simply repeats (boosts) a signal. Repeaters are usually used to extend a connection to a remote host or to connect a group of users who exceed the distance limitation of 10Base-T (10Base-5 >> 500 meters; 10Base-2 >> 200 meters). 

In other words, if the usable distance of a 10Base-T cable is exceeded, a repeater can be placed in-line to increase the usable distance.

Switches differ from hubs in that switches play an active role in how frames are forwarded. A hub simply repeats every signal it receives via any of its ports out every other port. A switch, in contrast, keeps track of which devices are on which ports, and forwards frames only to the devices for which they are intended. 

NOTE: we generally refer to frames when speaking of hubs, bridges and switches. A Frame is nothing but a TCP Packet encapsulated with Layer 2 information.

The Figure below shows a switch with paths between Ports 4 and 6, and Ports 1 and 7. The beauty is that frames can be transmitted along these two paths simultaneously, which greatly increases the perceived speed of the network. A dedicated path is created from the source port to the destination port for the duration of each frame’s transmission. The other ports on the switch are not involved at all. 

So, the obvious question now is how does the switch determine where to send the frames being transmitted from different stations on the network? The answer is simple... Every Ethernet frame contains the source and destination MAC address for the frame. The Switch simply looks up this MAC addresses and routes the appropriate frame to its destination.

ADDITIONAL INFO: Switches, in the traditional sense, operate at Layer 2 of the OSI stack. The first multilayer switches were called Layer-3 switches because they added the capability to route between VLANs. 

These days, switches can do just about anything a router can do, including protocol testing and manipulation all the way up to Layer 7. Thus, we now refer to switches that operate above Layer 2 as multilayer switches.

VLAN or Virtual LANs
Virtual LANs, or VLANs, are virtual separations within a switch that provide distinct logical LANs that each behave as if they were configured on a separate physical switch. 

Before the introduction of VLANs, one switch could serve only one LAN. VLANs enabled a single switch to serve multiple LANs. Assuming no vulnerabilities exist in the switch’s operating system, there should be no way for a frame that originates on one VLAN to make its way to another.

In the Figure shown above, Terminals A and B belong to VLAN 20 and Terminals P and Q belong to VLAN 40. A and B can communicate with each other as they belong to the same VLAN, however A cannot communicate with either P or Q directly.

To connect different vLANs on a same switch together, we can use an External Router as shown in the image below.

Assuming the router is correctly configured, Terminal A will now be able to communicate with Terminal Q, but neither workstation will show any indication that they reside on the same physical switch.

VLANs are local to each switch's database, and VLAN information is not passed between switches. Trunk links provide VLAN identification for frames traveling between switches. Trunks carry traffic from all VLANs to and from the switch by default but can be configured to carry only specified VLAN traffic.

A Router is a device that forwards packets to a destination other than the local network. Routers usually communicate with each other by means of one or more routing protocols. These protocols let the routers learn information about networks other than the ones directly connected to them. 

NOTE: Bridges, hubs, and switches operated only on Layer 2 of the OSI stack, and routers only on Layer 3. Nowdays these devices are often merged into single devices, and routers and switches often operate on all seven layers of the OSI stack. 

Packets or frames are forwarded on a local network by switches, hubs, or bridges. If the address of the destination is not on the local network, the packet must be forwarded to a gateway. The gateway is responsible for determining how to get the packet to where it needs to be. Gateways are basically nothing but Routers sitting on the edge of your network. 

NOTE: Cisco Routers use something called as a RIB (Route Information Base). This is a basically a Routing Table that the Router uses to determine where to route packets to over the net.

No comments :

Post a Comment