OSI layer five is a complex but remarkably interesting layer where protocols like RPC, Winsock and many more exist and run. Layer 5 is about synchronization of data, establishing, maintaining, and ending communications. You will learn about H.245, iSNS, SMB, RTCP, and another layer five protocols. We will explore how Windows 10 implements layer five. We will use tools to view and expose protocols operating at Layer 5. Enjoy learning some new concepts in Layer 5.
IT students and anyone who's interested in technical subjects. Welcome back to our study
of the OSI model. We are looking at the network stack both theoretically and practically. We're
looking at layer 5. The theoretical concepts of layer 5 are tough. Some very very bright people
write the RFCs that write these protocols and they're not easy to expose or to see how they
work or their activity. It took a lot of work to find some tools that would allow us to look at
them and see how they work. You're going to be surprised you're going to recognize a lot of them
you just didn't plug them in at layer 5. And don't get discouraged because you struggle
understanding certain theoretical concepts and the network stack is one of those. The people
that write these protocols who are the people responsible for developing this kind of software
are super bright people. Some of the brightest people on the planet. If you are struggling with
understanding don't give up. Just like this pup when he was small and trying to catch frisbees
you probably didn't get them very often but over time and persevering and working at it
he catches those frisbees quite often and don't think you're going to take that frisbee from him.
We're looking at two conceptual models the OSI reference model here on your left and the TCP
internet model on your right. When we talk about developers that are developing software protocols
or the IETF the Internet Engineering Task Force as they create RFCs they are all looking at the
internet model and they take layer 5, 6, and 7 and they put it in one block called the application
layer. Why even mess with OSI? Without a doubt even though all of our developing and RFCs are built
on the internet model there's just nothing like the OSI helping us get a clearer perspective
sometimes helping us to understand something that's difficult and allowing comparisons between
what is in reality and looking at the OSI model and the fact that everybody still uses the OSI
model. As we explore the layer 5 the session layer and we can see in this OSI model here it's
called the inter-host communication that's its function and we'll see why that's a pretty good
definition but look over in the data unit notice that it is dealing with application data streaming
down from an application and I'll get into that in just a minute. At the transport layer we see
we have segments at the network layer we have packets at the layer 2 we have frames and the
application presentation and session layer we're dealing with application data coming down into
the network stack. Let's take for example I've got Corel Aftershock running on my PC. It's a
desktop application and it likes to talk to Corel's server farm way over here and I don't know exactly
where it is but it's on the internet and it's probably got a load balancer and then a server
farm behind it. Now Corel Aftershock sends hooks and information down the stack and basically gets
to the session layer and says look here's the web address for Aftershock's I mean Corel's server
farm and session layer hands that off to the transport layer and says look find out where this
is on the internet and this is a chunk of data that I need you to send to that server so that
I can connect this application on my PC to a server based application on the server farm. The transport
layer network layer data link layer all do their job get a DNS work with DNS get an IP address and
begin to send that request for a session between this application and this application to get that
started. Once enough information goes back and forth these two agree on a session. This application
says yes we've got a session and this server based application says yes we're connected. Now depending
on the protocol that this application was written for it could be using a number of different
protocols at the session layer. It could be using RPC to communicate and talk to this server based
application. It could use Winsock. It could use H.3.3. So there's a number of protocols available
depending on the programmer who wrote the client server application how he uses session but they're
always going to be the same. This is going to be responsible for connecting this application
through the session layer to this application. Now it's also going to do things like make sure that
there's a recovery point so if something nasty so if I have something really go bad with my
Central Florida Internet Exchange data center or Tampa let's say Spectrum sends me to Tampa
to their internet exchange and I get a switch that is overloaded or I get a router that starts
dumping my data between Aftershock and the server farm the session will attempt to leverage a
recovery point so that even if we've lost some data at say an exchange point we can somehow
recover and continue on with the session. Another important feature of the session layer is once
we've got these connections and these are talking and data is moving flowing appropriately when I
decide to close out my application on my PC there has to be a way of gracefully shutting
down this session and so that is what those protocols at layer 5 are going to do. They're
going to create the session. They're going to manage the session. They're going to have recovery
points to the session and they're going to gracefully close the session. Now before you get
too excited about the recovery that I talked about remember when I have an application streaming data
down the session layer and the transport if we're using TCP all have built-in mechanisms to try to
fix missing pieces or out of out of order pieces and so there's a lot of recovery components in
these layers but they're never designed for catastrophic. So if I've got a stream of bits
coming down and it hits the Central Florida Internet Exchange and in there is a switch that's
just absolutely slammed and it starts dumping about a second of my data out into the bit bucket
that is probably about 300 packets and there's no way for this transport layer even if I'm using
TCP and this session layer and this session layer to try to recover and that's where you get
applications that lock up. You're running Skype or Zoom and the other individual turns in this
pixelated mess or if you're running a mobile app the mobile app freezes and can't recover and
sometimes you have to reboot the phone. The network stack is designed to recover from a segment or a
frame loss or small amounts but not from these catastrophic failures. My favorite analogy for
the session layer, the layer five, is the good old business meeting. The one that everyone loves.
You first have an establishment of the session. You have a date and time that everyone meets.
You sit down and you orderly exchange data. There's conversations that go in and it's following
the agenda. You have rules to follow and then at some point in that business meeting you terminate
the business meeting and hopefully you go to lunch. So let's look at the technical definition.
Provides services that allow the establishment of a session, manage a session, terminate a session
provides orderly data exchange, synchronizes the dialogue, and releases the connection in an
orderly manner. An important feature of layer five is synchronization. My Corel AfterShot
application on my desktop is talking to the Corel Server Farm. I'm depending on those lower level
network protocol stacks to take care of getting the data there but layer five is synchronizing
the data between my Corel AfterShot and my Server Farm application running on those servers.
It's very important that we keep that data synchronized and that's a function of layer
five. Let's look at these upper layers as they work together. So in my Skype application you
can see I've got my Skype. I've got Skype running on my desktop. It's going to send
requests down to APIs in layer seven, the application layer. Those, it's going to then
begin streaming data and onto layer six, presentation layer, which will take the data
and convert it to binary. It will most likely encrypt it because it's going to send it across
a network. At layer five we're going to establish the session between my Skype application on my
desktop or laptop and the Server Farm that is managing all these conversations of everyone
else including myself. It's going to establish those connections. It's going to maintain the
session between the Server Farm and Skype application on my desktop and it's going to
end the session appropriately when I decide to close out Skype or end the conversation.
Let's lift the hood on Windows 10 and let's look at where layer five is. Most operating systems
including Windows put most of layer five components and software modules in user mode. They're not in
kernel mode. Popular protocols in layer five in Windows are NetSocks, NetBias, and RPC, Remote
Procedure Call. There's more but those are very popular. Let's look at this architectural diagram
of Windows 10 and we'll get a better understanding of where the session layer is. Now you can see
I've got, in my case, I've got Hypervisor loaded, Hyper-V installed. I've got my secure, my BSM,
my virtual secure mode. I've got my HAL. I've got my hardware drivers and my kernel and everything
above that kernel is user mode. Now all of those small blocks that are green and yellow are services
and if we look at our previous diagram all of those session components are typically found
in services running in user mode. So looking at services, here's one service that has got layer
five in it. It's the Background Intelligence Transfer Service, BITS. Here's a few more. We've
got RPC, Remote Procedure Call, which is a very popular layer five protocol session layer. Here's
RPC Locator. Here's RPC Endpoint Mapper. We also have this server service which provides SMB and
we also have the workstation service which provides SMB. So those are just a few. There's many more.
So when you're asking yourself where in Windows do I find layer five, open up your services. Let's
look at common protocols in layer five. The H.245 protocol for multimedia, ISNS, the Apple Talk
Session Protocol, NetBias, SMB or Server Message Block, Remote Procedure Call Protocol, RPC,
our Real-Time Transport Control Protocol, Short Message Peer-to-Peer, the Session Control Protocol,
the SOCKS, which is used in Linux and Unix, and Microsoft ported that into the Win32 environment
and changed the name to WinSOCKS, Zone Information Protocol and Socket Direct Protocol.
Let's take a look at the more commonly used layer five protocols. Just a quick refresher again,
let's take a look at some definitions. Notice it's session layer. It's in the software upper layers.
It's to establish, manage, terminate sessions. It predominantly is APIs, SOCKETS and WinSOCKETS.
Keep in mind as we think about layer five, layer five is data. So when you look at this chart and
we look at session presentation application, it's data coming from those user mode applications
that's streaming down into those top layer protocols in the network stack. Some protocols
at layer five also include authentication such as NFS or SMB. RPC can also include authentication
as you transfer data from a server to a client software package. One very popular protocol at
layer five is called Remote Procedure Call, RPC. Programmers love this because it makes it so much
easier for the programmer. He can write a series of commands or instructions and he can use the
same instructions and commands that he uses locally on the local machine. He can use those
same functions on a remote host. It removes the complexity of the network out of the picture.
So RPC is a very popular layer five protocol. Win32 and Win64 desktop applications that are
client server make a heavy use of RPC. In the Linux Unix world, NFS heavily leverages RPC.
So here's a diagram of the Windows 10 network architecture that supports two very favorite
layer five session layer protocols. One is RPC and Winsox. If they require authentication,
they can reach out through services and talk to Active Directory to make sure that the user has
the rights to these network remote hosts. gRPC is a high performance RPC framework created by Google
and it runs on top of HTTP2. A number of languages use RPC such as the Linux Unix NFS system. JSON
RPC. SOAP uses an XML RPC. Apache Thrift Protocol leverages RPC and even HTTP. Back to those
theoretical concepts of layer five, we have Dialog Control and Dialog Control allows communication
between two processes. That communication could be half duplex or full duplex. Synchronization
again is very important at layer five. It is part of the checkpoint and recovery system
for layer five. Winsox is another popular protocol at layer five. You can see the architectural
block diagram for Windows 10. Winsox runs over IP version 6, IP4. It also works over Infrared
Data Association or IRDA. It is also supported by Bluetooth. Windows uses the term Winsox. Linux
and Unix use the term Sockets. Both are very similar. Microsoft has modified the Winsox
protocol to give extra functionality. You can look at your applications that use Winsox by
doing the NetEsh Winsox Show Catalog. There's over 146 Winsox functions available to the
programmer. Let's take a look at my Windows 10 box. I've got my PowerShell console up and I've typed
in NetEsh Winsox Show Catalog. I'm going to go ahead and enter. And you can see a lot of things came up.
So we have like NTDS popped up, TCPIP. So these are all have some kind of hook into a Winsox
Network Location Awareness Legacy namespace. Here's Bluetooth. Here's PRPNRP namespace provider.
So you can see there's a lot of stuff in here. Here's some email naming shim provider. So there's
a lot of components that leverage Winsox. And you can just scroll through your catalog and you can
see them. NetBias is a very popular Layer 5 protocol. It was built around legacy applications
and computer naming and workgroup naming systems. It was developed by IBM and Microsoft for DOS
running on networks, yes, a long, long time ago. But due to thousands of critical government,
hospital, business applications written in the late 1900s, early 2000s, if we tried to remove
NetBias naming, it would break these applications. So your computer name in many cases, especially
computers not on domains, they're all limited to the NetBias naming system. If you're on Active
Directory, you have a fully qualified domain name, let's say like vwp-10.techsavvyproductions.com.
That's a fully qualified domain name. But your computer name vwp-10 is limited to 15 characters
because NetBias required a 15 character computer name. Have you ever tried to give your computer
name a name longer than 15 characters? Well, you can't because of NetBias. Here I'm in the system
applet, I'm in system properties, and I'm trying to change my computer name. And if you'll notice
in the computer name dialog box, I put a long computer name. It doesn't like it because NetBias
rules in Windows 10. Due to that backward compatibility that Microsoft must maintain
for these older applications, your computer name must meet the NetBias standard, which is 15
characters. So even though I want to name my computer with a longer computer name, no go,
15 characters. Because of those applications I just talked about, many organizations, large
organizations, government organizations who are running these legacy applications have to enable
NetBias running on their PCs. If you'll look at this dialog box, I go to network connections,
Ethernet properties, IP version 4, and then I go into advanced on my IP version 4 properties. I go
into the wins tab and down below I can enable NetBias over TCP IP. Now you don't normally need
to do that at home, but some organizations have to have this feature in order for their legacy
applications to function. So can we see this activity at layer 5? So let's take a look at
some cool tools that lift the hood and let us see layer 5. Wireshark is a great tool to look at
layer 5. So if you go to wireshark.org, you can download this tool. If you're not familiar with
it, you probably don't want to use it until you've had a chance to learn it. But it's a wonderful tool
to view and troubleshoot network traffic. So here I have my Windows 10 box and I've downloaded and
installed Wireshark and I've went ahead and ran a capture. So I've already collected some network
traffic in Wireshark. I'm going to come up to statistics and go to protocol hierarchy and give
it a chance to pull up all that information. Let's just go down to TCP because we know that's layer
4 and everything from that point on is going to be layer 5. So we see NetBias session service,
we see SMB, we see RPC, we see server service. Remember that service I showed you earlier in
the lecture. And we see malformed packet. And at this point, we see hyper hypertext protocol. We
know that that's probably layer 7. But everything between sandwich between TCP and hypertext is
layer 5. Now let's scroll down to UDP. Here at UDP, we see this is layer 4. So we see simple
service discovery protocol, session transversal utilities for NAT. We set up network time protocol,
NetBias. There it is. That's NetBias name service, NetBias datagram service, SMB, mail slots, and
Microsoft Windows browser protocol. And then we get into multicast. But all of those are layer 5.
And you can see there's traffic there. They're running, they're working. That's layer 5. Another
delightful surprise was my favorite suite of tools, system internals. I ran autoruns and lo and
behold, I found some really jewels. So normally autoruns is a tool that I use to remove malware.
But I noticed in the tabs that Mark Persinovich designed in autoruns, they have a tab called
WinSOCProviders. Once the scanning finishes, you do have to make some modifications under options.
You have to unhide Windows entries. But when you do, you can go back to the WinSOCProviders. And
there is a beautiful list of applications that leverage WinSOCs. These, by the way, are the same
ones you saw in the WinSOC catalog. Here I'm actually using another system internal suite
tools called TCP view. When you launch it, you can scroll up here to some of the system processes
that are actually leveraging UDP and TCP. And you can see they are part of the NetBias naming,
NetBias datagram, and NetBias services. Here again, we are exposing some of the NetBias
components in Windows 10. Now when we're talking about voice over IP, video conferencing,
internet telephony, and Layer 5, one of the important protocols is H.323. It has a suite
of tools to help create sessions, control, connect up circuits, tear down circuits, and manage
circuits. So Layer 5 is all about creating, maintaining, and ending sessions between
endpoint applications. A hearty thank you for all the resources made available to people like myself
so that I can do what I am doing on YouTube. Check out our channel and thanks for watching.