A technical look at the transport layer, both UDP, TCP, and the new kid at layer 4 called QUIC. A look at the advantages of Google QUIC protocol and the adoption of QUIC with HTTP3. The importance of port numbers that connect applications to applications across the network.
IANA’s role in port numbers and services assigned at layer 4. Understanding client-server software design and the role of layer 4. A look at ephemeral port numbers, sequence numbers, and acknowledgment numbers. Using PowerShell at layer 4, Sysinternals’ TCPview.exe, and Wireshark to demonstrate layer 4. TCP streaming capabilities, use of segments, congestion control algorithms, and reliability. Layer 4 Flood attacks.
Hello and my name is Lowell Vanderpool and this channel is dedicated to IT professionals,
IT students, and anyone who's interested in technical subjects. So this is video eight
as we look at the OSI seven layer model. You cannot be serious about studying information
technology and wanting to really understand this field without a commitment to networking.
So we are in OSI layer four. We're going to be looking at the role that TCP and UDP protocols
play in that layer four OSI model. We're also going to look at refer back to IANA,
the Internet Assigned Numbering Authority, and its role in technical documentation.
Anytime I want to understand about TCP or UDP or QUIC or any protocol that is used on the
internet today, I go back to the authority and the keeper of that technical documentation,
which is IANA. Make IANA a pit stop often to go look at and review what is on that site.
IANA distributes information via five regional internet registries and we have the African
continent, which is taken care of by AFNIC. The Asia Pacific region is by AFNIC. ARIN takes care
of the US and Canada. LACNIC takes care of Latin America. And then the RIPE NCC takes care of
Europe and Russia. This is a great time to look again at the OSI seven layer model. And we can
see we've got two hosts connected via a network and we can see that network traffic flows down
these network stacks across the wire up to another host. It is so important that we keep in mind
the peer-to-peer communication, layer two talking to layer two, layer three talking to layer three,
layer four communicating to layer four. That is as important as obvious the layer, the vertical
movement of data across the wire and then vertically back up the host via the seven
layer model. This is the first time at layer four where that we're going to leave two, three, two,
and one, layers three, two, and one, as they are the responsibility of the network. Four, layer
fours, layer five, layer six, layer seven are going to be the responsibility of the host. So this is
the first time we really are now into the host layers of the OSI model. So layer four is one of
our first layers that is considered a host layer. Also, we're going to be looking at two major
protocols here. We're going to look at UDP, which packages its information in what is known as
datagrams and then TCP, which packages its data in what is known as segments. It's at layer four
that we really want to start revisiting the concept of client-server software. All enterprise software
is built around client-server. Some module of software, some process, some browser, some database
front end, or whatever it is that's connected on a client device, where that's a mobile platform,
a tablet, or a laptop, or a PC that is going across the network and connecting to another
software package on cloud data center or a server in your local network. All, 99% of all serious
software is designed client-server architecture. It can be all kinds of different kinds of
applications that have some kind of software on a client and another corresponding software
on a server. Layer four is going to help the programmers connect this software on the client
to this software on the server. That's a critical feature of layer four. We often forget that 90%
of the software that we download on our mobile devices is right out of the box client-server.
You're loading some app on your device, mobile phone, tablet, whatever, and you're connecting
it to some cloud or data center or individual server, whatever is the case, but you're using
client-server applications all the time. Layer four plays a critical role in this. Now, don't
think of just web devices. Think of access, Microsoft access, connecting to an SQL server
on the back end, even gaming devices that connect to massive gaming data centers. So,
they have simple client devices that that software connects to massive arrays of data center servers
that connect them to a gaming application. This is client-server. So, the transport layer,
layer four is, listen very carefully, connecting applications on one host to applications on
another host. We're going to be looking at two major protocols here, TCP transmission control
protocol and user datagram protocol. And we're also going to look at the new kid on the block
quick, which is impacting TCP to a great degree. As we're talking about layer four, we're in the
middle of a major shift in the internet and it's all focused on layer four. Historically, when we
go to Netflix to watch a movie or YouTube or to get our Gmail using a web browser, we would go
TCP, TLS, which gives our secure connection, and then HTTP2, which is the web standard right now.
That is all getting ready to change. Google has been, has offered its quick protocol,
which is moving to UDP, a congestion control mechanism, TLS, and then HTTP. This is a major,
major change in the way we use the internet today. Does this mean that UDP is replacing
TCP for good? Well, it's definitely going to have an impact on the amount of traffic that is being
used by TCP versus what is going to be used by UDP protocol at layer four. Remember these layers,
layer four connects application to application. This is critical. QUIC, which is the new protocol
that's going to lean heavily on UDP protocol is the foundation for HTTP3. So W3C is the worldwide
consortium and it's responsible for setting the standards for the web. Right now we're at HTTP2
and we're getting ready to move to HTTP3. QUIC will be the standard protocol for HTTP3. We will
look at why everyone is looking at QUIC rather than the historical protocol stack that we've
typically used for the internet or for web traffic. Now, not everyone agrees with this.
So there's some really good debate out there. And I put some interesting web link, a URL,
if you want to go look at some of the debate that's going on about QUIC versus TCP. QUIC is
QUIC UDP Internet Connection. It's a network protocol initially developed and deployed by
Google and is now being standardized in the Internet Engineering Task Force, IETF. Now,
TCP is not going away. It's longevity and broad adoption and it's incredible flexibility. It can
do micro exchanges to gigabit data movements. It can do transmission speeds from hundreds of bits
per second to hundreds of gigabits per second. And the server side control of TCP's behavior
contributes to its flexibility. TCP is not going away, but there is definitely a shift to UDP.
Let's take a look at QUIC. So I've got my virtual machine running. I'm going to launch Edge. This
is the new 64-bit Edge that's built on Chromium. So it's very much like Chrome, Google's Chrome.
Let's go ahead and launch this. And I'm just running here. So I'm pulling this up. Now,
most browsers, if you hit F12 when they're running, they will actually pull up a diagnostic tool.
We'll go ahead and do that. And this pulls up a very interesting diagnostic tool used primarily
by web designers to look at their web page and look at the web server and look at what's going
on between the two. But it's a great tool for us also. If you'll come up and you'll choose the
network tab, you'll disable your cache and you will have a protocol column here. Now, if you don't have
this protocol column, which you probably won't, you can just right mouse click and check under
protocol and it will add that column to your list. And I'm just going to go to and notice under my
protocol, I'm going to go here and get to Google's website and notice the protocol
HTTP2 plus QUIC. We're now using the QUIC protocol. In other words, we've stopped using TCP.
We are now using UDP to go to a website. Most of Google's main service pages, their Gmail,
their web-based Gmail, YouTube, most of their sites are now based on QUIC. So if you go
to their sites using a Chromium browser, you're going to automatically switch to QUIC
as your protocol. Facebook is also using this. So let's go to Facebook and notice my protocol
is simply HTTP2, but I'm going to go to login and I'm going to create a new account. And when I do
that, look what pops up QUIC. So Facebook is already moving its sites to QUIC also. So I'm
no longer using TCP. I'm now using UDP. This is a major change in web traffic.
Microsoft announced in 2019 that it's also going to provide SMB3 over QUIC and it's going to support
that on their Windows storage server. So you could be at home and connect securely without a VPN
to a storage server. QUIC brings security that we don't have right now. It prevents server spoof,
prevents server spoofing, prevents that man-in-the-middle attacks. It's protected by TLS
and no VPN is required. It is much more friendly with firewalls. You're going to have much less
firewall issues. Google showed that 98% connection rate with SMB using port 445 over QUIC. Some of
the disadvantages, there's no hardware off, offload yet. There's also NTLM is the default.
You can pause the video if you want to take a look at SMB and QUIC in the components between
an application and the local file system. Layer 4 is a multiplexing, demultiplexing layer,
and it requires addressing. Now we don't normally think of layer 4 with addressing,
but we have to have some kind of mechanism to be able to connect a user mode app on a laptop to a
user mode app on a server. And that is where we're going to get into TCP IP port numbers.
They provide layer 4 critical addressing. In our picture here, we see our client with lots
of applications that are communicating via the network, coming down, transferring over to a
server. Those, that network traffic has to know how to find the corresponding application on the
server. So it is via port numbers that make that magic happen. IANA again plays a major role at
layer 4 with port numbers. From port 1, port 0 is never used. From port 1 to 49,001, that's the
highest port number assigned in the IANA schemes. IANA has also over 14,221 services listed for TCP
UDP. From tic-tac-toe, yes, this is real, to license plate readers, yes, this is real.
Port numbers connect processes from an Apache web server in Ireland to a process or a Chrome browser
in Orlando. Port numbers are the mechanism that allow one process on one host to connect to
another process on another host. Port numbers are addressing at layer 4. Now, typically, this is a
list of port numbers for UDP and TCP that almost all of us that have taken a certification exam
have memorized in our sleep. IANA breaks down port numbers into groups. There is what's known as
well-known privileged port numbers from 1 to 1023. Remember, we don't use port 0. Then there's
registered user port numbers from 1024 to 49,151. So anyone can go to IANA that has a viable port
application and request to reserve any one of these port numbers for either TCP or UDP.
If the request is approved, then IANA registers that port number and assigns it to that application.
Now, there's also from 49,152 to 65,535. Those are considered private dynamic port numbers. IANA
neither reserves nor maintains these port numbers. Anyone can use them for any purpose without any
registration. Back to this slide. All these port numbers that you had to memorize for your A+,
Net+, Microsoft certification, every one of these port numbers on this list, these well-known port
numbers, are server-side application port numbers. They're never client. Client processes never use
well-known or registered ports. They use what is known as ephemeral port numbers. An ephemeral
simply means something that lasts for a very short period of time, and I mean very short.
Your operating system assigns each client process a temporal port number, a ephemeral port number.
They are quickly used and reused repeatedly throughout the time that you have your PC running.
So, I'm firing up my Wireshark on my virtual machine, and you can see I've got,
I'm capturing traffic. I'm going to come up and just look at TCP,
and I'm going to launch a browser so we can get some traffic. And you can see there, there we go.
I'm just going to pick anything, and if I go to TCP, you can see the destination port. This
is an ephemeral port that is generated by the protocol TCP on the Windows operating system.
They're used very, very quickly. They can be reused. They're pulled randomly from a pool
of port numbers that are generated within the operating system.
From an application programmer's perspective, the concept of socket is very important. Whenever I
have an IP address with a port number, this is known as a socket. A lot of the important APIs
built into Windows, Linux, iOS, have the concept of socket, where you're using an IP address and
a port number. Because when an application on one host needs to communicate to an application
on another host, you're typically going to use a socket. So, this is a very important concept.
In Windows, we call it Windows Socket or WinSock. So, understanding applications that talk to
networks is very important. Let me show you some quick ways to understand how to do that.
IT professionals have to know what applications or processes on their PC, laptop, etc. communicate
to the network. I'm going to use Process Explorer from System Internals. I'm going to right mouse
click, hit yes, and I've added two columns, Network Receive and Network Send. I'll show
you how I get them. I'm going to come up to the columns, and I'm going to come up to Process
Network, and I'm going to check Receive Bytes and Send Bytes. Just something that I can look
at networking on every process. And you can scroll down, and I can begin to see what processes
are talking via the indicators and the metrics that are showing up. And I can see that down here,
I can see Edge has a number of processes, a parent process and child processes. Not all of them talk
to network. This one definitely does. And I can use my properties and pull it up, and I can see,
yep, I definitely have both IP addresses and port numbers that I'm using in this process to
communicate to the network. So we have sockets there. It is very important that you know these
are all potential vulnerabilities. So the IT professional needs to know what applications
talk to the network. Keep in mind at Layer 4 Basics, UDP and TCP multiplex streams of data
from user mode applications and demultiplex streams of data from the network. UDP acts
more like IP. It's connectionless. It's unreliable. It's unacknowledgeable. It simply packs up a
message in a datagram, boom, sends it to IP and doesn't care, doesn't look back. It's amazing
how different it is than TCP. TCP is connection oriented, establishes a connection, breaks a
connection, congestion control, error checking, sets up a sequence of packets. It's far and away
more complexed a protocol than UDP, which simply barely puts the data in a package and just sends
it out the door. Very, very different protocols. What does UDP not do? It establishes no
connection before sending data. It just packages data and sends it off. Provides no acknowledgement
to show that data was received. Provides no guarantee that the message will arrive. Detects
no lost messages, nor will it retransmit them. Will not ensure that data is received in the same
order that it was sent. Provides no mechanism to handle congestion or manage the flow of data
between devices. Doesn't do a lot. UDP is simple, low overhead, fast transfer of a lot of data.
It does do multiplexing and demultiplexing from processes in the user mode down to the network
stream and backup. Now, a lot of applications love UDP. DNS, major user of UDP, except when
we're talking about zone transfers. And then DNS uses TCP, DHCP, TFTP, SNMP, RIP-1, RIP-2,
RIP version 2, NFS, Kerberos, Server Discovery, many digital media streaming protocols,
Voice over IP if it's using H.323 protocol, and some online gaming all use UDP. As we come to
TCP, complex. Because of the complexity of TCP, many RFCs describe its rich feature set. So,
here's a list of many. Although RFC 793 is the major RFC for TCP, there are many more RFCs that
describe more in depth its feature set. The TCP headers, as you can see in this graphic,
show the complexity. We literally could spend three videos on TCP alone. What does TCP do?
It establishes and manages and terminates connections. It transfers data. It's a very
efficient data transfer mechanism. It has addressing and multiplexing, provides reliability,
transmission and quality services, provides flow control and congestion avoidance features.
As you look at TCP, you'll see that a lot of things we talked about in layer two
are reflected again in TCP. TCP is a full-featured protocol. It provides applications with a
reliable way to send data using a very unreliable IP protocol. It allows applications to send
bytes of data as a stream of bytes and automatically packages them into appropriate
size segments for transmission. This is very important. Applications can stream data into
TCP. It's a streaming protocol. TCP uses a special sliding window algorithm, and I'm going to show
you there's about 12 of these different algorithms. Windows 10 actually uses two different algorithms
based on what you're doing. This controls the speed of transfer data, plus it allows the
acknowledgement system to make sure that recipient has received all the data. It handles
all the necessary retransmission if there's a packet or segment lost, and it provides flow
control so each device in a connection can manage that rate at which the other device
sends data to it. TCP allows what no other protocol in the network stack allows, in that
applications in the user space can stream data into TCP. It will take those streams of data and
break them into bytes, eight bits. Every byte of data, a sequence number is attached to that. So
as it streams data in, it loads up a segment full of bytes. Every byte has a sequence number
assigned, and that's a 32-bit number, so they're pretty radically big. As the segment is received,
the other end, the destination, it can look at that sequence number and put back together
every byte of data in perfect order. This is just one of many very complex but effective and
efficient mechanisms in TCP. So below in the graphic, I've captured a snapshot of Wireshark,
and I've just chosen a packet that is using TCP as a protocol, and then opened that up,
and you can see where I've got the red square, that's the raw sequence number. Remember,
sequence numbers are 32-bit numbers, so it can represent any number from zero to four billion.
So they're usually pretty big in size, but they are attached and allow the accurate tracking of
data in transmission, reception, and acknowledgement. Every eight bits, a sequence
number is applied to that. TCP provides reliability with speed. The whole concept
of sequencing numbers, acknowledgements, and the sliding window which allows more or less
data to be sent based on the receiver is a very complicated subject. We could spend literally
two or three videos on just these concepts alone. Let's take a look at some PowerShell demos as we
look at PowerShell at layer four. I talked earlier about different algorithms used by
Windows for the sliding window and congestion control. Two popular ones that Windows uses
is called Qubic and Neurino. These are different algorithms used for different functions. Windows
can shift based on the way you're using TCP. For you to see that, you can type in get net
TCP settings, pipe, and then just format table. And it allows you to see those algorithms.
A look at a couple different types of variations for the test net connection. So let's do it.
And we're going to go ahead and do the test net connection. Now, you can do things like put a
computer name. Notice I could go to a port right here. I could go ahead and choose a port if I
wanted to and put in a port 80, port 443. I can also use the common TCP port. And here I can go
dash. And I can choose HTTP, RDP, SMB, Win Remote, WinRM. So there's some common. And we'll go ahead
and choose HTTP. And then computer name. I'm going to go ahead and choose that. And I'm just going to
hit enter. So this is a great tool that allows you to go out and test a connection at layer four.
Now, I could do this a little bit different. I could do test. And this time, I'll go ahead and
put www.ebay.com. And I'm going to port right here. And I'm going to use 443. So I'm going to test the
SSH or the TILT. Here I'm testing the 443 port. And there you can see the connectivity,
the test of that remote device using this tool. I'm going to do a different approach. I'm going
to do test net connection. This time, I'm going to do an IP address 1.1.1.1. That's my DNS provider.
And I'm going to do port. And I'm going to do 53. So this allows me to query or probe
port 53 on a DNS server. And notice it took some time. So give PowerShell, give it some time. We're
going across the network. And so it's not an instant result. Let's take a look at another
series of PowerShell tools that allow you to, I'm going to go ahead and paste it in here and go ahead
and let it run. This allows the technician to be able to look at remote host, whether they're
on your domain or on your local network, or they're on the internet. Whatever is on the internet is
even more important than what's on your local network. What remote host is talking to my
software on my PC? A column called owning process, that's your process ID. So I can identify what
process on my PC is talking to what physical host, either on my local network, on my domain,
more importantly, on the internet. I need to know that as a tech. Another portable app that is very
powerful in allowing you to solve that same dilemma as to what remote devices, what remote
hosts, either on my local network, on my domain, or on the internet is connected to my software.
You can also use system internals, TCP view. I just showed you how you can use PowerShell.
It doesn't give you as much information, but I'm using TCP view. And here I can look at every
process. It's PID. I can look at the remote host. And in many cases, it tries to resolve the name
of that. So if it's a local computer or a local server, I can easily see that. If it can't resolve
that, it will give me the IP address. And it allows me to see what hosts either on my network,
on my domain, or on the internet is connected to my software. You need to know that as a tech.
And I can use TCP view to actually end that process or close that connection. But most
important to know what is connected to my PC. TCP, unlike UDP, is a connection-oriented protocol.
And it does that using what's known as a three-way handshake. It sends three packets, a sync,
a sync acknowledge, and acknowledge that establishes a connection between the client software and the
server software. Remember QUIC that's going to replace TCP. Let's look on the left. We'll see
TCP and its three packets in order to set up a connection. And let's say that takes 100 milliseconds
if you're looking. And then go to the center. This is TCP plus DLS, which is your secure connection
with TCP with its three packets to create a connection. And then TLS requires more
transversing of packets in order to create a secure connection that can be up between 200
milliseconds and 300 milliseconds. Let's look at QUIC. QUIC one packet, done. We've got UDP,
congestion control, security, and we're ready to talk. One packet. This is where QUIC shines.
Just as TCP is required to do the three packet transfer in order to create a connection,
it also has to close the connection. And so on the right-hand side, you'll see the packet transfer
and the terminology used for that so we can close a TCP connection. So let's quickly look at the
benefits attributed to QUIC versus TCP. Connection establishment latency, we'll look at that.
Improved congestion control, that doesn't fix everything. And when we add latency in here,
it's going to get ugly. Multiplexing without head of line blocking, QUIC does a wonderful job here.
Forward error correction, that's being discussed at the IETF. If that happens, that should reduce
retransmission. And then connection migration capability. That's definitely a benefit of QUIC.
As you watch this video, you can definitely see the benefit of QUIC in the speed of making a
connection between a client and a server. The IETF is discussing whether they should add
the algorithm Neurino or Qubic as the congestion control algorithm. The problem is both QUIC and
TCP use congestion control and reliability. And reliability is done by acknowledgments
and retransmissions. So here we see the classical packet transfer between sender and receiver.
We see acknowledgments and then we see P3, we see a packet lost, an acknowledgment not received,
and then there's retransmission. And over the period of that, we only get three packets sent.
That's some of the downsides to reliability and congestion control is you impact your transfer
rate. We want reliability and congestion control, but when we add latency, as you're seeing in this
clip from Star Trek, we have an individual, a cast character who is being tossed a ball
and they're responding very, very slowly to the ball being tossed to them. This is a perfect
example of latency. So when I send a bit from London to Sydney across the fiber optic network,
I'm going to get 80 milliseconds due to latency. And when you add the problems of packet loss
and latency, it gets ugly quick for video conferencing. 100 milliseconds is maximum
tolerable latency for something like video conferencing. So let's take a look. Here's a
slide that shows transferring of packets. Every packet now adds latency, five millisecond requirement
for every packet. So we're throwing that five milliseconds of latency for every packet transfer.
We still have that packet loss at P3. Adding latency and reliability and congestion control.
Look at the end result. After 65 milliseconds, we've sent four packets. Multiplexing without
head of line blocking is definitely a place that quick shines. Notice my graphic. I've got HTTP1.
You see multiplexed traffic with TCP. You see red blocks, blue blocks, and green indicating
multiplex data going across from one device to another. In the middle section, you have HTTP2
and TCP. And you'll notice there's a blue block and an X through it indicating a lost packet.
With TCP and HTTP2, when you have any one stream lose a packet, it stops everybody. So the red
stream is stopped. The green stream is stopped. But with QUIC at the bottom, only the stream that
lost the packet is impacted. The red stream continues on to the client and the green stream
continues on to the client. And that is called getting rid of that head of line blocking problem
that we have with TCP. QUIC, the IETF is looking at adding forward error correction with QUIC,
which would greatly reduce retransmission of a missing packet. QUIC adds its own unique identifier
called connection UUID. This provides seamless handoff between a wired connection and an LTE
connection or a wired connection and a wireless connection. So this is a big improvement for QUIC.
Because of that sync to create a connection with TCP, there are a number of attacks out there that
are very effective against TCP. And that is the sync flood attack where clients can be told by a
sync signal. The server then thinks it's trying to, each of these clients are trying to create
a connection. And literally, if enough clients send a sync signal, the server is attempting to
set up these connections and literally will run out of memory space, crash and burn. That is called
a sync flood attack. We can also do a UDP flood attack. It's a little bit different, but it has
the same idea. So I'm looking at NETSCOUT's Cyber Threat Horizon website, and it gives us a real-time
view of today and distributive denial of attacks. And you can see in this visualization of clients
attacking a single cloud center or a web server or a web service, you can see this is going on
very, very strongly even today as we record this video. If I come back up here to the history,
I can look at a TCP reflective amplification carpet bombing. I'm going to click on it,
and it happened in November the 3rd. And you can see the clients being controlled by botnets
attacking various entities and trying to shut those, whether they're web services or a website
or whatever. You can see those attempts to use TCP, amplifying it by using multiple compromised
clients and trying to shut down or cause servers to become unstable. And you can see it. It's very,
very, very, very interesting. I'm also going to include a couple things, new PowerShell tools
that you can use, everything you want to know about your network cards. I'll put those also
in the PowerShell document you can download in the video notes. Here's some more PowerShell tools
that are really, really cool. I'll have these in the slide deck as well as in the PowerShell
tools that you can download both in RTF form,
where you can edit it as well as PDF, whichever way you like it.