Networking 2
Networking 2
Networking 2
networks (LAN), which are defined under IEEE 802.2 and 802.3
standards. It is the most widely used LAN technology family used today.
LLC sublayer
The LLC sublayer is used to communicate with the upper protocol layers of
the OSI model. It takes the protocol data units (PDUs) from the upper
layers, which are typically IPv4 packets, and adds control information to
help deliver the data to its destination.
LLC sublayer is implemented in software, and its implementation is
hardware agnostic. An example of the LLC can be considered the network
driver software of a server's NIC. The NIC driver is a software program that
interacts directly with the NIC hardware and passes the data between the
MAC sublayer and the physical media.
MAC sublayer
MAC constitutes the lower sublayer of the data link layer. MAC sublayer is
implemented in hardware, typically in the server's NIC. Ethernet MAC
sublayer has two primary functions:
Data Encapsulation and Decapsulation
Frame Delimiting
Addressing
Error detection
Media Access Control
Control of media access
Media recovery
Data Encapsulation
The data encapsulation process includes forming the frame, adding Ethernet
Header and Trailer, and decapsulation of the frame upon receiving. It
provides three primary functions:
Frame delimiting - This process provides bit-level synchronization between
the sending and receiving nodes. It also signals the receiving node about the
start of a new frame.
Addressing - This process adds an Ethernet Header to the frame. The header
contains the physical addresses (MAC addresses) that are used by the
network devices
Error detection - Every frame has a trailer with a cyclic redundancy check
(CRC) of the frame contents. The receiving node calculates again the CRC sum
and compares it to the one in the frame. If these two CRC calculations match,
the frame must have been received without error.
Book traversal links for Ethernet Technologies Overview
Type of LANs
SOHO LANs
One of the most common local-area deployments is the Small-
Office / Home-Office LAN (SOHO). It is a small computer network
usually built of one Ethernet switch, one router, and one wireless
access point. The LAN uses Ethernet cables to connect different
end-devices to one of the switch ports.
Figure 1 shows a diagram of a SOHO Ethernet LAN with one switch, one
router, and one access point. Some of the end devices are connected to
the access switch with Ethernet cables and some of the mobile devices
are connected via wireless. The Access point act as an Ethernet switch
with the only difference that the clients are connected with radio waves
instead of cables, using the IEEE 802.11 standards. Typical SOHO users
primarily consume public services such an email and social media, so the
traffic pattern is primarily from the Internet to the end clients.
Although in figure 1, the switch, router, and AP are shown as separate
devices, many networking vendors combine them in one integrated
network device specifically built for the SOHO LAN market.
These types of devices, shown in figure 2, are typically referred to as a
"wireless router", but they combine 4-port Ethernet switch, wireless
access point, IP router, and a firewall into an all-in-one device. Usually,
these types of devices are easy to set up and ready to go after
unboxing, but the downside is that they have lower performance and
availability and most importantly, they don't scale as well as the
enterprise-grade dedicated devices. For example, the integrated device
shown in figure 2 has only one routing port and 4 switch ports. Imagine
if the company has three Internet providers or 30 PCs or is spread on
two building floors. For that kind of scale, enterprise-grade network
devices are required.
Enterprise LANs
Enterprise networks are much larger in scale than a typical SOHO LAN. The
network devices used are enterprise-grade, usually racked in wiring
closets. Clients typically connect the access switches through the
building's structure cabling and there is wireless access as well.
Different cable types are required when you connect different devices
because some devices transmit data on pins 1&2 and receive on pins 3,6
and others transmit on pins 3,6 and receive on pins 1,2. So in order to
connect the transmit pair of pins on one device to the receiving pair of
pins on the other you have to use the correct cable type.
UTP Cabling Pinouts
In order to understand the difference between the two main types of
Ethernet cables: straight-through cable and crossover cable, we must first
understand how different types of devices transmit electrical signals on their
RJ45 ports. As an example, we will use some of those rules for the 10BASE-T
and 100BASE-T Ethernet standards.
Let's first have a look at the first group of devices such as Computers, Routers,
and Wireless Access Points. These devices use pins 1 and 2 to transmit data in
the form of electrical signals and pair of pins at positions 3 and 6 to receive
data.
The other group of devices such as Ethernet Hubs, Bridges and Switches use pins 3
and 6 to transmit data in the form of electrical signals and pair of pins at positions
1 and 2 to receive data. If you look closer you will see that this is exactly the
opposite of the devices shown in Figure 1.
A straight-through cable, as the name implies, connects the wire at pin 1 on
one end of the cable straight to pin 1 at the other end of the cable; the wire
at pin 2 to pin 2 on the other end of the cable; pin 3 on one end connects to
pin 3 on the other, and so on, as shown in Figure 3.
So let's look at what happens when we connect a device that transmits
on pins 1,2 with a device that receives on pins 1,2. For example, a PC
connected to a LAN switch using a straight-through UTP cable. As
shown in Figure 4, everything works correctly because the devices on
the right use the opposite pins to transmit and receive electrical signals.
But let's look at what will happen if we connect two like devices with a
straight cable as shown in Figure 5. For example, a router connected
to a router or computer's NIC card connected directly to a router. The
figure shows what happens on a link between the devices. The two
routers both transmit on the pair at pins 1 and 2, and they both
receive on the pair at pins 3 and 6. So the signal being transmitted on
both sides can't get to the respective receiving end and
communication is not possible.
The solution to this problem is to cross-connect the cable
wires in such a way, so the transmitting pins on one side to
connect to the receiving pins on the other side and vice
versa. If some of the wires are crossed, the cable is not
"straight" anymore, that's why it is called a crossover cable.
So in summary, the logic in choosing the correct cable to connect Ethernet
devices is:
Crossover cable: If both devices transmit on the same pin pair
Straight-through cable: If both devices transmit on different pin pairs
NOTE Nowadays, if you connect two Cisco devices together using whatever
cable you like, the link will still work because there is a feature called auto-
mdix that notices when the wrong cable is used and automatically changes its
logic to make the link work.
Fiber-Optic Cabling
Fiber-optic cabling is widely used for high-speed Ethernet links over relatively long
distances. It uses glass or plastic fiber as a medium through which light is "guided"
to the other end of the link. The fiber-optic cable itself has several layers made from
different materials and having different functions. The most important layer is
the core, which is the very center of the cable. A light source, called transmitter or
Tx, shines a light into the core. The core itself is surrounded by optical material
called the cladding that keeps the light in the core using an optical technique
called total internal reflection. Together the cladding and core create the
environment to allow transmission of light over the cable.
Depending primarily on the diameter of the core, fiber-optics are separated into
two main types: single-mode fiber (SMF) and multimode fiber (MMF).
Multi-Mode Fiber Optics
Due to its bigger core, some of the light beams may travel a direct route,
whereas others bounce off the cladding as shown in Figure 3. These alternate
paths cause the different groups of light beams, referred to as modes, to arrive
separately at the end of the link. Because of this, the strength of the light is
reduced over long distances.
Due to the large core size of multimode fiber, some low-cost light sources like
LEDs (light-emitting diodes) and VCSELs (vertical-cavity surface-emitting lasers)
are typically used. Because of this, transmission system costs (transmitters and
receivers) are lower than single-mode fiber. Typical light wavelengths used are
850 nm and 1300 nm.
In summary, multimode fiber gives high bandwidth at high speeds over medium
distances (up to 1km) at a lower cost.
Multiple access (MA): Several nodes share a network segment so they need an
access method to resolve collisions.
Collision detection (CD): If a collision does occur, it will be detected and the
transmission will be tried again after a random amount of time.
The concept of collision domains applies also in wireless networks because the
radio signals traverse a shared medium which is the wi-fi radio spectrum. So all
things we have said by now apply to Wireless networks as well - only one node in
a wireless LAN may transmit at any one time otherwise collision occurs
Ethernet Bridges
Ethernet Bridges are the predecessor of modern LAN switches. They were
introduced to resolve the scaling problem with shared segments and
collisions. Bridges are layer 2 devices, which means they can read the
Ethernet Header of the frames they forward and take decisions based on
the information in the headers. This eliminated the need to send all frames
out all ports, which practically means to repeat all electrical signals out to
all ports. Therefore, Ethernet bridges split a network segment into two
collision domains
Ethernet Switches
LAN switches completely resolve the problem with collisions. They
operate at layer 2 of the OSI model, meaning that they look at the
ethernet header and trailer. Their main advantage is that all their ports
can operate in full-duplex, meaning they can simultaneously transmit
and receive frames on any given port at any given time. Because of this,
the media access algorithm for collision detection (CSMA/CD) is no
longer required and is disabled by default. Another big advantage of
switches is that they forward frames based on MAC addresses so any
given frame doesn't need to be sent to all ports as hubs do.
Broadcast Domains
What is a broadcast domain?
In Ethernet LANs, a broadcast is one-to-all communication, which means that
if a node sends a broadcast frame, everybody receives a copy of it. At the
Ethernet layer, broadcast frames have a destination MAC address of FF-FF-FF-
FF-FF-FF. When a switch receives a frame with this MAC, it sends a copy of the
frame out all its interfaces, except the one it received the broadcast on. An
example of this behavior is shown in Figure 1.
The main idea here is simple - if you don't know where exactly to deliver a
frame, send it out everywhere, and the recipient will eventually get it. And the
receiver will likely reply back, therefore the switch will learn both nodes' MAC
addresses and continue the future forwarding process as known unicast (not
flooding the frames).
Obviously, this design is applicable in topologies, where there are a few VLANs
only. Nowadays in modern enterprise networks, there are tens of VLANs, so
this way of spanning VLANs between switches is not applicable at scale.
VLAN Trunking
In order to overcome this scaling limitation, we can use another Ethernet
technology called VLAN trunking. It creates only one link between the switches
that support as many VLAN as needed. At the same time, it also keeps the VLAN
traffic separate, so frames from VLAN 20 won't go to devices in VLAN 10 and vice-
versa. An example could be seen in figure 3. The link between switch 1 and switch
2 is a trunk link and you can see that both VLAN 10 and VLAN 20 pass through the
link.
Trunking protocols
Two trunking protocols have been used on Cisco switches over the years -
Inter-Switch Link (ISL) and IEEE 802.1Q. ISL was a Cisco proprietary tagging
protocol predecessor of 802.1Q, it has been deprecated and is not used
anymore. IEEE 802.1Q is the industry-standard trunking encapsulation at
present and is typically the only one supported on modern switches.
VLAN Tagging
VLAN trunking allows switches to forwards frames from different VLANs over a
single link called trunk. This is done by adding an additional header information
called tag to the Ethernet frame. The process of adding this small header is
called VLAN tagging. If you look at Figure 4, end-station 1 is sending a
broadcast frame. When switch 1 receives the frame, it knows that this is a
broadcast frame and it has to send it out all its ports. However, switch 1 must
tell switch 2 that this frame belongs to VLAN10. So before sending the frame to
switch 2, SW1 adds a VLAN header to the original ethernet frame, with VLAN
number 10
When switch 2 receives the frame, it sees that the frame belongs to VLAN 10,
then it removes the header and forwards to the original ethernet frame to all
its interfaces configured in VLAN10.
So in the given examples, when the ethernet frames are sent between the
switches over the trunk link, they are tagged with VLAN header. When the
receiving switch gets them, removes the VLAN tag and sends them to the
clients in the VLAN, the frames are untagged.
Switch interface modes
Each switch interface can operate as access or trunk port. Because in typical LAN
deployment, there are hundreds or even thousands of switch ports, there is a
protocol called Dynamic Trunking Protocol (DTP) that helps network
administrators set the operational mode of interfaces automatically. By default,
all Cisco switch ports are in operational state dynamic auto, which means that
this Dynamic Trunking Protocol (DTP) is listening and trying to understand what is
configured on the other side of the cable, and based on that to decide whether to
become an access or trunk port. For example, if we have a link between SW1 and
SW2, if we configure the interface on SW1 to be a trunk port, DTP will
advertise this to the other side and the interface on SW2 will automatically set
itelf in trunk mode and a trunk link will be formed between the switches.
Table 1. Switchport modes
Mode Behaviour
switchport mode dynamic auto DEFAULT MODE for layer 2 interfaces of Cisco
switches
Passively waiting to convert the port into a trunk.
(DTP listening for messages from the far side
saying "let's form a trunk")
Becomes a trunk if the other side of the link is
configured with trunk or dynamic desirable mode
switchport mode dynamic Actively trying to convert the link to a trunk. (DTP
desirable actively sending messages to the far side saying "let's
form a trunk")
Becomes a trunk if the other side of the link is
configured with trunk or dynamic
desirable or dynamic auto.
switchport mode access The interface becomes an access
port.
DTP negotiates the link as nontrunk
link.
Layer 2 forwarding logic is performed per VLAN. For example, in figure 1, all
end-stations on the left are configured in VLAN10 which is a separate broadcast
domain and different subnet. The servers on the right are configured in VLAN20
and are in their own broadcast domain and different subnet from VLAN10.
Because VLAN10 and VLAN20 are different broadcast domains, frames from one
VLAN will never leak over to the other. Therefore, the switch acts like two
separate switches as shown in figure 1.
Routing between VLANs with a router
Ultimately, when we design networks, we want to have any-to-any connectivity
between all devices. Following the logic that we have learned in the previous
lessons, that
VLAN = Broadcast Domain = Subnet
to enable connectivity between two VLANs means to enable connectivity between
IP subnets. Therefore, we need to have a device that acts as a router. There are
two possible solutions, we can use an actual router to do the routing or the switch
itself can perform routing functionalities. Switches that can perform Layer 3 routing
functions are called Layer 3 switches or Multilayer switches.
In the following example, we are using a router to route data between VLAN10
and VLAN20. The router has one physical interface connected to switchport in
VLAN10 and one physical interface connected to switchport in VLAN20. Thus,
the router has one interface in subnet 192.168.1.0/24 and one interface in
subnet 10.1.0.0/24 and it does what all routers do - route IP packets between
subnets.
The downside of this approach for forwarding data between VLANs is that
the router must have physical interfaces for every VLAN. Above example is a
feasible design option, but if we have 10+ VLANs for example, it will
obviously not scale well because we will use 10+ interfaces on both the
router and the switch.