Full transcript
0:01In this lesson, we're going to be
0:02talking about what you should expect.
0:04Well, this is a course on TCP IP. So, of
0:07course, we're going to be talking about
0:09TCP IP. We're going to be covering the
0:12protocols in the TCP IP suite. So, we'll
0:15be talking about TCP, UDP, IP, ARP,
0:19RARP, and a lot of application layer
0:22protocols. We're going to be talking
0:24about these protocols in a fair amount
0:26of depth. and we're going to be looking
0:28at them at the protocol level, not at
0:31kind of a highlevel overview where we
0:33discuss what the protocols do. We're
0:35actually going to be looking at the
0:36protocols and how all of the pieces fit
0:39together. We're going to be doing this
0:41in a very hands-on way. And we're going
0:44to be using Wireshark, which is a packet
0:46capture utility, which gives us the
0:49ability to look at the messages that are
0:52actually going out on the wire. So we
0:54can really see in very great detail
0:58what's actually happening and how all of
1:00the protocols are put together and the
1:03information that's actually put into the
1:05various headers that fill up these
1:08protocols and we'll see how they
1:11actually work and operate in a real time
1:15real life setting. As I said earlier,
1:17we'll be talking at protocol level,
1:20meaning we'll be investigating these
1:22protocols, the way they actually operate
1:25and the methods that gets used and the
1:28headers that are actually there. We're
1:30not going to be talking about this from
1:32a slideware perspective where we're just
1:35talking about a higher level view of how
1:39the protocols work and what they're
1:41expected to do. We're actually going to
1:43be looking at the protocols in detail.
1:46We're going to be looking at some
1:47configuration specifics and as I said
1:50earlier, we're going to be looking at
1:51wire level data. We're not going to be
1:54creating things on a piece of paper and
1:57talking about it. We're actually going
1:59to capture live packets and investigate
2:02those. In short, we're going to be
2:05looking at some detailed level
2:08information of the TCP IP suite and the
2:12various protocols that are associated
2:14with it. And we're going to be looking
2:16at live data in most cases so that we
2:19can actually see how it operates. And
2:22that's pretty much what you can expect
2:24from this course.
2:28In this lesson, we're going to be
2:29talking about what you should know. So,
2:31this is kind of the prerequisites, the
2:33things that you should be at least
2:35familiar with before going into all of
2:38the detail that's in this course. From
2:40an operating systems perspective, it
2:43doesn't really much matter what
2:44operating system your preferred platform
2:46is, whether it's Windows or Linux or Mac
2:49OS or maybe something else. The thing is
2:52that TCP IP actually works on a large
2:54number of operating systems. We're going
2:57to be talking about things that you can
2:59actually engage with on pretty much any
3:02operating system. Certainly the major
3:04operating systems like the ones I
3:06mentioned just a minute ago, Windows and
3:09Linux and Mac OS. The different
3:11utilities that we'll be using work under
3:14these operating systems. We'll be
3:17talking about some networking concepts
3:20and it's helpful to understand just the
3:22basics before we get there. not going to
3:25be going into detail about what network
3:28interface cards look like, what cabling
3:30looks like. We'll be referring to those
3:32in kind of a generic sense for the most
3:34part. It's helpful to understand what
3:37those are and kind of how they work and
3:39how they fit together. You don't need to
3:41know a great number of details about
3:44these things, but just understanding
3:46that there's cabling and network
3:48interface cards, and that's how your
3:50computer connects to the network. And in
3:53some cases, you may have a wireless
3:56card. Understanding that that wireless
3:58card uses radio transmissions to connect
4:01to the network and that's how data gets
4:04transmitted. Just understanding that at
4:06a pretty basic level is going to be
4:08helpful as we go through these sets of
4:11videos. So, we'll be using a number of
4:14applications. I'll be walking you
4:17through different utilities and programs
4:19that we can actually use to get into
4:22some detail about the protocols that
4:24we're going to be talking about. But
4:26having just a basic grasp of
4:29applications that use the internet like
4:32your web browser or your email client,
4:35that's really helpful because at least
4:37then you understand how your
4:40applications interact with the network
4:42and how the network has some impact on
4:45the applications that you use. Other
4:48than that though, there's really not an
4:50awful lot to know going into this. We're
4:54going to be talking about TCP IP pretty
4:56much from the bottom up so you can
4:58understand all of the different layers
5:01and how they interoperate with one
5:03another and all of the protocols that
5:05get used for these different
5:07applications. For example, how your web
5:10browser uses HTTP and the different
5:13protocols that HTTP itself relies on.
5:17But just having some general sense of
5:20what networking is and some of the
5:22fundamental concepts of how things get
5:25plugged together and connected is really
5:28kind of helpful as we move forward.
5:32In this lesson, we're going to be
5:33talking about what you will learn. So,
5:36this should be your set of expectations
5:38in terms of the level of information
5:41that you'll be getting as you go through
5:43this set of videos and lessons. We'll be
5:46talking about a lot of different
5:48protocols. Of course, we'll be talking
5:50about the foundation protocols for the
5:53TCP IP suite. We'll be talking about
5:55internet protocol, which is IP. We'll be
5:58talking about the transmission control
6:00protocol, which is TCP. We'll be talking
6:02about the user datagramgram protocol,
6:04the address resolution protocol. We'll
6:07be talking about those as just
6:09foundational fundamental protocols for
6:13how everything else works and how it
6:15goes together. We'll be looking at these
6:18in a great amount of detail. looking at
6:21the bit level in most cases. So, we can
6:24actually see how the different header
6:28fields for these different protocols
6:30actually work and how they interact with
6:33different protocols and how systems
6:36interact with one another using the
6:38different pieces of information in these
6:40header fields. We'll be talking about
6:43application layer protocols as well. So
6:46simple mail transport protocol,
6:48hypertext transport protocol, post
6:50office protocol. Those are email and web
6:53protocols. We'll be looking at those and
6:57how they actually work at the protocol
7:00level. We're not going to be talking
7:02about so here's an email client and
7:05here's how you create an email and how
7:07it gets sent. will actually be looking
7:10at how you would send an email at the
7:13protocol level and the underlying
7:16protocols that work underneath something
7:19like the simple mail transport protocol.
7:22We'll be looking at a number of
7:23utilities. We'll be looking at
7:25Wireshark, which is a way that we
7:27capture packets. We'll be looking at
7:29ping, which is a way to do some network
7:32diagnostics. We'll be looking at a
7:35utility like Netstat, which does network
7:38statistics. As I've said previously,
7:41these different utilities for the most
7:43part work on just about any platform or
7:46operating system you may be running
7:48across. There may be some slight
7:51variations in some case. For example,
7:53we'll be looking at if config. There's a
7:56variation of it for Windows called IP
7:59config. But for the most part, these
8:01foundational utilities like ping and
8:04netstat, for example, run across any
8:07operating system that actually uses TCP
8:10IP for networking. These utilities are
8:13really critical to making a TCP IP
8:16implementation functional and useful.
8:19They're the way that we interact with
8:21the network. They're the way that we
8:23gather information about how the TCP IP
8:27layers are working, how your system is
8:29connected to the internet, whether it's
8:31connected to the internet. We're going
8:33to be using all of these utilities that
8:35I've just mentioned and explaining how
8:38they actually work and operate and the
8:41information that you can get from them.
8:46In this lesson, we're going to be
8:47talking about the history of TCP IP. And
8:50you can't talk about the history of
8:52TCPIP without talking about the history
8:55of the internet or certainly what we
8:58call the internet now. Now back in 1969,
9:02the internet was actually a very small
9:05network that was developed at the
9:08request of the advanced research
9:11projects agency or ARPA and it was
9:14called the ARPANET at that point. So
9:17back in 1967
9:19there was some design discussions that
9:21were held and eventually a company
9:25called Bolt Bannic and Newman in
9:27Massachusetts was contracted by ARPA to
9:32build what was going to be called the
9:34ARPANET.
9:36So the idea was it was going to be used
9:39as a research network to look into the
9:43feasibility of using computer networks
9:46in order to primarily facilitate defense
9:51operations.
9:52In 1969 we get the first node and we can
9:56take a look at a diagram here of the
10:00first hookup here. So we've got the
10:03interface message processor or IMP which
10:06was an early router or the very first
10:08router if you want to call it that and
10:11the first host was a sigma 7 system.
10:15Now eventually by December of 1969 we
10:19end up with a four node arponet and you
10:22can see we've got SRRI, Utah, UCLA and
10:27UCSB. So we've got four nodes on the
10:31internet. The early network protocols
10:35that were used was actually something
10:37called NCP. So we have this host
10:41software and early on it wasn't actually
10:44TCP IP, it was NCP. Arponet hosts start
10:49using network control protocol. The
10:51first host to host protocol. In 1972 we
10:55get the first email which is kind of
10:56interesting. Ray Tomlinson at BBN starts
11:00to send email and that's when the first
11:05at sign was used. But in 1974
11:09is where we actually get to where the
11:12very first specification for TCP is
11:16published. You'll note I only said TCP.
11:20I didn't say TCP IP. At that point there
11:23was no internet protocol. TCP was the
11:27entire protocol and TCP took the
11:30functions that now the IP portion or the
11:34internet protocol portion actually had.
11:36Through the 1970s, TCP kept growing and
11:42in 1978 you can see here TCP was split
11:45into TCP and IP. So they determined that
11:50for better modularity they needed a
11:53whole different protocol. So they
11:54created the internet protocol in 1978.
11:59At that point they were still using NCP
12:02primarily on the ARPANET. In 1981
12:07actually you can see RFC 801 here the
12:10NCP TCP transition plan. So there was
12:14actually a plan to transition between
12:17NCP or the network control protocol and
12:20TCP which is the transmission control
12:23protocol or TCP IP. It wasn't until the
12:26early8s that TCPIP
12:30became the predominant networking
12:33protocol on what was then still a
12:36fledgling internet. It was still called
12:37the Arpanet. And in the early8s there
12:40were several networks that were being
12:42created. In 1981 for example there was
12:46Bitnet and that was a network primarily
12:49of IBM mainframes. There was the
12:52computer science network and there were
12:55several other networks that were being
12:58created around the world. Now eventually
13:01by the mid 80s TCPI IP was the
13:05predominant and de facto networking
13:09protocol on the internet. And it wasn't
13:13actually until the late 1980s that we
13:16really got the internet that we have
13:18today. And that was through the creation
13:21of the NSFnet which would have been in
13:251986.
13:26So the NSF net was created and that had
13:29a faster backbone speed 56k and it was
13:33really kind of an evolutionary process
13:36where all of the networks were folded in
13:39together and we created one large
13:42internet and that was really kind of the
13:44late 1980s early 1990s when that
13:47happened. But by that point, TCP IP had
13:51become the de facto standard on the
13:54internet. And it's really the use of the
13:57sight-to-sight communication and the end
14:00to end communication requirements that
14:03really drove the adoption worldwide of
14:06TCP IP. And that's why we predominantly
14:10use TCP IP on our desktops today rather
14:14than for example the novel IPXSPX suite.
14:18So that's just a brief history of TCP
14:22IP.
14:25In this lesson, we're going to be
14:26talking about using TCP IP. Now, this
14:29one kind of goes without saying perhaps
14:32because it's something that you do every
14:34day. Anytime you connect to the
14:36internet, you're using TCPIP, whether
14:39you realize it or not. Every piece of
14:41communication that goes across the
14:43internet is using the TCP IP protocol
14:47suite or suite of protocols. If I were
14:50to, for example, go to google.com, what
14:54I'm doing is I am issuing a series of
14:58TCP requests in order to get all of the
15:01content on this page to get it back to
15:04me. So, this entire process of just
15:09bringing up Google requires several
15:12pieces of communication that use TCP and
15:16IP. And again, I'm issuing a series of
15:19TCP IP requests or TCP requests. And
15:23we'll eventually get into discussing how
15:26all of these different protocols
15:29interconnect together because it's
15:30really a series of protocols that make
15:33this happen. So what I'm doing here is
15:37I'm actually issuing an HTTP request
15:40that gets encapsulated inside TCP that
15:43gets encapsulated inside of IP that is
15:46then encapsulated inside of Ethernet and
15:49then sent across the wire or in this
15:53particular case it's actually being sent
15:55wirelessly until it hits another
15:58networking device and gets sent out to a
16:01network provider. So there's a series of
16:04protocols here that allow all of this
16:07communication to happen. So I can do
16:10some simple troubleshooting for example
16:13and again this is using TCP IP. So I can
16:18do this program called ping which tells
16:20me that the website infiniteskills.com
16:24is actually up. In this case, I'm using
16:27a protocol called ICMP. And ICMP then
16:31gets encapsulated inside of IP. And
16:34again, we'll talk about encapsulation in
16:37another lesson, but here's another
16:39example of using TCP IP or the protocols
16:43in the TCP IP suite. I could use SSH
16:48which allows me to connect to a remote
16:51system and that again is using TCP IP.
16:56I can bring up my mail program and in
17:00this case I'm using Apple Mail and Apple
17:04Mail is going to use TCP IP as well if I
17:09were to stream music across the internet
17:13for example. So, I can bring up iTunes
17:16and I could bring up the iTunes store.
17:18And this is actually issuing the HTTP
17:22requests that I was mentioning
17:23previously.
17:26And if I were to just grab something,
17:29for example, lay Miss Rob. And if I were
17:34to just stream a little music here,
17:39that again is using the TCP IP protocol
17:42suite. So, anything that you do on the
17:45internet, whether you realize it or not,
17:48is using TCP IP, whether you're gaming,
17:51you're playing Minecraft, for example,
17:54or you're playing Code of Conduct, or
17:57you're playing Halo on your Xbox, as an
18:01example, and you're playing with people
18:03around the world. That again is all
18:05using TCP IP. So just simply knowing how
18:10all of these processes work and how they
18:13interoperate with one another makes
18:15working with networks and
18:17troubleshooting them and understanding
18:19when things are working and when things
18:20aren't working so much easier. So that's
18:24just using TCP IP and again the various
18:28applications that make use of TCP IP.
18:34In this lesson, we're going to be
18:36talking about the OSI model. What's the
18:38OSI model? Well, you can see here a
18:41diagram of the OSI model, which doesn't
18:44really describe what the OSI model is,
18:47but we'll be referring to this diagram
18:49as we go on, and I'll be flipping back
18:52and forth to this. So, what is the OSI
18:55model? OSI stands for open systems
18:58interconnection and it's a seven layer
19:00model that describes an architecture for
19:04communication. It's a standard
19:06communication architecture and it's
19:09really modular which you would expect
19:11from a layered approach. As I said it's
19:13a seven layer model. It was created in
19:15the 1970s as an architecture for
19:18distributed database systems. So you can
19:21see that there are seven layers here and
19:24this model really originated as part of
19:28work that was being done to create this
19:31standard communication architecture in
19:34the 1970s. They were learning from the
19:37work at ARPA around ARPANET and the
19:40creation of the TCP IP protocol suite
19:44and the birth that was happening in the
19:461970s around that and IBM's system
19:49network architecture or SNA.
19:51Observations from those two activities
19:54really went into the creation of this
19:57OSI model. Now the OSI model is protocol
20:00agnostic. It's not tied to one specific
20:02protocol or set of protocols. As a
20:05result, it's pretty easy to lay
20:08different protocols and different
20:09protocol suites on top of the model or
20:11at least fit them into the model. We'll
20:14be going through some of that as we go
20:16forward here. Let me show you the model
20:18again. We're starting from the bottom.
20:20The physical layer is really all about
20:23the physical definitions, not
20:25surprisingly. So, we're talking about
20:27connection types, coax, four pair,
20:29fiber, etc. The physical layer handles
20:32error correction and detection on the
20:35physical medium. So we've got these
20:37things called collisions. When a message
20:41goes out on the wire and somebody else
20:43sends something at the same time, the
20:45two electrical signals are trying to
20:47cross the wire at the same moment and we
20:50end up with this collision and of course
20:52we end up with basically garbage and the
20:56signal would be completely
20:57unintelligible. The physical layer is
21:00responsible for doing error correction
21:03and detection on the physical medium.
21:06Now the data link layer is responsible
21:09for doing the translation from the
21:11digital data to physical signals. So
21:14it's got to do these frames in order to
21:18make sure that the messages are able to
21:22be sent across the physical medium. So
21:26it frames the messages out in a way that
21:29can be transmitted based on what the
21:31physical medium happens to be whether
21:33it's fiber or whether it's coax or
21:36whether it's four pair wire. It also has
21:39physical addressing. So there's an
21:41address that's associated with the data
21:43link layer and we'll talk about that in
21:46subsequent lessons. But what we're
21:48talking about there is the media access
21:50control address or MAC address. Now, it
21:53also handles flow control and access
21:55control and those collisions that I
21:58mentioned before. It's got to be able to
22:00recover from those. So, it uses this
22:03mechanism sometimes called CSMA CD or
22:07carrier sense multiple access collision
22:09detection. Now, that's what Ethernet
22:11uses. So, it senses that there is a
22:14collision and then does the
22:17retransmission based on a random holdoff
22:20timer. So, if the holdoff timer wasn't
22:23random, you'd get people trying to send
22:26messages, getting a collision, backing
22:29off, and then both people trying to
22:30resend at the same time. And of course,
22:32you're going to end up with a collision
22:33again. So, we have this random back off
22:36timer or holdoff timer before people
22:38retransmit after a collision. Now,
22:41different protocols use different ways
22:44of handling this. For example, Apple
22:46talk uses CSMACA or carrier sense
22:49multiple access collision avoidance. So
22:52rather than detecting collisions, they
22:55have mechanisms in the protocol to
22:57actually avoid collisions. Now the
22:59network layer, and we're up to layer
23:01three here. The network layer is
23:03actually responsible for getting
23:05messages back and forth across different
23:09networks. I've got multiple networks
23:11that I'm connecting to and I need to
23:14make sure that I get my messages from my
23:17local network to another network that I
23:20may be connected to somehow. It handles
23:23getting data from one network to
23:24another. And by that I really mean it
23:27does routing. In addition to routing, it
23:30also does some repackaging of the data
23:33because we may have different physical
23:36connections on the other side and
23:38different layer 2 technologies. So the
23:40layer 3 has to kind of bridge that gap
23:44between those two different types of
23:46technologies. So layer 3 is there to get
23:49messages from one network to another
23:51network. As a result of that, we need
23:53another address for that. So we need a
23:55logical address to ensure that we can
23:58get messages from one network to another
24:01network reliably. So we have a logical
24:04address at the network layer. And in
24:07this case, if we go back to the model
24:09diagram, you'll see IP is actually at
24:12the network layer. So IP and the IP
24:16address actually sits at layer 3 at the
24:19network layer. At layer four, we've got
24:21the transport layer. That's where TCP
24:24and UDP actually sit. And the transport
24:28layer handles end to end reliable data
24:30service. In the case of TCP IP, it
24:33handles ports to differentiate traffic.
24:36UDP and TCP both have this concept of
24:39ports. So in addition to an IP address,
24:41you would communicate to a port and that
24:44handles the differentiation between
24:47applications. So every application is
24:50going to have to have a port that it
24:53needs to communicate either with or on
24:56as it's sending messages. So that's how
24:59we handle different communication
25:02streams across the same wire. We have
25:05these layer 4 protocols that have
25:07different ports. So TCP and UDP both
25:10examples of transport layer protocols.
25:14Now we have a session layer on top of
25:16that. That's layer five that controls
25:18specific dialogues between two systems.
25:21So layer five, not surprisingly, does
25:23session management. This one's a little
25:25bit more abstract than lower layers. And
25:27sometimes there's disagreement over
25:29which protocols actually land here in
25:32session 5 because sometimes there's
25:34actually overlap between functionality.
25:37So typically protocols like SSL and TLS
25:41as well as SSH would land in the session
25:44layer. There's also protocols like net
25:47bios for example that typically gets
25:50dumped into the session layer because it
25:52manages the communication between two
25:54systems and there actually is a session
25:56that gets set up as systems are
25:59exchanging files back and forth. Now we
26:01have the presentation layer. It manages
26:03how data is presented. So XML and JPEG
26:06for example would sit in the
26:08presentation layer. Finally, at layer 7,
26:12let me flip back to the OSI model. And
26:15here we have the seven layers here.
26:18HTTP, FTP, SMTP. These are the
26:21application layer protocols. These are
26:24the things that sit the closest to the
26:27user. They do all management of
26:30connections. They handle error control
26:33if they need to. They handle session
26:35establishment. All of those sorts of
26:38things, those get done at the
26:40application layer. And these are things
26:43like web access, email, file transfers,
26:47all of that stuff has some component
26:49that sits at the application layer. So,
26:53one thing I want to point out here is
26:55it's layer to layer. And this may
26:57perhaps seem like it should go without
26:59saying, but it's important to mention
27:01this. One layer speaks to another layer.
27:03So each layer adds a header which
27:06encapsulates the data that came before
27:08it. And each layer is responsible for
27:10peeling that header off when it gets the
27:12data on the other end. Let's go back to
27:14the model here. And we've got for
27:17example a web request. So that web
27:21request is going to originate in the
27:23application layer. And then it's going
27:24to go down to the presentation layer and
27:27session layer. If there's anything that
27:28needs to be done there, for example, if
27:31there's a TLS connection, maybe you
27:33could say that goes through the session
27:35layer, then eventually we're going to
27:36have to add ports to it. So, I have to
27:39add a source port and a destination
27:41port. And the destination port's
27:43probably going to be port 80. Then I add
27:46the IP address at the network layer, and
27:48I add an Ethernet header probably on top
27:50of it, and I send it off. So it goes
27:52through the network and then when it
27:54gets to the other end we actually repeat
27:57the process in reverse. So it comes in
27:59on the physical layer and the data link
28:02header gets pulled off by the data link
28:05layer on the receiving end. The network
28:08header gets pulled off by the network
28:10layer on the receiving end. The
28:12transport layer gets pulled off by the
28:14transport layer on the receiving end.
28:16It's not really an earthshattering
28:19revelation to suggest that the different
28:22layers handle the same data whether
28:25they're on the sending end or the
28:27receiving end. The point though is that
28:29it's really encapsulated. The data gets
28:31all encapsulated and it's really a
28:33series of headers that get extracted on
28:36the receiving end as the data makes its
28:39way back up the stack. In conclusion,
28:42there are seven layers to the OSI model.
28:45That's the physical data link, network,
28:47transport, session, presentation, and
28:50application. And of course, this is all
28:52layertolayer communication. You would
28:55never have layer 2 on one side
28:57communicating with layer three on
28:58another side. That's just not the way it
29:00works. So, it's layertolayer
29:02communication.
29:05In this lesson, we're going to be going
29:07over the TCP IP model. So, here is the
29:10TCP IP model. Now the TCP IP model looks
29:13kind of stripped down by comparison to
29:15the OSI model and there are reasons for
29:18that and we'll talk a little bit more
29:20about that in a second. So in 1989 RFC
29:241122 was published. RFC 1122 is a
29:28request for comment that specifies an
29:31architectural model for communications
29:33between internet hosts. Now, it's
29:35important to note here that this is some
29:389 years give or take after the adoption
29:41of the OSI model by the ISO. So, we've
29:46got the OSI model in place, but TCPIP
29:49has become the standard protocol across
29:53what was slowly becoming what we now
29:56think of as the internet today. So we've
29:58got this TCP IP networking stack or
30:02networking suite of protocols and in
30:051989 they published this architectural
30:08model. When we talk about OSI we talk
30:11about layer 1, layer 2, layer 3 up to
30:14layer 7. When we're talking about the
30:15TCP IP model, the layers were only
30:18referred to by name. There was no
30:19numbering that was actually referenced.
30:21So the IETF manages the architecture and
30:24documentation and it's been updated
30:26several times since the original
30:28publication with RFC122.
30:32So we've got the network access layer
30:34and if you were kind of thinking about
30:36the OSI model in your head, we're going
30:38to flip back here to the TCP IP model
30:41and we've got the network access layer
30:43at the bottom. And what that really is
30:46is the data link layer and the physical
30:50layer of the OSI model. So it handles
30:52the physical connection. It handles
30:54error correction and control on the
30:56physical medium. It specifies how
30:58messages are translated onto the
31:00physical medium, whether it's electrical
31:02signals or optical and what that looks
31:05like and what the framing is going to
31:06look like. What we've really got here is
31:09the physical layer and the data link
31:11layer from the OSI models really wrapped
31:13up in this network access layer. And the
31:16TCP IP model is a little bit more
31:19compact in that regard. Rather than
31:21separating the two out because they're
31:22so closely tied together, they just
31:24created the network access layer. Now
31:27we've got the internet layer. This is
31:29the same as the network layer in the OSI
31:32model. IP and ICMP were intended for
31:34this layer. This is really where the
31:37robustness principle is really in play
31:39here. You'll hear the robustness
31:41principle referred to from time to time
31:43whether they call it the robustness
31:45principle or not. It says be liberal in
31:47what you accept and conservative in what
31:49you send. And that really came from a
31:52guy by the name of John Pastel who was
31:54really critical in the early days of
31:58getting the arponet and the NSFnet and
32:01the different networks that created the
32:04internet. He was really critical in
32:07helping do a lot of organizational work
32:10and managing the RFC's and doing a lot
32:13of other work around IP addresses and
32:16that sort of thing. So John Pastel
32:19always said be liberal in what you
32:20accept and conservative in what you
32:22send. And that really applies here at
32:24the internet layer. It keeps systems up
32:27and it keeps everybody working together
32:29and talking together. So the internet
32:32layer specifies processing rules and
32:34that helps ensure that datagramgrams end
32:36up where they're supposed to. Although
32:38different datagramgrams may actually
32:40require reassembly at this layer because
32:43they could end up being fragmented. Now
32:45we have a transport layer. same as the
32:47OSI model where we had the transport
32:49layer. TCP and UDP are transport layer
32:52protocols and they handle endtoend
32:54delivery. UDP doesn't actually care
32:56whether datagramgrams arrive or not. As
32:58a result, you'll hear UDP referred to as
33:00an unreliable protocol and TCP handles
33:04connectionoriented communication. By
33:06that I mean TCP guarantees delivery and
33:09it also makes sure that there's somebody
33:11on the other end to receive it. So there
33:14are reasons for having these two
33:16different protocols. Sometimes we just
33:17want to throw messages out onto the wire
33:20and we don't really care whether they
33:21get there or even what sequence they go
33:23in. If you think about doing a phone
33:26call over the internet using Skype as an
33:29example, when I am talking to you, I
33:32want the messages going from me to you
33:34to get there as quickly as possible. If
33:37some messages end up getting lost along
33:40the way, I don't really care so much
33:41because your ear is probably going to
33:43correct for it. And if it doesn't, then
33:46I don't really want it coming out of
33:48sequence because then it's going to
33:50sound like garbage to your ear. I really
33:52just want to send it. What gets there
33:54gets there and it gets played. If it
33:56doesn't get there, I'm not going to
33:57bother trying to resend it. TCP handles
33:59the bulk of communications across the
34:02internet because most of the time like
34:05web communication or file transfers or
34:07things like that. I really do care
34:09whether packets get there and what order
34:11they get there in and I want to make
34:13sure that they get reassembled
34:15correctly. So we've got a couple of
34:17different use cases and both UDP and TCP
34:20have their appropriate places in terms
34:23of network communications.
34:26Finally, we have the application layer.
34:28All application functionality is here.
34:30Session management, presentation, APIs,
34:32these are all at the application layer.
34:35Again, we go back to the model here and
34:38you'll see there are four layers. So the
34:40network access layer actually takes up
34:43the lower two layers of the OSI model.
34:46The application layer takes the top
34:48three layers of the OSI model. It's not
34:51like they took the functionality and
34:53just discarded it with the TCP IP model.
34:56What they said was, "We don't really
34:57feel that this needs to be broken out
34:59into its own individual layer." And as I
35:02mentioned with the OSI model, there's
35:04sometimes confusion about exactly where
35:06different protocols sit, particularly
35:09with the session layer. So in the TCP
35:12model, they just made it a lot more
35:13simple and it's really just four layers.
35:16So we've got the network access layer,
35:18the internet layer, the transport layer,
35:20and the application layer. So TCP IP is
35:24a four layer model. We've got network
35:26access, internet transport, and
35:28application. And that's the basics of
35:31the TCP IP model.
35:35In this lesson, we're going to be
35:36talking about capturing packets. So,
35:38capturing packets is a critical
35:41component to doing any sort of network
35:44troubleshooting or diagnosis. It's a
35:47really critical skill for any network
35:50engineer or frankly security engineer or
35:53pretty much anybody who does any sort of
35:56work on networks. As we go through these
36:00different lessons, we'll be doing a lot
36:01of packet captures and not only packet
36:04captures, but just looking at different
36:08packet captures. So, we're not only
36:09going to be capturing packets. We are
36:11going to be examining captures that have
36:14been done so we can dissect different
36:16protocols and take a look at how they
36:19work and the different requests that are
36:21going on. You can see here I've actually
36:24got a packet capture in process. I'm not
36:27actually storing this one. It's just all
36:29of the different requests that are going
36:31by and it's really just a summary here.
36:34So you can see the different source and
36:38destination addresses and the protocols
36:41that are being used as well as the
36:45different ports that are in use. And
36:47again, we're going to get into what all
36:49of those different words mean and how
36:52they work technically and we're going to
36:55describe all of that in different
36:56lessons. Right now, I just want to talk
36:58quickly about just capturing packets and
37:01the importance of capturing packets and
37:03the different types of packets that
37:05you're going to run across. You can see
37:07here I've got some IP packets. You can
37:10see some ARP packets. You can even see
37:12some IPv6 packets. If you're looking,
37:15you see IP6 in the second column as the
37:20things are scrolling by. Now, what I'm
37:22looking at here primarily is traffic
37:26that is destined specifically to my PC.
37:30So, you can see just scrolled off the
37:32screen. I'm actually going to cancel
37:36this request and I'm going to scroll
37:38back up and I'm going to look for these
37:42words that I really wanted to highlight
37:45here. So, at the top of this terminal
37:47window, you'll see uniccast. So anything
37:50that is directed specifically to me is a
37:54uniccast packet. The reason it's called
37:56uniccast is uni is a prefix meaning one.
38:01So we are sending a packet to one
38:04machine. Therefore we are doing a
38:07uniccast. So you can see a uniccast
38:11packet there. Now if I scroll down a
38:13little bit there were some other
38:16packets. There we go. At the top of the
38:19screen again, you'll see broadcast. Now,
38:22a broadcast packet is actually a packet
38:25that is destined for multiple systems or
38:29frankly every system. Any device on the
38:32network would get a broadcast packet
38:35because I am sending it across a broad
38:38spectrum of hosts. So, a broadcast would
38:42be sent to every device on a particular
38:46network. So that's a broadcast.
38:48There are protocols that use primarily
38:51uniccast packets and there are protocols
38:54that use primarily broadcast packets.
38:58And we're going to be going through
38:59those different protocols. And I did
39:01want to call out right up front the
39:04difference between broadcast and
39:05uniccast. And we'll revisit it as we go
39:08on through these different protocols and
39:11look at different packet captures. and
39:13we'll talk about what the different
39:14addresses look like that would be
39:17uniccast as opposed to broadcast. Now,
39:20what I've got up here in front of me is
39:23a packet capture tool called Wireshark.
39:26And what I was using before is a command
39:29line tool called TCP dump, which is
39:31available on most Unix like operating
39:34systems, and you can also get it for
39:36Windows as well, but it's a utility
39:39that's primarily for Unix like operating
39:42systems. I've got it running here on my
39:43Mac. There are also versions that are
39:46available for Linux and the various BSD
39:49flavors. So, TCP dump is a pretty common
39:54packet capture tool. And what I can do
39:56with TCP dump is I can actually store
39:59the results of a capture and it will get
40:01stored in a format that I can use inside
40:04of Wireshark. Wireshark, as you can see,
40:07is a graphical tool. we can look at the
40:12different protocols in a way that's more
40:15easy to understand. So I can just pop
40:18open a packet capture here
40:22and you can see the same sort of thing.
40:24We've got the packets that are scrolling
40:26by, but they're actually broken out into
40:28columns that are easier to understand.
40:30And you can see on the bottom here where
40:33it actually dissects the packet and
40:34we'll get into how Wireshark works in a
40:38different lesson. The way that this
40:40works, Wireshark or TCP dump, is it puts
40:44a network interface into what's called
40:46promiscuous mode. So promiscuous mode
40:49allows us to see all traffic that
40:53crosses this particular network
40:55interface. And the network interface is
40:58there to block out traffic that's not
41:02specifically destined to us. So, if we
41:05were on a different type of network that
41:08used a device that didn't filter those
41:12things. So, if we were using a hub as
41:14opposed to a switch and all traffic on
41:16the network were being sent to us, the
41:18only thing we would normally see or our
41:20operating system would normally see is
41:23packets that were destined to us that
41:25were uniccast packets or that were
41:27broadcast packets that everybody gets to
41:29see. Now, when we put a network device
41:32into promiscuous mode, everything comes
41:34up. Nothing is filtered any longer. So,
41:37what we're seeing here is all traffic on
41:40the network, whether it's destined for
41:43us or whether it's not destined for us.
41:46So, again, we'll get into more of the
41:49details around Wireshark in other
41:52lessons. And again, this is a tool that
41:54we're going to be using a lot as we go
41:56through the different lessons in this
41:59training video. So that's just an
42:03overview of doing packet capture. And
42:06again, I wanted to highlight the
42:07difference between uniccast and
42:09broadcast. And I also wanted to mention
42:12the promiscuous mode, which is the mode
42:15that we put the interface in in order to
42:17get all of the packets that are coming
42:20across the network interface. and they
42:22get pushed up into the network stack
42:25inside the operating system.
42:29In this lesson, we're going to be
42:30talking about using Wireshark.
42:32Wireshark, as you can see here, is the
42:35world's most popular network protocol
42:37analyzer. Now, it used to be that these
42:39protocol analyzers or packet capture
42:43utilities or network analyzers were
42:46really expensive devices that you had to
42:49buy and it required a lot of setup and
42:53you needed physical hardware. These
42:55days, it's just a piece of software. And
42:58Wireshark's been around for a while now
43:00under a couple of different names. And
43:03Wireshark is the most recent name, but
43:05they've been around for a while. It's a
43:07free piece of software. Runs on just
43:09about any platform that you probably
43:12have an interest in running it under.
43:15Runs under Mac OS as you see here. Runs
43:18under Windows, runs under Unix based
43:21operating systems like Linux. And just
43:25to get started with it, it's a pretty
43:27simple piece of software, but it also
43:29does a lot of really complex things. And
43:32the reason for introducing Wireshark
43:34here is we're going to be spending a lot
43:36of time in Wireshark as we go through
43:39this series of video lessons. Wireshark
43:43is going to give us the ability to look
43:46deeply into the protocols that we're
43:49going to be going over because I think
43:52that getting a protocol level
43:54understanding of what's going on really
43:57helps you understand networking and how
44:01systems interact with one another. It's
44:03also the best way to really see what
44:05happens because in reality the network
44:08can't lie. Applications make mistakes.
44:12applications can generate misleading
44:16error messages or log messages, but when
44:19you're looking at what's on the wire,
44:22the wire can't lie because at that
44:24point, we're just talking about an
44:25electrical signal, talking about bits
44:27and bites that are running across a
44:30physical wire. And so if you're looking
44:33for the best evidence as to what's
44:36actually going on with application
44:39interaction or going on on your network,
44:41you really want to be looking at the
44:43network level and looking at a network
44:47protocol analyzer like Wireshark. So the
44:50first thing that I want to do is I want
44:52to do a packet capture. Now there's a
44:55few different ways to kick off a packet
44:58capture with Wireshark. You can see on
45:01the left hand side here there is a
45:03capture box and there's an interface
45:05list. Now I could choose any of these
45:08interfaces to capture from and depending
45:12on what interface I'm using to connect
45:15to the network that would be the
45:17interface that I would choose. Now I can
45:20also go up here to the toolbar and you
45:24can see I could start a new live
45:26capture. And if I click that, that's
45:28just going to capture from the default
45:31network interface. And so I'm going to
45:34stop that one. I'm going to close it.
45:38I'm going to continue without saving. So
45:41let me show you another way here. I can
45:43just go up to the capture menu item, and
45:46you can see I've got interfaces,
45:48options, start, as well as capture
45:51filters. And if I select interfaces, I
45:54get basically the same thing as I do
45:56with the interface list. The difference
45:58is if I don't really know what interface
46:01that I want to capture from, then what I
46:04might want to do is bring up this
46:06dialogue box because as you can see,
46:08it's actually counting the packets on a
46:11per interface basis. And I can see here
46:13that EN1 is the interface that I'm
46:17actually getting a lot of traffic on.
46:20So, I'm going to select start there, and
46:23I can start capturing packets. You can
46:26see there's a lot of different menus,
46:29and we may get into some of these in a
46:32little bit more detail as we go through
46:35different protocols. Let me just show
46:37you a few different things that are
46:40useful. The first thing that you need to
46:42know about is filter. I've got all of
46:45these packets that are being captured.
46:48So far, I'm up to 78. And there could be
46:53hundreds or thousands of packets that I
46:56have captured, and I want a way to
46:59filter those packets. So, if I just
47:02typed IP, for example, I'm going to be
47:05looking at all of the IP packets. Well,
47:08that's not particularly useful because
47:10IP is a lower layer protocol and pretty
47:13much anything is going to be sitting on
47:16top of IP for the most part. Most of the
47:19things that we capture are going to be
47:21IP packets. So, that's not going to
47:23filter me very much. Now, I could do
47:26TCP, for example, and that's going to
47:29filter me down a little bit more. You
47:31can see that I've got a number of TCP
47:34packets. And in the protocol column,
47:38you'll see TCP, but you'll also see
47:41other protocols as well. And the reason
47:44that they're not all TCP is because
47:47other protocols ride on top of TCP. And
47:51we'll talk about the stack and how the
47:54different protocols layer on top of one
47:56another in another lesson. But you can
47:59see for example TLSV1 there. TLS is an
48:04encryption protocol that happens to ride
48:07over TCP. So I can do TCP. Now I could
48:11also do HTTP which would be web traffic.
48:15So I can see only web traffic. So that's
48:19really useful. Now those are protocols.
48:21What if I want to filter by something
48:25like IP address? So, IP address equals
48:29equals because that's the syntax that we
48:32use. And let's say I want to do
48:34192.168.1.43.
48:38One of the reasons I do that is because
48:40I can see 43 there. I happen to know
48:43it's going to come up. Now, I've got
48:45just packets that are either to or from
48:49that particular address.
48:52I can also do IP.source source or src.
48:57And I could do 192.168.1.43.
49:04And now I'm only going to get the
49:07packets where it's a source address
49:09rather than a destination address. Now
49:13you can see as I'm typing here, the box
49:15is actually changing colors. So this red
49:19background color in the filter box
49:21suggests that I don't have a filter
49:24expression that I can actually use. The
49:27reason for that is I don't have a
49:29complete IP address. And Wireshark knows
49:32that IP. SRC requires a complete IP
49:36address in order to work. So once I get
49:39a complete IP address, now it goes
49:42green. So the green indicates I have a
49:46complete filter that can actually parse.
49:49Of course, whether it's going to
49:50generate any results is a different
49:53problem. Now, whether I've actually
49:56captured any packets that would match
49:59that filter, well, we're not actually
50:01checking that in the filter box. So, I
50:04can do that. It's a parsible expression,
50:07but it doesn't necessarily mean it's
50:09going to yield any results. So, I can
50:12filter based on protocol. I can filter
50:16based on IP address. Let me just clear
50:20that out. I can filter on just about
50:24anything that you can see in the packet
50:27here. And there's a pretty dense
50:30filtering language understanding all of
50:32the different variables that you can
50:34plug in. But I'm just going to cover
50:37some of the basics here that we've
50:39already gone over so that you can see
50:41how you can start narrowing your filter
50:45and what gets displayed so it's easier
50:47to see what's going on. Now, one other
50:50thing that I can do, and I'm actually
50:51going to stop the capture here just to
50:53make it a little bit easier to see
50:55what's happening. So, we're not just
50:57having constant messages flooding
50:59through here. Now what I can do is I
51:03could actually select a packet here and
51:07if I right click on it I get a number of
51:09options. So I could actually apply this
51:13as a filter. So if I do a selected here
51:17now I've actually applied that as a
51:20filter. So what I'm getting is packets
51:23that look like that. So you can see the
51:26filter that actually got applied is
51:28ip.dst DST equals 192.168.1.1.
51:33So that's the filter that got applied
51:35there. Now I could go find another
51:38packet here. And there's another thing I
51:42want to demonstrate that is really going
51:44to be useful. Actually, let me filter
51:46down by TCP again. And I could actually
51:50do this here. Now what I could do is
51:54follow the TCP stream. So that's going
51:57to show me all of the messages related
52:01to that particular TCP stream. And in
52:03this case, what it's done is it's popped
52:06up all of the contents of the stream. So
52:10I can see in this case it's raw mode.
52:13And not really clear what this is,
52:16although it looks like it may be a
52:18calave request since I can see
52:20calendar.google.com
52:22as part of it.
52:25So, let me see if I can actually find an
52:28HTTP which would be a little bit easier
52:31to follow here. And I don't happen to
52:34have an HTTP request.
52:39Let me start a capture again.
52:45I just brought up Google and now I can
52:48go back to Wireshark.
52:50I'm going to stop the capture and I'm
52:52going to filter down to HTTP.
52:57Now I can do follow TCP stream here. And
53:00now you can see the HTTP content in
53:03clear text and readable. So this is what
53:06an HTTP request looks like here. And
53:10there's the get request. And if I scroll
53:12down, I can see the response there as
53:14well. So you can see where that would be
53:17really helpful if you are trying to find
53:21all of the messages in a particular
53:24dialogue between two systems. If it
53:27happens to be a TCP flow, for example,
53:31HTTP, then you could follow TCP stream
53:34and it will show you all of the messages
53:37and you can actually see the filter
53:38TCP.stream
53:40equals 10. it's actually flagged this
53:43particular stream as stream 10. And what
53:45we're looking at is all of the messages
53:48from that particular stream. So that's
53:52some basics around using Wireshark for
53:56capturing and analysis of packets and
53:59the different ways that you can do
54:01filters. As I said, we'll be using
54:04Wireshark quite extensively over the
54:07course of these lessons, and this is
54:10just to get you kind of familiar with
54:12the interface and how it operates.
54:18In this lesson, we're going to be
54:19talking about the Internet Engineering
54:21Task Force or IETF. Now, you may be
54:24wondering why we're talking about an
54:26organization like the IETF. The reason
54:29is the IETF is responsible for
54:32developing the majority of protocols
54:35that we run on the internet. The IETF is
54:39responsible for developing these
54:42protocols and standards in a way that's
54:44open and in a way that is going to
54:48hopefully get the most technical
54:51competence and the best protocols out of
54:54the process of doing this development.
54:58As a result of this process of what the
55:02IATF is responsible for, we end up with
55:05things like RFC's. RFC's are request for
55:09comments. And what a request for
55:11comments really is is a specification of
55:16how something is supposed to work. Let
55:19me just bring up a RFC here. And you can
55:24see that I am bringing up the RFC for
55:28the internet protocol. I've actually got
55:31a list of them here because I was
55:32looking for 791. RFC 791 is the
55:36specification for the internet protocol.
55:40And you can see it was written in
55:41September 1981.
55:44It was prepared for the defense advanced
55:47research projects agency or DARPA and it
55:51was prepared by the information sciences
55:54institute. You can see this one is over
55:5730 years old. But if you look through
56:00here, anything you need to know about a
56:03protocol that runs on the internet, or
56:06most of the protocols anyway that run on
56:08the internet, you can find in an RFC
56:11with the IETF.
56:13If you need to know exactly how an IP
56:16packet looks, then you can look up the
56:19IP RFC.
56:22And you can see that we've got the
56:25header format. This is exactly what an
56:29IP header should look like as defined by
56:32the specification. And this
56:34specification has now become a standard.
56:37But when this RFC was first written or
56:40when RFC's in general are first written,
56:43they go through working groups and
56:46people request comments and people
56:48receive comments or working groups
56:50request and receive comments and the
56:53comments go into making the protocols
56:57and the processes and procedures or
56:59whatever is documented in the RFC, they
57:02go into making those better. So, it's
57:05really a community effort. Now, there
57:07are a number of protocols and they don't
57:10all quite look the same anymore because
57:14we've really changed how we do things.
57:17You can see the IP RFC was requested by
57:22DARPA or the Defense Advanced Research
57:25Projects Agency and it was prepared by a
57:28particular entity in the case of a more
57:32recent RFC. So this one here is the
57:34session initiation protocol which is one
57:37of the core protocols for voice over IP
57:39traffic. You can see what we've got is
57:42the network working group and there's
57:45just a list of people who were
57:48responsible for working on this
57:50particular RFC. And there's the list in
57:54the upper right hand corner of the
57:56document and you can see the date there.
57:58Now, it wasn't actually created for
58:01anybody in particular and it wasn't
58:04prepared by anyone in particular. It
58:07actually came out of a working group and
58:09the IETF manages these working groups.
58:13That's one of their functions. And these
58:15working groups are responsible for not
58:18only creating but maintaining these
58:21RFC's and various standards. You can see
58:24in the upper leftand corner of the
58:27document, it obsoletes 2543.
58:31So I can actually go back here and I can
58:34look up 2543
58:39and there's RFC 2543
58:42and you can see it's actually the
58:45session initiation protocol. So what
58:48they did was they created another
58:51version of SIP and created a whole new
58:55RFC in order to manage that process of
58:59creating this new protocol or the new
59:02version of this protocol. And you can
59:05see the list here in the upper right
59:07hand corner again. And there's a couple
59:09of names that are actually the same as
59:11those who were responsible for creating
59:14SIP version two. Again, that's another
59:17thing that the IETF is responsible for.
59:20They're responsible for maintaining
59:22these standards tracks and also
59:24maintaining whether protocols obsolete
59:27other protocols or whether they've
59:30superseded them or deprecated them. They
59:32are responsible for maintaining the
59:36consistency of all of these protocols so
59:41that when you are looking for the most
59:43recent one, you're not going to get
59:45confused by, oh, I've got a version, but
59:49it doesn't say it's been obsoleted. So,
59:51the IETF is responsible for all of that
59:54and they manage that. So, again, we have
59:573261 saying that it obsoletes 2543.
1:00:01So we've got all of these protocols and
1:00:05they're managed and maintained by the
1:00:07IETF. And you can see over here on the
1:00:10left hand side you can see the working
1:00:11groups. We've got application working
1:00:14groups and you can see the different
1:00:16application working groups. We've got
1:00:18internet working groups and operations
1:00:21and management. We've got a routing
1:00:24working group, a security working group,
1:00:26and a transport working group. So all of
1:00:30these working groups meet on a regular
1:00:32basis. The IETF actually holds
1:00:34conferences on a regular basis and these
1:00:37working groups get together and they
1:00:40define these protocols and standards by
1:00:44working on RFC's and drafting these
1:00:47documents. Anytime you want to know the
1:00:51specifics about how a protocol works,
1:00:53the best place that you can go to is the
1:00:56RFC because we're not talking at that
1:00:59point about somebody's interpretation or
1:01:02how a particular vendor implemented a
1:01:05specification. We are talking about how
1:01:08it was defined by the people who
1:01:11actually created the protocol and
1:01:14created the standard. If you want to
1:01:16know how SIP was designed to work or why
1:01:19SIP was created, you come to the RFC and
1:01:23you can see exactly the details that are
1:01:27in it. Now, one of the things about
1:01:29RFC's is there's often a lot of wiggle
1:01:33room in them in terms of whether
1:01:37different aspects of a protocol may be
1:01:39implemented or should be implemented.
1:01:42So, there's language here. You can see
1:01:44in section three we've got a terminology
1:01:47section and it says in this document the
1:01:50keywords must, must not, required,
1:01:52shall, shall not, should, should not,
1:01:53recommended, not recommended, may and
1:01:55optional are to be interpreted as
1:01:58described in another document which is
1:02:00RFC 2119.
1:02:02The different words of course mean
1:02:05different things. Now something like
1:02:07must is an aspect of the protocol that
1:02:11really has to be there. Whereas
1:02:13something like should or should not is
1:02:16something that may be a little bit gray
1:02:18where one vendor may interpret that as
1:02:21well we really ought to do that and
1:02:23another as yeah it just says we should
1:02:26do that. It doesn't mean that we're
1:02:27going to do that. And that's where you
1:02:29get interoperability challenges. And
1:02:32that's one reason why there are
1:02:35different organizations that are
1:02:37responsible for managing
1:02:39interoperability
1:02:40groups to make sure that different
1:02:43vendors can actually interoperate with
1:02:45one another. And when implementations of
1:02:48protocols hit the marketplace that they
1:02:51actually will work more or less reliably
1:02:54with other vendors products. And it's
1:02:57not one of these situations where you
1:02:59have to have vendor A throughout your
1:03:02entire network in order to just work
1:03:05with, for example, the protocol SIP.
1:03:08There are different vendors that will
1:03:10interpret these specifications a little
1:03:13bit differently than others, and that
1:03:16can lead to some nuances. But if you
1:03:19want to know how a protocol was designed
1:03:22to work and what the people who were
1:03:25responsible for drafting and designing
1:03:27that protocol were thinking about when
1:03:31they put it together or how they
1:03:32documented it at any rate, then you
1:03:35really want to go to the RFC. And the
1:03:37place to look for RFC's is the IETF, of
1:03:42course, because they're responsible for
1:03:44doing all of the creation and
1:03:46maintaining. So that's the internet
1:03:47engineering task force.
1:03:51In this lesson, we're going to be
1:03:52talking about protocols. We're actually
1:03:55going to spend a lot of time over the
1:03:57course of these several lessons about
1:03:59TCP IP really talking about protocols.
1:04:03It would be useful to understand
1:04:05actually what a protocol is. When we're
1:04:08talking about protocols, not even
1:04:10thinking in terms of networking, there
1:04:13are actually protocols that you engage
1:04:15in. Well, probably a pretty regular
1:04:17basis, even a daily basis. Imagine we've
1:04:21got Bob and we've got Fred here and Bob
1:04:24runs into Fred on the street. What's the
1:04:27first thing that Bob's going to do?
1:04:29Well, the first thing that Bob's going
1:04:30to do, he's probably going to say
1:04:31something like hello. And Fred being the
1:04:35friendly sort is going to respond with
1:04:38hello as well. Now, Bob is probably not
1:04:42going to drop it there because that
1:04:44would be kind of awkward. just say
1:04:45hello. Hello. I suppose if they were
1:04:47just passing each other, that might do.
1:04:50But if they ran into each other and were
1:04:52stopped for any period of time, there
1:04:53would be something else along the lines
1:04:55of, "How are you?" And Fred might reply,
1:04:58"I'm fine." This actually is an example
1:05:02of a protocol. And in this case, the
1:05:05protocol that we're talking about is
1:05:07actually just this idea of greeting
1:05:10somebody that you know. Or if you're
1:05:13meeting somebody that you don't know,
1:05:15you may say, "My name is Rick." They
1:05:19might reply, "My name is George." Or
1:05:22whatever. That would also be an example
1:05:25of a protocol.
1:05:27All a protocol is is just a series of
1:05:30rules for communication. So there are
1:05:33guidelines and there are rules for how
1:05:35you would engage somebody else in just a
1:05:38simple act of communication. These are
1:05:41really sets of rules that we've honed
1:05:44over centuries and centuries of human
1:05:47interaction. So we don't really think of
1:05:50them as rules as much anymore. They're
1:05:52just kind of natural ways of behaving.
1:05:55Well, in fact, what they really are are
1:05:57protocols because they're a set of rules
1:05:59that we engage in with one another so
1:06:03that we're all really talking the same
1:06:05language on the same page and making
1:06:08sure that the other person is available
1:06:12for communication as well. So, when Bob
1:06:16and George here actually greet each
1:06:18other, in addition to this hello,
1:06:21there's probably some sort of eye
1:06:23contact. And that eye contact is
1:06:26important to ensure that the other
1:06:28person is actually listening to you and
1:06:32that you know that they're paying
1:06:34attention to what you're saying. There's
1:06:36not only the physical act of
1:06:38communicating and speaking or in sign if
1:06:42that's how you do it if you're using
1:06:43sign language. There are other
1:06:45mechanisms in play as well. So it's not
1:06:49only about what you say, it's often
1:06:51about how you say it. And because of
1:06:54that need for subtlety and inflection
1:06:58and eye contact, again, we've got these
1:07:01rules that we all sort of learn over
1:07:03time. And it's not like there's a book
1:07:05somewhere that says, "Here's a set of
1:07:07rules for how you communicate with
1:07:09somebody." We just kind of learn them
1:07:11over time. They're social norms and ways
1:07:15of behaving with one another so that we
1:07:17can have effective and useful
1:07:19communication. The same thing goes with
1:07:22computers. When they are talking, there
1:07:25needs to be a set of rules. And in this
1:07:27case, they're actually written down.
1:07:29There have to be a set of rules so that
1:07:31both computers can say things in a way
1:07:35that the other end of the conversation
1:07:38can actually understand what's being
1:07:40said and the context in which it's being
1:07:42said so that again, everyone stays on
1:07:45the same page. And that's really the
1:07:48gist of protocols and where we're going
1:07:50to be spending a lot of time
1:07:52understanding what these rules are and
1:07:55how they interact with other sets of
1:07:58rules and how you use those rules to do
1:08:01effective communication between computer
1:08:04systems over networks.
1:08:08In this lesson, we're going to be
1:08:10talking about networking utilities.
1:08:12There are a handful of networking
1:08:14utilities that we'll be using through
1:08:17the course of these lessons, but also
1:08:20that you'll find very useful as you
1:08:23continue making use of TCP IP
1:08:26networking. I'm going to be doing these
1:08:28under a Unix based operating system,
1:08:31which is Mac OS. But you'll find that
1:08:34either these utilities themselves that
1:08:36I'm going to be demonstrating or slight
1:08:38variations on them will actually work
1:08:42under both Linux and Windows. There are
1:08:46typically Windows analoges for the
1:08:48various utilities that we'll be using
1:08:50like ping and trace route and netstat
1:08:52and those sorts of things. In order to
1:08:54get to the place where you can access
1:08:57those utilities, you would need to bring
1:08:59up a command prompt. And you would do
1:09:01that by going to your start menu and
1:09:03then going to all programs, going to
1:09:06accessories, and you'll see a command
1:09:08prompt. if it's not somewhere in the
1:09:11menus ahead of that, it's typically
1:09:13under accessories. So that's where you
1:09:15would find the command prompt. Once you
1:09:17bring up the command prompt, you've
1:09:19actually got a command line where you
1:09:21can run ping, trace route, netstat, the
1:09:24various command line utilities that
1:09:25we'll be using here in this set of
1:09:28lessons. Now, the first one I want to
1:09:30show you is a utility called if config
1:09:34and that's going to show me the
1:09:36interface configuration for my network
1:09:39interfaces. Now, a variation on this
1:09:42particular utility also works under
1:09:44Windows. Instead of if config, it's
1:09:46actually IP config. You'll see more or
1:09:49less the same information. And it will
1:09:51be presented in slightly different ways
1:09:54but basically the two utilities are just
1:09:58ways of looking at the configuration for
1:10:01network interfaces. You can see here the
1:10:05list of network interfaces that I've got
1:10:07on the system and you can see cases
1:10:10where there is actually configuration
1:10:14for IP. Here's V-Nick 0 and it's got an
1:10:19internet address or an IP address and a
1:10:22net mask and a broadcast address and of
1:10:26course a MAC address as well. On top of
1:10:29that, we've also got EN1. In this case,
1:10:32it's the wireless interface on my
1:10:35Macintosh. That's got an IP address of
1:10:39192.168.1.22
1:10:42and of course a net mask here. the net
1:10:45mask or the subnet mask or just the
1:10:47network mask needs to be translated in
1:10:50this case from hexadesimal to decimal.
1:10:53This is just a short-handed way of using
1:10:56what we would typically see as in this
1:10:59case 255.255.255.0.
1:11:04So that's the interface configuration
1:11:07here. I'm going to take a look at
1:11:09another utility called netstat. In this
1:11:12case, I'm actually going to run it from
1:11:13a Linux system and I can show you
1:11:17information about all of the network
1:11:20activity that is going on on my system.
1:11:24So, you can see some connections that
1:11:28we've got going on. And here's actually
1:11:31where we're using domain sockets as
1:11:33opposed to internet connections. So
1:11:35these are basically files that reside on
1:11:39your system and network like
1:11:41communication goes on through these
1:11:44files. These are actually domain sockets
1:11:47and you can see it says without servers.
1:11:50Let's take a look at all of the ports
1:11:53where I've got listening applications.
1:11:56If I do netstat minus L, I can see all
1:12:00of the listeners. You can see that we
1:12:03are bound to everything. Asterisk means
1:12:06everything. So in this case, we're
1:12:08talking about all of the interfaces on
1:12:10the system. On the right hand side of
1:12:12the colon is the port that we are
1:12:15listening on. What this has done is it's
1:12:18actually looked up the common name for
1:12:21the service that typically runs on that
1:12:23port. So I could actually do a minus ln
1:12:28which is going to give me the port
1:12:31number without doing the translation. So
1:12:34I'm actually just going to see the port
1:12:36number if I do netstat minus ln. This is
1:12:39my SQL port. 139 has to do with Windows
1:12:43file sharing. 110 is the pop 3 server
1:12:48port. Port 80 is HTTP and so on. I can
1:12:52show you all of the listening ports on
1:12:56my system. I can also show the name of
1:13:01the program that's actually used for a
1:13:05particular connection. So I'm going to
1:13:08run netstat and we should be able to see
1:13:10the programs that are actually listening
1:13:12on these ports.
1:13:14Let's go back again. Here we've got
1:13:15MySQL. Not surprisingly, this is the
1:13:18MySQL server and we've got the Net Bios
1:13:22port. That would be 139. And you can see
1:13:25over here on the right, that's the Samba
1:13:27server. The POP 3 port is POP A3D.
1:13:32I can see the programs that are actually
1:13:35attached to the different communications
1:13:39that are going on on my system. So I can
1:13:42see everything that's happening from a
1:13:44networking perspective. You can look on
1:13:47the right hand side and you can see the
1:13:50program or the service that's actually
1:13:52making use of that networking
1:13:55communication.
1:13:57Something else that we are going to make
1:13:59use of is something called Netcat.
1:14:02Netcat runs under Linux. It will run on
1:14:05Mac OS. It will also run on Windows. And
1:14:09Netcat actually will open up connections
1:14:12to different systems. We'll make a fair
1:14:14amount of use of this in the coming
1:14:17lessons, but I want to show it to you
1:14:19quickly here. Netcat just opens up a
1:14:22connection and allows me to interface
1:14:25with a particular system on any given
1:14:28port. So, what I'm doing here is I'm
1:14:31running netcat to www.google.com
1:14:34google.com on port 80, which of course
1:14:36is the web port. And I'm just issuing an
1:14:39HTTP request here.
1:14:41And what I get, of course, is all of the
1:14:44HTML and JavaScript that that web server
1:14:48is providing. So if I were a browser,
1:14:51I'd be able to render this and you'd be
1:14:52able to see the page for Google in front
1:14:55of you. But netcat I can use for network
1:14:59troubleshooting if I want to be able to
1:15:02do some manual interaction with systems.
1:15:05Similarly, I can use the tnet client in
1:15:08the same way. If I connect to port 80,
1:15:12I'm really doing a TCP connection to a
1:15:15particular port. As I said, netcat will
1:15:18do a very similar thing. The difference
1:15:20is netcat also supports listening and it
1:15:23also supports UDP mode. So here I can
1:15:27just issue an HTTP request and I'm going
1:15:30to get the same response. Those are some
1:15:33networking utilities that again we're
1:15:35going to make use of in subsequent
1:15:37lessons but also that you'll find
1:15:40interesting or useful as you are doing
1:15:43networking. So we've got if config or IP
1:15:47config on Windows. We've got netstat and
1:15:50we've got netcat and tnet. Those are all
1:15:53pretty useful networking utilities.
1:15:58In this lesson, we're going to be
1:15:59talking about Ethernet. Ethernet is
1:16:02really a layer 2 protocol, although it
1:16:05specifies some layer 1 applications as
1:16:09well. Before I get into some more
1:16:11details about Ethernet, I want to talk a
1:16:13little bit about the history of where it
1:16:15came from. Xerox was actually developed
1:16:18in about 1973 1974 at the PaloAlto
1:16:22Research Center for Xerox. Now Xerox
1:16:26Park and it's called Park because of the
1:16:28PaloAlto Research Center is actually
1:16:31well known for a long history of
1:16:34innovation. Here's actually an article
1:16:37describing how Xerox created the very
1:16:41first computer mouse. And there's a
1:16:44picture here or an illustration of it.
1:16:46The first mouse was actually wood-based.
1:16:49So it was a basically a wooden box that
1:16:52had the electronic components in it.
1:16:55Xerox actually also created the very
1:16:57first graphical user interface. So
1:17:00that's where Ethernet came from.
1:17:02Ethernet came out of a long history of
1:17:05research and development activities at
1:17:07Xerox. Ethernet was created as a way to
1:17:12more easily do local area networks or
1:17:15link computers together. And that was
1:17:17all part of the project where the first
1:17:20graphical user interface was created.
1:17:22They really kind of wanted to create an
1:17:24office where everybody's kind of
1:17:26interacting on computers. And that was
1:17:28sort of Xerox's vision a long time ago
1:17:31back in the early '7s. So that's where
1:17:34Ethernet came from. It's a layer 2
1:17:36protocol. It's actually a family of
1:17:38protocols. When you think of Ethernet,
1:17:41often people think of these cables right
1:17:44here. So you can see this is a Cat 5
1:17:49cable and the Cat 5 component of it is
1:17:53the cabling part. And it's Cat 5 because
1:17:56it's category 5. And there are varying
1:18:00degrees of categories which specify
1:18:03really the gauge of the copper inside
1:18:06the cable itself. There's actually four
1:18:10pairs of thin copper wires or small
1:18:13copper wires which you can kind of see
1:18:16right here. You can see the different
1:18:18colors of the copper wires as they come
1:18:20out into the jack. Now the jack here is
1:18:23an RJ45 jack. And this is pretty common
1:18:26Ethernet cabling today. In reality, when
1:18:30Ethernet was first created, it was
1:18:33created using coaxial cable and it was
1:18:36shared media because coax didn't have
1:18:40any ability to do things like we do
1:18:42today where we do what we call home runs
1:18:45where every computer has its own cable
1:18:47and it goes back to a central networking
1:18:49component called either a hub or a
1:18:51switch depending on what kind of
1:18:53functionality it has. So, we've got all
1:18:55of these cables that are running to this
1:18:58network device, but early on it was
1:19:00really one long coaxial cable, and what
1:19:03you did was you clamped into the coax
1:19:06cable and you ran a connector out from
1:19:10that clamp-on connection. So, we have
1:19:12really shared networking or shared media
1:19:15where everybody's using the same wire to
1:19:18transmit across. And that's less so
1:19:20today, although we still have this
1:19:23concept of shared media. Part of the
1:19:26reason for that is depending on whether
1:19:28you've got a network device that's
1:19:30capable of doing the filtering to make
1:19:33sure that you only get the messages that
1:19:35are destined to you, then what you're
1:19:38really seeing is everything on the
1:19:40network. So you still get this concept
1:19:42of shared media. In the late 1970s,
1:19:46Deck, which is the digital equipment
1:19:48corporation, which was eventually bought
1:19:50by Compact and then Compact was bought
1:19:52by HP. Digital Intel and Xerox really
1:19:56took over Ethernet and started to
1:19:58promote it as a standard. As a result,
1:20:00for a while it was called the Dix
1:20:02Protocol. Now we call it Ethernet and
1:20:05it's really the most common of the layer
1:20:082, layer 1 networking that you're likely
1:20:12to see. As I said early on, it's a
1:20:15family of protocols. And most commonly,
1:20:18you'll see it running across these Cat 5
1:20:21cables or sometimes Cat 6 or Cat 5e
1:20:24cables, but you'll see it running across
1:20:26these cables that look like this with
1:20:28these connectors on them. Ethernet also
1:20:32can run over other media as well,
1:20:35including the air. So Wi-Fi when Wi-Fi
1:20:39was first created used many of the
1:20:42protocol concepts from Ethernet and
1:20:45Ethernet is really implemented in the
1:20:48wireless standards. So the 802.11
1:20:53really use Ethernet as the protocol
1:20:56foundation in terms of how things are
1:20:58framed and how they're put together. And
1:21:00we've got many different types of
1:21:02standards for Ethernet. There's the
1:21:04original 10bas 5 which you see mentioned
1:21:06here used coax cable and then we had 10
1:21:10bas t which uses twisted pair and then
1:21:14we have 100 bas t and then there was
1:21:181000 bas t which is gigabit ethernet.
1:21:21So, we had a lot of different types of
1:21:25Ethernet protocols depending on the
1:21:27speed that you're going at. And if you
1:21:30can't figure it out from the name, 10
1:21:33references the fact that it's 10
1:21:35megabits. 100 is 100 megabits and 1,00
1:21:39is 1,000 megabits, which is of course a
1:21:42gigabit. That's really the essence of
1:21:46the Ethernet protocol. And as I said, it
1:21:49really specifies the data link component
1:21:52as it mentions here. So we get the layer
1:21:542 aspect of it. But of course, there's
1:21:56also specifications for the physical
1:21:59side as well. These cables, for
1:22:01instance, are specified as part of the
1:22:04Ethernet suite of protocols.
1:22:08In this lesson, we're going to be
1:22:10talking about layer 2 addresses. Many
1:22:13layers actually require addresses in
1:22:16order to be able to differentiate one
1:22:20object from another. What we've got here
1:22:22is a number of computer systems or other
1:22:25types of systems like routers or other
1:22:30devices that would sit on the network
1:22:31and need to be able to be accessed. So,
1:22:35we've got all of these objects and they
1:22:38need to be accessed. So, we need an
1:22:40address for them because we need to know
1:22:42how to get to them. Just like when
1:22:44you're getting a letter, you don't just
1:22:46drop a letter out there and expect it's
1:22:48going to get to the right place. You've
1:22:50got to put an address on it if you want
1:22:51it to get to your friend who you're
1:22:53writing the letter to. You've got to put
1:22:55your friend's address on the outside of
1:22:57the envelope. Same sort of thing here.
1:23:00We've got an Ethernet header that you
1:23:02can actually think of as the envelope.
1:23:04And along with that envelope comes an
1:23:07address. You want to be able to make
1:23:10sure that if the letter doesn't get
1:23:13delivered, it comes back to you. So, you
1:23:15need to put your address as well as the
1:23:18address that the letter is going to.
1:23:20Similarly, we have a source and
1:23:21destination address in our layer 2
1:23:25header. What we've got here with
1:23:26Ethernet is actually a MAC address, and
1:23:30MAC stands for media access control. The
1:23:33MAC address, sometimes called the
1:23:35physical address, is actually bound to
1:23:38the network interface card, which is why
1:23:39it's called a physical address because
1:23:41it lives physically on the network
1:23:44interface card. We use this MAC address
1:23:47locally to deliver messages to one
1:23:50another. You may be wondering, well,
1:23:53we've also got IP addresses, so why not
1:23:56just use IP addresses everywhere that we
1:23:59go? The reason that we don't use IP
1:24:01addresses for all of our addressing
1:24:04needs is we need an address that's
1:24:08abstracted from the IP address so that
1:24:10we can use different networking
1:24:12protocols on top of Ethernet. So I've
1:24:15got Ethernet and that's where my MAC
1:24:17address lives is in the layer 2 header.
1:24:20I want to be able to use other
1:24:22networking protocols other than IP. So
1:24:26that's why we need a MAC address that's
1:24:29separate and distinct from the IP
1:24:31address. I need to have the ability to
1:24:36have other networking protocols like
1:24:38IPX, SPX or Apple Talk or DeckNet or
1:24:41some of the other protocols. We need
1:24:43that modularity. There has to be an
1:24:45address at layer 2 so that we can have
1:24:48different addresses at layer 3 and we're
1:24:51not required to just use the IP address.
1:24:55And it really protects the layer three
1:24:57protocol from having to implement all of
1:25:00the layer 2 pieces as well. So we do all
1:25:05of the stuff around the data link
1:25:07connection in the layer 2 which is where
1:25:11the media access control or MAC address
1:25:14lives. What we've got here you can see
1:25:17is a destination and a source address.
1:25:19And the addresses are the same in terms
1:25:22of their structure. You can see the
1:25:24destination in the left hand side says
1:25:28Netgear_CE
1:25:30col0383.
1:25:32Now what we've got in both of these is a
1:25:3548bit address and the first three bytes
1:25:40of the address are related to the
1:25:44vendor. It's actually called an OUI or
1:25:47an organizationally unique identifier.
1:25:50And what wireshark has done very nicely
1:25:53for us is it has looked up that OUI and
1:25:56it has determined that it is owned by
1:26:00the organization Netgear_CE.
1:26:03In the source, you can actually see the
1:26:06source is owned by Apple and it's got a
1:26:09designation of Apple_e2.
1:26:12We've got the Netgear and the Apple
1:26:15devices that are talking to one another.
1:26:18And the second three bytes actually are
1:26:22the nick address. So they are the unique
1:26:26address specific to that network
1:26:28interface card. So we've got three bytes
1:26:31that belong to the vendor. The E0469A
1:26:35that belongs to the vendor in the
1:26:36destination address and the C0383
1:26:41belongs to the network interface card.
1:26:43So that's the network interface cards
1:26:45address itself. and you put the two
1:26:47together and you get the MAC address.
1:26:50There are several different protocols
1:26:52actually that use MAC addresses.
1:26:55Ethernet is one. You can see here we're
1:26:57looking at an Ethernet packet. We can
1:27:00see the MAC address there. Bluetooth
1:27:03also uses MAC addresses. 802.11 WFI.
1:27:08Fiber interfaces like Fitty use MAC
1:27:11addresses and ATM also use MAC
1:27:14addresses. So, lots of different
1:27:16protocols use these same MAC addresses
1:27:19to identify the devices that are
1:27:23communicating back and forth. That's a
1:27:26little bit about MAC addresses and layer
1:27:292 addresses in general, but MAC
1:27:31addresses specifically. And MAC
1:27:33addresses are actually what we're going
1:27:35to see a lot of as we go through these
1:27:39different lessons and we look at
1:27:41different protocols. We're going to be
1:27:42seeing a lot of MAC addresses. We'll
1:27:44talk a little bit more about how MAC
1:27:46addresses are used and how the
1:27:48translation between a layer 2 MAC
1:27:52address and a layer 3 IP address for
1:27:55example happens and how you do lookups
1:27:58based on IP address versus MAC address.
1:28:02That's the layer 2 address and that's
1:28:05why we use layer 2 addresses as opposed
1:28:07to always using layer 3 addresses.
1:28:13In this lesson, we're going to be
1:28:14talking about PPP and some other layer 2
1:28:18protocols or encapsulation protocols
1:28:20similar to it. Now, PPP is the
1:28:22pointto-point protocol. It's actually
1:28:24sort of a successor to a protocol that
1:28:27was called slip, which is serial line
1:28:30IP. Now, these were protocols that were
1:28:33used primarily when we were using things
1:28:36like modems for communication, and we
1:28:39needed protocols that were capable of
1:28:42setting up connections between two
1:28:44devices quickly and easily, and also
1:28:48being able to encapsulate higher layer
1:28:51protocols. Right here, I've got just the
1:28:54Wikipedia article about the
1:28:56point-to-point protocol. Just want to
1:28:58show you the structure of a PPP frame.
1:29:01You can see here in this table that
1:29:04we've got a protocol and that's either
1:29:06one or two bytes and that's the setting
1:29:09of the protocol for the data field. And
1:29:11by protocol we're talking about what's
1:29:14actually in the payload. It's LCP which
1:29:17is the link control protocol or it's IP
1:29:20or IPX or Apple talk something like
1:29:22that. So then we've got the actual
1:29:24datagramgram or the information and
1:29:26there's some optional padding that goes
1:29:28as well. So we can see that there are
1:29:31some different phases for PPP. There's
1:29:34link dead link establishment
1:29:36authentication phase and we've also got
1:29:39some PPP configuration options. And this
1:29:42is where the protocol would actually do
1:29:44the setup of the connection. I'm going
1:29:48to bring open our good friend Wireark
1:29:51here. And I can show you a capture of
1:29:54some PPP frames. So you can see here
1:29:58we've got a configuration request. And
1:30:01we can pop this open here. And it says
1:30:04it's a link control protocol. So we've
1:30:07sent a PPP message out. And it's
1:30:10actually for a link control protocol. So
1:30:12that's the protocol that we're sending
1:30:14here. So we're actually sending a
1:30:17configuration request.
1:30:20You can see that the source and the
1:30:22destination have been altered here. So
1:30:25we've got a DTE and a DCE. And that's
1:30:29just two ends of the connection. In the
1:30:32first case, we've got DTE to DCE and
1:30:35then we've got DCE to DTE. And you can
1:30:38see they go through this negotiation
1:30:41process of doing the configuration
1:30:44request and they'll either acknowledge
1:30:46it or they'll not acknowledge it or
1:30:49knack it. PPP is capable of doing this
1:30:52connection setup. But what we really
1:30:54want is to be able to authenticate both
1:30:58ends so that we know that the right
1:31:00people or the right users are actually
1:31:03making use of this service. So I've got
1:31:06a different capture here and this is PPP
1:31:09with the extensible authentication
1:31:11protocol or E. Now you can also use the
1:31:14challenge handshake authentication
1:31:16protocol or CHAP to go along with PPP to
1:31:20provide the authentication but in this
1:31:23case I happen to have a packet capture
1:31:25here where they use E rather than chap.
1:31:28So we're doing the LCP setup here. Here
1:31:31you can see at the beginning we're doing
1:31:32a configuration request and there's a
1:31:35configuration request going the other
1:31:37direction. Now looks like we've set up
1:31:40the configuration. So we're requesting
1:31:43that we authenticate here. You can see
1:31:47it actually makes reference to RFC 3748
1:31:51here. They all do. There's the identity
1:31:54request and here's an identity response.
1:31:57And there is an identity response. we're
1:32:00sending the challenge. So with this,
1:32:04what happens is rather than sending a
1:32:06password across the wire, the
1:32:09authentication server will send a
1:32:12challenge and then there's some
1:32:14algorithm that you go through in order
1:32:17to create the response to the challenge
1:32:20and both ends know how to create that
1:32:23response based on what the challenge is.
1:32:26So typically what happens is the
1:32:28authentication server will send a value
1:32:31and it's probably some random value. So
1:32:34you can see here there's the value. Let
1:32:37me unhighlight that so it's a little
1:32:39more visible. What would typically
1:32:41happen is you would take that value and
1:32:44you would perform some sort of
1:32:45mathematical operation on it like
1:32:48perform a cryptographic hash or
1:32:50something like that with the password or
1:32:53with the username and password or with
1:32:55other pieces of data that are known to
1:32:58both ends of the conversation. So then
1:33:02what happens is we send the response
1:33:05back and you can see there's the
1:33:07response there. If the response matches
1:33:12what was computed on the end of the
1:33:15authentication server, now we've got a
1:33:17successful authentication. And you can
1:33:20see that's exactly what happens here.
1:33:23We've got a success to the
1:33:25authentication protocol. And now we can
1:33:28really set up the connection between the
1:33:31two ends. PPP is a protocol that ended
1:33:35up superseding this other protocol
1:33:37called slip and they are used for doing
1:33:42automatic configuration of connections
1:33:45across primarily things like serial
1:33:47lines although sometimes you'll see PPP
1:33:50being used in other situations like
1:33:53they've used PPP to help support DSL for
1:33:57example so you'll see PPPOE sometimes
1:34:00which is PPP over Ethernet It's not PPP
1:34:03over a serial line, which is more
1:34:05traditional. They're doing PPP over
1:34:08Ethernet in order to facilitate DSL
1:34:11working. You'll also sometimes see PPP
1:34:14over ATM. And we'll get into ATM in
1:34:18subsequent lessons. And what ATM
1:34:21actually is. PPP is really a way of
1:34:25automatically configuring a connection
1:34:28between two different endpoints. and
1:34:32doing all of the parameters around that
1:34:34configuration and doing authentication
1:34:37if authentication is actually required.
1:34:41In this lesson, we're going to be
1:34:43talking about WAN protocols or wide area
1:34:45network protocols. Now, there are
1:34:47several protocols that are used for wide
1:34:50area networks. And what I'm really
1:34:52talking about when I'm talking about
1:34:54wide area networks is the connections
1:34:57that are used when you're talking about,
1:35:00for example, your internet service
1:35:01provider. Any network provider uses
1:35:05these really large connections or really
1:35:08large pipes in order to transmit
1:35:10information. And there are protocols of
1:35:13course that are used to get that data
1:35:16from one point to another. You may think
1:35:19of the internet as this big sort of
1:35:21amorphous cloud. What it really is is a
1:35:24connection of pipes or tubes. These
1:35:26pipes or tubes of course use protocols
1:35:29in order to get data back and forth. And
1:35:32one of the protocols that is used an
1:35:34awful lot is synchronous optical
1:35:36networking or sonnet. Sonnet is an
1:35:40optical networking protocol of course
1:35:42because it's called synchronous optical
1:35:44networking. It's interesting because
1:35:47rather than the headers and then the
1:35:49payload with sonnet you end up with
1:35:52headers interled with the payload. So
1:35:55you can see here this is a sonnet frame
1:35:59or STM1 frame for synchronous transport
1:36:02module level one and there's an STM1
1:36:06frame and there's some other diagrams
1:36:09here. I'm not going to get into a lot of
1:36:11details about how sonnet works primarily
1:36:14because they don't actually have a
1:36:16packet capture. Not surprisingly, these
1:36:18kind of packet captures are difficult to
1:36:20get your hands on. I don't actually have
1:36:22a packet capture to show you what it
1:36:24really looks like, but I did want to
1:36:26touch on it because it is a really
1:36:28important protocol because it gets used
1:36:29a lot. Now, another one that gets used a
1:36:32lot is ATM. And I'm not talking about an
1:36:35automated teller machine. I'm talking
1:36:36about asynchronous transfer mode.
1:36:38Asynchronous transfer mode or ATM is
1:36:41interesting because it was actually
1:36:44developed in the late 1980s to handle
1:36:49ISDN.
1:36:50ISDN was going to be this great service
1:36:54that the phone company was going to
1:36:56offer. It was going to support
1:36:58highcapacity, great quality voice. So
1:37:02ATM was actually developed to meet the
1:37:04needs of ISDN. And ATM as I mentioned
1:37:08was interesting because rather than
1:37:11variable length packets you end up with
1:37:15fixed length cells. They don't use
1:37:18frames. Now other wide area networking
1:37:21protocols call their data units frames
1:37:24and ATM calls them cells. And one of the
1:37:28things about ATM that's kind of
1:37:30interesting is they're really smallsized
1:37:32cells. So you've got a five byt header
1:37:36and a 48 byt payload. So that gives you
1:37:40a 53 byt cell. And it doesn't matter
1:37:44what size data you've got, it's always
1:37:47going to be a 53 byt cell. So in the
1:37:50case where your data doesn't end up
1:37:53having enough to actually fill something
1:37:56that's a 53 byt cell, let's say you
1:37:59actually had something that was 486
1:38:03bytes, for example, I'd end up having 10
1:38:07cells and then I'd have a little bit of
1:38:10extra data. So I'd have six bytes that
1:38:13didn't fit into the 10 cells that I had
1:38:16already sent. So what ends up happening
1:38:18is they have to pad that cell out. So
1:38:21I've got 53 byt cells with ATM. Another
1:38:25protocol that's perhaps more common
1:38:29particularly with smaller networks is
1:38:32frame relay. And frame relay is actually
1:38:36kind of a cloud. You can see here in
1:38:39this diagram we've got the network
1:38:43provider. Typically, the phone company
1:38:45provides you this frame relay cloud and
1:38:48you connect your equipment to their
1:38:50frame relay switches and then they
1:38:53handle all of the communication about
1:38:56who you're communicating with and who's
1:38:58part of your frame relay network. And
1:39:00there could be lots of different
1:39:02businesses that are using the same
1:39:04equipment here in this frame relay
1:39:07cloud, but the phone company actually
1:39:10handles who gets to see what data. So
1:39:13theoretically, you don't have to worry
1:39:15about anybody else being able to see
1:39:17what it is you're doing and it's private
1:39:20in that sense because they're separating
1:39:22it out within the equipment. So frame
1:39:26relay is another type of wide area
1:39:29networking protocol and they use things
1:39:32like protocol data units and you can see
1:39:35what a protocol data unit here would
1:39:37consist of. So every frame relay
1:39:39protocol data unit would consist of a
1:39:42flag field, an address field, an
1:39:45information field, and a frame check
1:39:47sequence. So this is the bit that would
1:39:51get thrown on by the equipment before it
1:39:54got thrown out to the frame relay
1:39:56network. It would add all of these
1:39:58header bits on before it sent it out.
1:40:01Now frame relay also has the ability to
1:40:04do congestion control. As you see here,
1:40:07all of this stuff is actually handled
1:40:09inside of the network. This is not
1:40:12something again that you would typically
1:40:14ever see because it would be on the
1:40:16other side of the equipment that
1:40:19connects you to the internet or whatever
1:40:22provider you're connecting to for a
1:40:24network provider. So, we've got a number
1:40:27of different wide area network
1:40:29protocols. They are typically used for
1:40:31internet connections, although they're
1:40:33not exclusively used for internet
1:40:35connections. You could actually set up a
1:40:36wide area network between multiple
1:40:39sites. You would just go to your phone
1:40:42company or a network provider and they
1:40:45would drop a line at your place of
1:40:48business and then drop another line at
1:40:50another location. And you would use
1:40:52these protocols like sonnet or ATM or
1:40:55frame relay depending on what your needs
1:40:57were and the type of networking you were
1:41:01doing whether they were doing fiber or
1:41:04whether it was copperbased from the
1:41:06phone company. Sometimes the method of
1:41:09transmission affects the protocol that's
1:41:12being used. Obviously you're not going
1:41:13to run sonnet over copper for example.
1:41:16So that's just a little bit about wide
1:41:18area networking protocols.
1:41:22In this lesson, we're going to be
1:41:23talking about virtual LANs or VLANs.
1:41:26Sometimes they're called VLANs for
1:41:28short. What's a VLAN? Well, a local area
1:41:31network is a set of physical networking
1:41:34devices and cables. The reason we have
1:41:37virtual local area networks is because
1:41:40sometimes you want to set up different
1:41:42physical networks without actually
1:41:44deploying the physical hardware like
1:41:47switches that would allow you to do
1:41:49that. So you want to have some sort of
1:41:51physical isolation between different
1:41:55network segments, but you don't want to
1:41:57have to go purchase expensive switches
1:42:00to be able to do that. So you have one
1:42:03larger switch that you can connect a
1:42:05number of computers into and it allows
1:42:09you to set up different ports in the
1:42:11switch so that different computers can
1:42:14be on different virtual local area
1:42:16networks. So, how do we go about doing
1:42:19this virtual local area networking or
1:42:22VLAN? I've got a packet capture here.
1:42:25And you can see there's a number of
1:42:28packets or frames that have been
1:42:30captured. Right here, we've got the
1:42:33Ethernet header. This is the layer 2
1:42:35header in the packet. So, I've got my
1:42:38Ethernet header here. And here's what
1:42:40you would typically see. you would
1:42:41typically see the destination MAC
1:42:44address, the source MAC address, and
1:42:47then you would have the type, and in
1:42:49this case, I've got an IP packet.
1:42:52Additionally, we've got some other
1:42:55headers in this packet here. So, we've
1:42:57got a VLAN tag, and this VLAN tag right
1:43:01here says VLAN equals 118. Now, 118 is
1:43:05the number of the VLAN. So I can have a
1:43:08wide range of numbers which allow me to
1:43:13give some identification to the
1:43:16different virtual networks that I have.
1:43:19So I could say people in marketing are
1:43:22on VLAN 100, people in human resources
1:43:25are on VLAN 110, people in development
1:43:28are on VLAN 120, and so on. So I've got
1:43:33VLAN 118 here. This is what we call an
1:43:37802.1Q
1:43:39tag. So 802.1Q
1:43:42is the protocol specification for this
1:43:45VLAN tagging that allows the packets to
1:43:48be flagged as being part of a particular
1:43:51VLAN. So you can see here I've got this
1:43:54802.1Q tag and when a switch sees that
1:43:59tag it says oh you belong to this
1:44:01particular network and it knows which
1:44:04ports in the switch fabric are part of
1:44:08that particular virtual LAN and so
1:44:12broadcast messages would only go out to
1:44:14those particular ports. Uniccast
1:44:16messages of course are going to go to
1:44:19the specific port that the system that
1:44:22owns that address is connected to. This
1:44:25802.1Q tagging that we've got gives us
1:44:29the ability for PCs to join these local
1:44:33area networks or in some cases be on
1:44:36multiple networks at the same time
1:44:38depending on what the switch
1:44:40configuration is. But certainly
1:44:42switchto- switch communications have
1:44:45this 802.1Q tag here that gives us the
1:44:49ability to flag particular packets as
1:44:52being part of one VLAN or another VLAN.
1:44:56So again, 802.1Q
1:44:58and virtual LANs or VLANs give us the
1:45:01ability to set up multiple networks
1:45:05which would otherwise be physical
1:45:07networks, but it allows us to create
1:45:09logical networks from the same physical
1:45:12networking infrastructure. And all of
1:45:14the partitioning is done inside the
1:45:16network hardware itself. We don't have
1:45:19to worry about having multiple switches
1:45:22because the switch does all of that
1:45:24isolation and partitioning and make sure
1:45:27that the traffic for particular VLANs
1:45:30stays within the right ports that belong
1:45:34to those particular VLANs and doesn't go
1:45:36outside of them. So, we get that
1:45:38separation and it's all done inside the
1:45:41switches.
1:45:44In this lesson, we're going to be
1:45:45talking about purposes of the network
1:45:48layer. I've got a wire shark capture
1:45:50here, and you should be pretty familiar
1:45:52with looking at wire sharkark captures
1:45:53by this point, and I've flagged one of
1:45:56the packets here in the top. You can see
1:45:59I've got one selected. Now, in the
1:46:02bottom window, you can see all of the
1:46:04different headers or portions of that
1:46:07particular packet. So, I'm going to open
1:46:10up the network layer portion, and we're
1:46:12just going to talk quickly about the
1:46:14purposes of the network layer, and we'll
1:46:15look in more detail at the different
1:46:19portions of this header in a subsequent
1:46:22lesson, but right now, I just want to
1:46:24talk about the different purposes for
1:46:27the network layer. So, you can see here
1:46:30that we've got a source and a
1:46:33destination address. One of the things
1:46:36that the network layer does is it
1:46:38forwards packets from one network to
1:46:41another. So in this case, I've actually
1:46:44got two IP addresses that are on the
1:46:47same network. So we wouldn't actually
1:46:49have to cross a network boundary to get
1:46:53the messages to one another. So these
1:46:55messages are actually going to be
1:46:56transmitted strictly across layer 2.
1:46:59Now, if I had IP addresses that were on
1:47:03separate networks, for example,
1:47:0510.11810.1
1:47:07as my source and let's say my
1:47:09destination is 4.2.2.1,
1:47:12my destination address would be on a
1:47:15separate network. So, the network layer
1:47:17is responsible for forwarding those
1:47:20packets from one network to another
1:47:23network. And as a result, we have to
1:47:26know things like what the default
1:47:27gateway is or the gateway for particular
1:47:31routers that have particular subnets. So
1:47:34all of the routing is done at the
1:47:35network layer as well. Routing and
1:47:38forwarding packets done at the network
1:47:41layer. Of course, addressing is at the
1:47:43network layer. You see we've got IP
1:47:45addresses here. So that's done at the
1:47:47network layer. So I've got my source and
1:47:50my destination addresses here. These are
1:47:53logical addresses as compared to the
1:47:57physical addresses that we've got here
1:47:59in the Ethernet header, which would be
1:48:02the layer 2 header. So right here, I've
1:48:05got a source and a destination address,
1:48:07and that's my MAC address. So that's a
1:48:10physical address, meaning it's actually
1:48:12bound to the physical network device. So
1:48:15I've got physical addresses here. So why
1:48:18not just use the MAC addresses then to
1:48:21get messages from one device to another?
1:48:24Well, the reason for that, even though
1:48:26MAC addresses are globally unique,
1:48:29meaning no two network interface cards
1:48:31could ever have the same MAC address,
1:48:34MAC addresses are all going to look
1:48:36completely different depending on who
1:48:38the vendor is. And so we have no way to
1:48:42actually aggregate those addresses. So
1:48:45when we put a network together, I really
1:48:48want to have addresses that have
1:48:51something in common. So for example,
1:48:53right here, I've got 10.11810.1
1:48:57and then 10.11810.2.
1:49:00And you can see the first three segments
1:49:03of the address there are the same
1:49:05between the source and the destination.
1:49:07That means they're on the same network.
1:49:10And as a result, I can get messages to
1:49:13them pretty quickly because I can figure
1:49:16out through routing tables how to
1:49:18actually get messages to a device that's
1:49:21close to them. If I were to use MAC
1:49:23addresses, you can see these here are
1:49:26pretty different. So, I've got 0013
1:49:30and 001b.
1:49:32I don't really have a good way of
1:49:34getting messages to these two devices,
1:49:38even though they're on the same network.
1:49:40I don't have a good way of getting
1:49:42messages from the other side of the
1:49:45world, for example, to these two
1:49:47different devices because you'd have to
1:49:49have a table that included all of these
1:49:52MAC addresses here. That would pretty
1:49:55quickly get unwieldy. As a result, we
1:49:57have these logical addresses that are
1:50:00bound to the physical addresses. And
1:50:03these logical addresses here in the IP
1:50:06header provide us an ability to
1:50:08aggregate them so that we can more
1:50:11easily collect devices together into
1:50:14networks. And then we can have routing
1:50:17tables that can be aggregated and we can
1:50:21more efficiently get messages from one
1:50:24side of the globe to another side of the
1:50:26globe without having to worry about
1:50:29enormous tables to look up information
1:50:32in and figure out how to get messages
1:50:34from one side to the other. So we have
1:50:36logical addressing done here at the
1:50:39network layer as well. So we have the
1:50:42logical location which is the first part
1:50:45the 10.118.10
1:50:47in this case and then of course we have
1:50:48the host identification. So the.1 or the
1:50:52two would be the host identification in
1:50:55this part. So the network layer is
1:50:57responsible as I said for forwarding
1:50:59packets. We also have addressing. It
1:51:02does logical location and of course
1:51:04routing because that's where the address
1:51:06lives. routing is done at the network
1:51:10layer as well. So that's the purpose of
1:51:13the network layer.
1:51:17In this lesson, we're going to take a
1:51:19look at IP headers. IP headers are
1:51:21really important because they tell us a
1:51:24lot of information about what's going on
1:51:26with the datagramgram that's on the
1:51:28network, where it's going and how it's
1:51:31going to get there, and a lot of other
1:51:34information. So, let's just take a quick
1:51:36look through the IP headers and see what
1:51:39we can find. So, I've got a Wire Shark
1:51:42capture here. And this capture just has
1:51:45a number of, in this case, they're ICMP
1:51:48messages, which are of course IP
1:51:50packets. So, I've got the IP portion of
1:51:55the packet open here. And I could close
1:51:58it up. And you could see that I've got
1:52:01my layer 2 header. And then I've got my
1:52:03layer three header. And then here's the
1:52:06payload which is MP. So I'm going to
1:52:10open up the IP header portion. Just
1:52:14scroll down here so you can see the
1:52:15entire thing. One thing about Wireshark,
1:52:18I just want to point out here when you
1:52:20select different portions, it actually
1:52:22shows you in the lower part where in the
1:52:26raw message that particular section is
1:52:29located. You see when I've selected
1:52:32version, it actually has highlighted one
1:52:35bite out of the raw data down at the
1:52:39bottom where it's pulled that version
1:52:42from. You can see also that in addition
1:52:45to the version, I get the header length.
1:52:48Those two things are combined in that
1:52:50one bite. And in this case, you can see
1:52:52the header length is 20 bytes. That
1:52:55tells me that this entire header here,
1:52:58the entire IP header is 20 bytes. So
1:53:01I've got 20 bytes that has my IP header
1:53:04in it. So that's the header length.
1:53:07Moving down, the next portion is the
1:53:10differentiated services field or diff
1:53:12serve and that's sometimes used for type
1:53:16of service or toos. Typically what this
1:53:19is really used for is quality of
1:53:21service. So I can differentiate my types
1:53:25of traffic so that more important
1:53:28traffic gets a higher priority. And what
1:53:30this really is is all about
1:53:32prioritization
1:53:33so that you can make sure that the
1:53:35things that are really reliant on being
1:53:39there on time. So voice and video are
1:53:42good examples of this. and gaming
1:53:44traffic sometimes, although most network
1:53:47providers probably won't prioritize
1:53:49gaming traffic, but certainly voice and
1:53:51video will get prioritized because
1:53:53they're really sensitive in terms of the
1:53:56time it takes for a message to get from
1:53:59one endpoint to another endpoint. So we
1:54:02would use this differentiated services
1:54:04field or diffserve field to flag them as
1:54:08either voice or video so that our
1:54:10provider can prioritize that traffic and
1:54:13make sure that it gets to the other end
1:54:15faster. Now I've got the total length
1:54:18and that's the total length of the
1:54:21packet here that includes the headers as
1:54:25well as the data. You can see that's 100
1:54:27bytes. I've got my IP identification
1:54:31field here or IP ID and that identifies
1:54:35fragments of datagramgrams. So if I have
1:54:38to split a message up and I'm going to
1:54:42create fragments, I need to be able to
1:54:45put those fragments back together. The
1:54:47IP ID will actually help me do that. So
1:54:50I've got an identification header here
1:54:53as well. Now I've got a few flags and we
1:54:56were just talking about fragmentation.
1:54:58So different networks actually have
1:55:01maximum transmission units. So for
1:55:03example, Ethernet typically the maximum
1:55:06transmission unit meaning the largest
1:55:08size chunk of data that it can take
1:55:12across the physical medium is 1500
1:55:14bytes. That's pretty typical for
1:55:16Ethernet. You get 1500 bytes to send in
1:55:20any particular packet. So if you've got
1:55:24data that is more than 1500 bytes, then
1:55:27you're actually going to have to
1:55:29fragment the data up into multiple
1:55:31packets. So I've got a more fragments
1:55:34bit here to indicate that I've actually
1:55:36got more fragments or more portions of
1:55:39the data that are going to come. I've
1:55:42also got a don't fragment bit. What that
1:55:44says is don't actually chunk this up.
1:55:48Sometimes that will cause messages to be
1:55:51dropped because if you say you can't
1:55:53fragment it and we hit a portion of the
1:55:56network where the maximum transmission
1:55:58unit or the MTU is actually smaller than
1:56:02the amount of data that you've got and
1:56:04it needs to be fragmented, but you've
1:56:06got the don't fragment bit set, then the
1:56:08message is probably just going to get
1:56:10dropped. Then I've got my fragment
1:56:12offset tells me where in the stream of
1:56:16data this particular fragment is going
1:56:18to be. I've got a time to live header.
1:56:22Now in the protocol specification, it
1:56:24actually specifies that the time to live
1:56:27is in seconds, but in practice, this is
1:56:30really a hop count field. The number of
1:56:33network devices you go through are
1:56:35called hops. So every time I go past a
1:56:39network boundary which is handled by a
1:56:41router then I've gone a hop. As I said
1:56:44in practice we actually keep track of
1:56:47hop counts. So we keep track of the
1:56:48number of routers that we go through and
1:56:50that's our hop count. This time to live
1:56:53in this case 255.
1:56:56It would be unusual for you to go
1:56:58through 255 routers to get from one
1:57:02place to another. But let's say you had
1:57:05your TTL set to 10, for example. Once
1:57:08you hit a device past that 10, then the
1:57:13packet's just going to get discarded
1:57:15because you've exceeded your time to
1:57:17live. And actually, what would happen is
1:57:19we'd send a message back as an error
1:57:22back to the sending host saying packet
1:57:25expired in transit or message expired in
1:57:27transit. So for every router that this
1:57:30passes through, this time to live field
1:57:32here would get decremented. So we'd
1:57:35subtract one from it. And once we hit
1:57:37zero, now we've expired in transit and
1:57:39we've got to do something which would
1:57:41probably mean that we're going to
1:57:42generate an error. Now I get the
1:57:45protocol field here. And the protocol
1:57:48just says which IP protocol is going to
1:57:51be transmitted as the payload or the
1:57:55data that's part of this IP message or
1:57:58this IP packet. I've got ICMP here in
1:58:02this case and you can see it's actually
1:58:05protocol one and if I look down at the
1:58:08bottom here you can see it's 01 and that
1:58:11actually is where we get the one from.
1:58:13So there's a whole bite that's used for
1:58:15this protocol field here. Now I've also
1:58:19got the header check sum and it says
1:58:23929B.
1:58:25So that's two bytes that are used for
1:58:27the header check sum. And you can see
1:58:30here the two bytes that get used for
1:58:34that header check sum are right here. So
1:58:36929B
1:58:38and the header check sum is just there
1:58:41to make sure that the data hasn't been
1:58:44altered in some way. So we want to make
1:58:47sure that the data that was sent matches
1:58:50the data that was received. So both ends
1:58:52would perform a check sum. It's just a
1:58:54mathematical computation. And assuming
1:58:57the check sums match, we can make sure
1:58:59that the data that was sent is more than
1:59:02likely the data that was received. So
1:59:05that's what the check sum is there for.
1:59:06And this is really just the check sum on
1:59:08the header. It's not actually the
1:59:10checksum on the data. So we know the
1:59:12header hasn't been altered in some way
1:59:14through some sort of man-in-the-middle
1:59:16attack or something like that. Then I've
1:59:19got the source IP address. And you can
1:59:22see down here there are the four octets
1:59:24that are the source IP address. And I'm
1:59:28going to click on the destination. And
1:59:30I've got the four octets here that are
1:59:32the destination IP address. And by
1:59:35octet, I mean a collection of eight
1:59:37bits. Each section of an IP address is
1:59:41actually eight bits. And we'll talk
1:59:42about addressing in a different lesson.
1:59:45But just so you know, each of these
1:59:47between the dots is represented by 8
1:59:50bits, which means we can have values
1:59:53from 0 to 255.
1:59:56I've got one bite, two bytes, three
1:59:58bytes, and four bytes there. Those are
2:00:01my four octets. Same thing here. One
2:00:04bite, two bytes, three bytes, and four
2:00:07bytes. And then down at the bottom where
2:00:10it's highlighted in the raw message, you
2:00:12can see the four bytes there as well. So
2:00:15that's really the IP headers in a
2:00:18nutshell and what the different sections
2:00:20mean and the different pieces of data
2:00:24that you can find in the different
2:00:26headers and how they're all used. So
2:00:29that's the IP header in a nutshell.
2:00:33In this lesson, we're going to be
2:00:34talking about IP addresses. So an IP
2:00:38address is a logical address that
2:00:41belongs to the internet protocol or IP.
2:00:44Now IP is a layer three protocol and
2:00:47that's layer three in the OSI model as
2:00:50opposed to the TCP IP model. So I've got
2:00:53a layer three protocol here and I've got
2:00:56a logical address and you can see I've
2:00:58got a wire sharkark capture and here are
2:01:01a couple of IP addresses. So in this
2:01:03case I've got 10.11810.1
2:01:08and 10.11810.2
2:01:10two. And you can see they're denoted by
2:01:15four numbers that are separated by
2:01:17decimal points or dots.
2:01:20Let's just talk about what that means
2:01:22here. So each of these sections here is
2:01:24called an octet. Why is it called an
2:01:27octet? The reason it's called an octet
2:01:30is because it's actually represented by
2:01:34eight bytes. And let's take a look at
2:01:37what 10 would look like. Now, before I
2:01:39take a look at what 10 would look like,
2:01:41let me tell you what each digit here
2:01:43represents.
2:01:45This first digit here on the far left is
2:01:49actually going to be 2 to the 7th power.
2:01:52And that actually equals 128. The next
2:01:56one is 2 to the 6th power. That actually
2:01:59equals 64. Then I've got 2 to the 5th
2:02:04power is 32.
2:02:072 to the 4th power is 16.
2:02:112 to the 3 power is 8. 2 to the 2 power
2:02:16is 4. 2 to the first power is 2.
2:02:22And 2 to the 0 power equals 1.
2:02:28Let's take a look at what 10 would look
2:02:30like. I'm going to write it from left to
2:02:32right here, which is how you would
2:02:34normally write a number anyway. is just
2:02:36you have to keep track of which digit
2:02:39you're actually representing. So I'm
2:02:42actually looking for 2 to the3 which is
2:02:45the fifth digit from the left. So 1 2 3
2:02:504 and then I've got a one for my 2 to
2:02:53the 3. I've got a zero in my two to the
2:02:56second's place and then a one in my two
2:02:58to the first place and then a zero in my
2:03:01two to the zero place. So that's what 10
2:03:05would actually look like represented. So
2:03:08I've actually got four of these octets
2:03:10here. You can see I've got 10.11810.1.
2:03:16That's actually how an IP address is
2:03:19created is using these 8 bit digits or
2:03:24eight bytes. And each of these sections
2:03:27of the IP address is represented by this
2:03:29one bite which is eight bits. So now
2:03:33I've got an 8 bit digit or a bite or
2:03:37sometimes it's called an octet. And the
2:03:39reason it's called an octet is because
2:03:40it's eight bits. With this bite I can
2:03:43represent values from 0 to 255.
2:03:48So if you were to ever see an IP address
2:03:51that looked like this for example, this
2:03:54would not be an IP address because the
2:03:56maximum value you can have in any one of
2:03:58these places is 255.
2:04:02Now the other portion of an IP address,
2:04:05the part that actually allows us to
2:04:07figure out which part of the IP address
2:04:09is the network and which part is the
2:04:11host is something called a subnet mask.
2:04:14Now, typically when you see a subnet
2:04:16mask, it's going to look an awful lot
2:04:18like this. Now, how to figure out which
2:04:21part is the network and which part is
2:04:24the host? Well, you remember in a
2:04:27previous lesson I mentioned that we had
2:04:30logical addresses and the logical
2:04:32address allowed us to have a logical
2:04:35network and then a host address. when
2:04:39we're talking about a network mask that
2:04:41looks like this. This part of the
2:04:44address is the network portion. So
2:04:47that's my network identifier here is
2:04:5010.11810.
2:04:52Now that leaves this last one here. So
2:04:55the entire octet here is going to be the
2:04:58host. There's some binary arithmetic or
2:05:01logic that takes place to figure out how
2:05:05you're going to determine which is the
2:05:07network and which is the host. But just
2:05:09keep in mind that you need the subnet as
2:05:12well as the IP address to figure out
2:05:15which part of an IP address is the
2:05:17network identifier and which part is
2:05:20going to be the host. But commonly
2:05:22you'll see this as your net mask and
2:05:26that means that this is your network
2:05:29identifier and that leaves this one here
2:05:32as your host identifier. So you can have
2:05:35anything from 0 to 255
2:05:38as your host address in that one octap.
2:05:43Now, not to confuse things any further,
2:05:45but there's actually two other pieces of
2:05:48an IP address that you should know about
2:05:51when we're talking about a range of
2:05:53addresses. You actually have a network
2:05:56address and that's the address of the
2:05:59network itself. And then we have a
2:06:01broadcast address. So, what do we use a
2:06:04broadcast address for? Well, a broadcast
2:06:06address is where you would send messages
2:06:08that you want to go to everybody on that
2:06:10particular network. So the low end of
2:06:13any particular network is the network
2:06:16address. So in the case of the example
2:06:19that we were using above, this would be
2:06:21the network address 10.118.10.0.
2:06:25And the broadcast address, not
2:06:27surprisingly, is the very top end. So
2:06:2910.11810.
2:06:32Remember 255 is the maximum value we can
2:06:35have from that 8 bits of information or
2:06:38the bite or octet. 10.11810.255
2:06:43is actually the broadcast address for
2:06:46this particular network. So I can't use
2:06:49those for any host on my network. So
2:06:53actually instead of 256 addresses, I
2:06:56really only have 254 addresses to use
2:07:00because I need a network address and I
2:07:02need a broadcast address. That's just
2:07:03the way IP works. There's no way of
2:07:05getting around that. You can't actually
2:07:08give a network or a broadcast address to
2:07:11any host because if it doesn't provide
2:07:14you with an error, if it's not doing any
2:07:16sort of error checking when you set the
2:07:18IP address, then it's just not going to
2:07:20work because that's not the way the IP
2:07:23protocol works. You actually have to
2:07:25have that network address and you have
2:07:27to have that broadcast address. So, you
2:07:29have to leave those alone and that
2:07:31leaves you 254 addresses for your hosts
2:07:34on this particular network here. So
2:07:37that's IP addresses and there's a lot of
2:07:39complicated binary stuff when you start
2:07:42talking about subnets, but the basics
2:07:45are you've got four bytes that are used
2:07:48for an IP address. And the subnet mask
2:07:52is how you determine which part is the
2:07:54network part and which part is the host
2:07:57part. But that's a little bit about IP
2:08:00addresses.
2:08:18In this lesson, we're going to be
2:08:19talking about routing. Routing is
2:08:21something that exists at layer 3 in the
2:08:24OSI model, and that's the network layer.
2:08:28What routing does is it gets us packets
2:08:31from one network to another network.
2:08:34Now, what do I mean by one network to
2:08:36another network? Well, let me show you a
2:08:40network configuration. So, I've got the
2:08:42network configuration here on my local
2:08:46system, and you can see here that my
2:08:49internet address is 192.168.1.22.
2:08:54So, that's my IP address. You'll also
2:08:57see here right next to that is the
2:08:59network mask which is in hexadimal fff00
2:09:05which translates to 255.255.255.0
2:09:11in decimal. What that tells me is the
2:09:15first three octets here. So this octet
2:09:18and this octet and this octet those all
2:09:22belong to the network. This is all zeros
2:09:25in this fourth octet which means this is
2:09:28the host. So the network mask or the
2:09:31subnet mask as it's sometimes called
2:09:33tells you which portion of the IP
2:09:36address is the network and which is the
2:09:39host. So why is that important? Well,
2:09:42that's important because that tells me
2:09:46what IP addresses are actually on my
2:09:48network and what IP addresses are on a
2:09:51different network. So any IP address
2:09:54that I am trying to send to that exists
2:09:57on a different network than my network,
2:10:01well I need to send that somewhere where
2:10:03I'm going to send that. And I'm looking
2:10:05at my routing table here and you can see
2:10:07there's a lot of entries because I'm
2:10:10actually connected to a handful of
2:10:12networks because I've got multiple
2:10:14interfaces in this particular system. So
2:10:17if I look at my routing table, you can
2:10:19see the default route, which means
2:10:22anything I don't have a specific route
2:10:24entry for, the default route is
2:10:28192.168.1.1.
2:10:31So if I were trying to send to anything
2:10:34on the 10.37.129.0
2:10:38network, then I would send that out link
2:10:41number nine, which happens to be network
2:10:43interface V-nick one. And that has to do
2:10:47with a virtual machine setup that I have
2:10:49on my system. So that virtual interface
2:10:53knows about 10.37.129.
2:10:56So if I had packets that were destined
2:10:58for that network, I would send that out
2:11:01the V-Nick one interface. So that would
2:11:03be routed out that interface. Now, same
2:11:07thing with anything that didn't exist on
2:11:10any of the networks that I knew about
2:11:13would go out the default gateway. The
2:11:15default gateway here again is
2:11:18192.168.1.1.
2:11:20And if I look over in the network
2:11:23interface column, which says netif at
2:11:25the top, then that's my Ethernet network
2:11:29one. And that's the network interface
2:11:32that I am going to send all of my
2:11:34packets that I don't have a specific
2:11:36route entry for. So again, you can see
2:11:39here a lot of different route entries
2:11:42for all of the different networks that I
2:11:44know about specifically. Now, there are
2:11:47a lot of different networks that I don't
2:11:49know anything about. And again, that's
2:11:51where I would use my default router or
2:11:54my default gateway. Anything that I
2:11:56don't know about specifically, I just
2:11:59hand it off to my default gateway. And
2:12:01my default gateway is expected to know,
2:12:04if not specifically where to get the
2:12:07message to, at least where to send it to
2:12:09to get it a little bit closer. And
2:12:11that's really how routing works. I don't
2:12:13know how to get a packet to its final
2:12:16destination, but I know somebody who
2:12:18knows better than I would. So, I'm going
2:12:20to send my packet to that system and off
2:12:24my system because it's going to get me a
2:12:26little bit closer to getting the packet
2:12:28to where it's supposed to go. So, in my
2:12:31case, I would hand it off to 192.168.1.1
2:12:35right here as my default gateway. Now,
2:12:38that probably doesn't know how to get to
2:12:41most places, so it's going to hand it
2:12:44off to somebody else. So you're going to
2:12:46see a lot of different systems that we
2:12:49go through when we go from one place to
2:12:52another. And you can see the route that
2:12:54a packet would take if we just use the
2:12:56trace route command. So you see the very
2:12:59first hop that we're going to use is
2:13:02192.168.1.1.
2:13:05And then we're going to hop out to a
2:13:08couple of other routers on the fairoint
2:13:11network. And we're just going to keep
2:13:12hopping through fairoint until
2:13:15eventually it gets handed off in this
2:13:17case to above.net.
2:13:19And above is going to take it for a
2:13:22little while and eventually we're going
2:13:23to hop through several different routers
2:13:27until we get to this system that's
2:13:304.2.2.1.
2:13:32So this right here is showing the path
2:13:35that a packet would take through the
2:13:37internet. So it's showing basically the
2:13:40route that this particular packet or set
2:13:43of packets is taking to get to a
2:13:46particular destination. And finally,
2:13:48we're here at 4.2.2.1.
2:13:51So you can see right here is a route to
2:13:54get from point A to point B. And all of
2:13:57these routers along the way, so like
2:14:01this one here and the one at three and
2:14:04four and five and six and so on, all of
2:14:06those have routing tables that tell that
2:14:10router how to get a packet a little bit
2:14:12closer to its destination. Again, it
2:14:14doesn't know specifically how to get
2:14:16there, but it knows how to get it a
2:14:18little bit further on. And so that's how
2:14:20the packet goes through the network
2:14:22using routing.
2:14:26In this lesson, we're going to be
2:14:27talking about BGP or the border gateway
2:14:30protocol. Now, BGP is the primary
2:14:33routing protocol that's used in the core
2:14:36of the internet. So, all of the big
2:14:38service providers that have large
2:14:40backbones and exchange traffic back and
2:14:43forth to get packets from your web
2:14:46browser to the server that you're trying
2:14:48to connect to. All of those service
2:14:50providers are running this protocol
2:14:52that's called BGP. Now BGP is a distance
2:14:56vector routing protocol. What that means
2:14:58is that there's information shared
2:15:01between the routers about the path that
2:15:04they know about to get to a particular
2:15:07destination as well as how far away it
2:15:10is. Routers can make determinations
2:15:13based on metrics like how far away
2:15:16something is and how quickly they think
2:15:18they can get a packet there. So there's
2:15:21a number of rules that get used inside
2:15:23the routers to determine how best to get
2:15:27a packet a little bit further along the
2:15:29way to its final destination.
2:15:32I've got here a packet capture of a
2:15:35portion of a BGP session. Now you can
2:15:38see here that we're setting up the BGP
2:15:41session in packet number five. What
2:15:44we're doing is we are sending TCP
2:15:47messages to the BGP port which is port
2:15:50179. You can see here we are doing a
2:15:54synchronize message to port 179. And BGP
2:15:59is kind of unusual in that it uses TCP
2:16:02messages to transfer data between
2:16:05neighboring routers. The routers
2:16:07actually have to be configured to have
2:16:10neighbors. So you would configure a
2:16:13router that was connected to you to be a
2:16:16neighbor and someone that you would
2:16:18trust to share routing information with.
2:16:21So we're setting up the connection here.
2:16:23So you can see the SIN message go out.
2:16:25And then we've got the SIN act and
2:16:27finally the act. That's the three-way
2:16:29handshake that is used to set up the TCP
2:16:32connection. There's one advantage to
2:16:34using TCP here. Yes, sometimes it can be
2:16:37a little bit slower in part because we
2:16:40have to set up this three-way handshake
2:16:42and set up the connection. But the nice
2:16:44thing about it is that once that
2:16:46connection is set up, I can pretty well
2:16:48trust that the messages that are going
2:16:51back and forth are actually originating
2:16:53from the device I believe that they are
2:16:55originating from or the device that says
2:16:58the message is originating from UDP.
2:17:01It's much harder to do that because
2:17:03there's not that connection. There's
2:17:05nothing like the fields in TCP like the
2:17:09sequence number and the acknowledgement
2:17:11number that give you some verification
2:17:14that that's who is really sending the
2:17:17message. So BGP is a little bit more
2:17:19secure than some of the other routing
2:17:21protocols. You can see here we get an
2:17:23open message. If I scroll down here to
2:17:27the BGP portion of this, you can see the
2:17:30open message.
2:17:32You can see the autonomous system number
2:17:35and that's something that's used in BGP
2:17:38to define the different network areas.
2:17:42Each network area would get an
2:17:44autonomous system number or AS number
2:17:47and that AS number defines the routing
2:17:51area that exists within that particular
2:17:54network. So there's a number of IP
2:17:56addresses and IP blocks that that
2:17:59particular network area knows about. And
2:18:01so those are the pieces of information
2:18:04that's going to share with its
2:18:05neighbors. We've got the AS number and
2:18:09you can see the BGP identifier in this
2:18:11case is an IP address. Here we've got
2:18:14open messages going back and forth. So
2:18:17we send an open message from.15 to33
2:18:21and then 33 to15 sends an open message
2:18:25back. BGP actually uses keepives to make
2:18:29sure that the connection between the two
2:18:31routers stays open. So you can see these
2:18:34keep alive going back and forth. Now
2:18:37down here I'm actually seeing an update
2:18:40message. So an update message would
2:18:42include information about a particular
2:18:46network and how far away that network
2:18:49would be and the information about it.
2:18:52So here we've got the network 10.0.0.
2:18:560.0/8.
2:18:58And it looks like the next hop is going
2:19:00to be 333, which you can see here in the
2:19:03source is where this message originates
2:19:06from. And you can see here that we've
2:19:10got a local preference of 100. So that
2:19:13would be the weight that's being used.
2:19:15And we've got some communities. And
2:19:18there's no autonomous system path in
2:19:21this case. But here's a message telling
2:19:25this.15 router about a network that 333
2:19:30knows about. So we've got some
2:19:32information about this 10 network.
2:19:3515 is actually going to update its
2:19:37routing table based on this information.
2:19:40So if it gets a message for 10.0.0.0
2:19:44zero or anything in that address range,
2:19:47then it's going to consult its routing
2:19:49table based on this update and maybe
2:19:52send the message to 333 if that's the
2:19:55fastest way to go. So BGP, as I said, is
2:19:59the core routing protocol on the
2:20:01internet, and it's one that you would
2:20:04see a lot if you were working at a
2:20:06service provider, but definitely not one
2:20:08that you would see a lot if you were
2:20:10working at a small business. Maybe if
2:20:12you were working at a largecale
2:20:14enterprise, there are actually a couple
2:20:16of variations of BGP. There's IBGP and
2:20:20EBGP. One would be interior and one
2:20:22would be exterior. So EBGP would
2:20:25interface with other service providers
2:20:28or other large enterprises whereas IBGP
2:20:32would handle the inside part of the
2:20:34network. So that's the border gateway
2:20:37protocol.
2:20:40In this lesson, we're going to be
2:20:41talking about another routing protocol.
2:20:43This one's called the routing
2:20:45information protocol or RIP. Now, RIP is
2:20:47a very old protocol, and as a result,
2:20:50it's not often used, particularly in
2:20:52larger organizations, although it works
2:20:54reasonably well for small networks that
2:20:58don't require a lot of administration.
2:21:01The routing information protocol is a
2:21:04distance vector protocol which uses a
2:21:07hop count as a way of measuring
2:21:10distance. So a hop count of course is
2:21:12the number of intermediate devices that
2:21:15a message would need to go through to
2:21:17get to its final destination. With
2:21:20distance vector routing protocols we
2:21:22have a distance in other words how far
2:21:25away something is measured by hop count
2:21:28or intermediate systems. And we have a
2:21:31direction or a vector which gives us the
2:21:34interface that the message needs to go
2:21:36out to to get to its final destination.
2:21:40We've got a number of different
2:21:42mechanisms that gets used to prevent
2:21:45incorrect routing information. So we
2:21:47have split horizon which basically keeps
2:21:51routing loops from happening. So we know
2:21:53that if a routing update comes in on a
2:21:55particular interface, we don't send that
2:21:57message back out that same interface.
2:21:59Unlike a protocol such as BGP, for
2:22:01example, RIP sends out entire routing
2:22:04tables or partial routing tables all at
2:22:07once. If I send my entire routing table
2:22:11to you, it would have an entry or
2:22:14several entries perhaps from routes that
2:22:17you had. And so split horizon is a way
2:22:20of preventing you from getting a route
2:22:23from me to a network that you already
2:22:26knew about. So there are a number of
2:22:28mechanisms that get used with RIP in
2:22:31order to prevent bad routing decisions
2:22:33from happening. Split horizon is one of
2:22:36them. What I've got here is a packet
2:22:39capture from a RIP session. RIP uses
2:22:42UDP. Of course, in a different lesson,
2:22:45we talked about BGP, which uses TCP. RIP
2:22:49uses UDP. And the idea is UDP is faster
2:22:53and requires less overhead, so the
2:22:55messages get out quicker. What I've got
2:22:57here is a RIP v1 request and going to
2:23:03get a response here. And you can see
2:23:06that we've got an IP address of
2:23:09200.0.1.0
2:23:10zero and the metric is one which means
2:23:13it's only one hop away. So we continue
2:23:16to see request responses and primarily
2:23:20this is all there is. We've actually got
2:23:23a series of networks in the 200 range.
2:23:27So we're going to keep sending out these
2:23:29different updates about how far away
2:23:32these networks are. Now what you'll see
2:23:35here is you'll notice that there's not
2:23:38actually an indication of how big this
2:23:42particular network is. And the thing
2:23:44about RIP is it makes some assumptions
2:23:47about the size of the network based on
2:23:50the class of the IP address. And the
2:23:53class of the IP address has to do with
2:23:56this first octet in the IP address.
2:23:59Based on that first octet, you can make
2:24:02determinations as to whether it's a
2:24:03class A, which would be in the range of
2:24:060 to 127. A class B would be in the
2:24:10range of 128 through 191. And a class C
2:24:14would be in the range of 192 through
2:24:18223. So those would be the classes of
2:24:22addresses you would see. Is actually a
2:24:24class D which would be used for
2:24:26multiccast. So it's not something you
2:24:28would actually ever set a system to have
2:24:31an IP address in that class D range. Now
2:24:34in this case, what RIP would assume
2:24:37would be the network mask for this
2:24:40particular IP address would be
2:24:42255.255.255.0
2:24:46or 24 bits of network mask. Again, RIP
2:24:50doesn't have the capability of doing
2:24:53classless addresses. So all of the
2:24:56addresses it knows about rely on the
2:25:00class of the IP address which again is
2:25:03based on the first octet of the IP
2:25:07address. So we figure out how large the
2:25:10network is based on that first IP
2:25:12address and the network mask would
2:25:15follow from whatever class you happen to
2:25:17be in here. So this is a series of RIP
2:25:21version one messages. There was actually
2:25:23a RIP version two which set out to fix
2:25:27some problems that RIP version one had.
2:25:31You'll notice with RIP, one of the
2:25:33downsides here is there's not any
2:25:35authentication that happens here. So we
2:25:38do request response request response and
2:25:41then a number of responses and it's
2:25:44actually a broadcast address that gets
2:25:46sent to here. So with RIP, we just send
2:25:49out the message to everybody who wants
2:25:51to listen and there's not actually any
2:25:53authentication to verify that the
2:25:56message that is being sent has any
2:25:58validity at all and that it actually
2:26:00comes from the right source. So there
2:26:04are definitely some challenges with RIP.
2:26:06Although, like I said, with really small
2:26:08networks, it may not actually be a bad
2:26:10protocol if you don't really want to put
2:26:12a lot of administrative work into a
2:26:16dynamic routing protocol.
2:26:20In this lesson, we're going to be
2:26:21talking about another routing protocol.
2:26:23This routing protocol is OPF or open
2:26:26shortest path. First, OPF is actually
2:26:29based on the idea of having multiple
2:26:33points in your network and what points
2:26:37are connected to what other points. And
2:26:40it's really a similar idea to how your
2:26:42GPS works. So, your GPS actually has a
2:26:45map of what points are related to what
2:26:48other points. And based on that, it
2:26:51builds this structure of how to get from
2:26:55one place to another. That's similar to
2:26:57how OPF works. Now, OPF is a link state
2:27:01protocol. A link state protocol is
2:27:04really, as I said, all about
2:27:05communicating information with the
2:27:08people around you about who you're
2:27:10connected with. Once you are connected
2:27:13to these people and you've exchanged all
2:27:15of this information, you can build this
2:27:18map of basically how to get to
2:27:21everywhere. OPF is actually an interior
2:27:24gateway protocol. And so the routing is
2:27:26all done within a single routing domain
2:27:29or autonomous system. So I've got a
2:27:32packet capture here and let me get into
2:27:33a little bit more detail around OPF.
2:27:37So the first thing that happens when a
2:27:40router comes up is it's going to send a
2:27:43hello packet to all of the people around
2:27:46it. So you can see the destination here
2:27:48is actually a multiccast address and I'm
2:27:51going to send a hello packet out which
2:27:54says you know I am awake I'm connecting
2:27:57to other people around. So it's an
2:28:00initial connection. It also becomes a
2:28:03keep alive periodically hello packets
2:28:05will get sent out to the network. We've
2:28:08got a designated router here of
2:28:10192.168.170.8
2:28:13eight, which is where this message is
2:28:15actually coming from. So, we've got a
2:28:17bunch of hello packets here. And then we
2:28:20see a number of DB description packets.
2:28:25So, what's a DB description packet?
2:28:27Well, a DB description packet actually
2:28:30defines the topology of the network from
2:28:35the perspective of each individual
2:28:37router. So, these are the people that I
2:28:40am connected to. It's the topology
2:28:42description that gets sent out. So, this
2:28:45is the contents basically of my
2:28:47database. So, I am sending those
2:28:50messages out. You can see there's a
2:28:52couple of routers here that are sending
2:28:53out the DB description messages. We pop
2:28:57one open and we can see all of the
2:29:01information that gets sent. We've got
2:29:03the OPF header and it tells us it's the
2:29:06OPF version 2 and the message type is
2:29:09two which is a DB description message.
2:29:13The source router is 192.168.170.3
2:29:18and we've got the area ID. As I said,
2:29:20this is a protocol that's designed as an
2:29:24interior gateway protocol and it's based
2:29:26around the idea of routing areas. So
2:29:29this is the area ID here and it's 0.0
2:29:320.0.1.
2:29:34Now we've got the DB description portion
2:29:36of the message and now we've got the
2:29:39link state advertisement headers
2:29:42and we've got a link state ID and an
2:29:45advertising router. We've got some
2:29:48options and it tells us that external
2:29:51routing capability is on and we've got a
2:29:55number of LSA headers. So we've got
2:29:58another link state ID of 80.2.1
2:30:01212.116.0.
2:30:03So that's a network that we know about.
2:30:06And we've got several others here as
2:30:08well. So 148.121.171.0.
2:30:12That's another one that we know about.
2:30:14The LS age here is 2 seconds. And
2:30:17periodically an LS request will get sent
2:30:20out saying, "Hey, I think my topology
2:30:23database may be out of date. Could you
2:30:25get it updated for me?" So we're sending
2:30:28out a link state request. And what we
2:30:30will get back is ls updates.
2:30:34And you can see the OPF header here. In
2:30:37this ls update message and the ls update
2:30:41packet, we've got a router link state
2:30:44advertisement.
2:30:46And you can see that the link state ID
2:30:49here is 192.168.170.8.
2:30:53It's a stub area.
2:30:56So, we've got the IP network is
2:30:58192.168.170.0
2:31:02and the link type is a connection to a
2:31:04stub network. If the router thinks it's
2:31:07database is out ofd, it's going to send
2:31:10ls requests and then get ls updates in
2:31:13response. And then we're going to send
2:31:15out acknowledgements to these updates
2:31:17saying, "Yeah, I got it." Again, all of
2:31:19these routers with these updates and
2:31:22advertisements are responsible for
2:31:25maintaining this database and building a
2:31:28topology map within themselves. So, they
2:31:32can quickly calculate the quickest way
2:31:35to get from themselves to any other
2:31:38point on the network based on where all
2:31:41of the other places within their network
2:31:44area are. all of the other routers and
2:31:46the networks that belong to those
2:31:49routers. The open shortest path first is
2:31:52based on the idea that I've got a route
2:31:56in mind before I even send the message.
2:31:59So, it's not like other protocols that
2:32:02say I'm going to send it out to the next
2:32:05router and just get it a little bit
2:32:07further on towards my goal. With a link
2:32:10state protocol, I've got a map in mind.
2:32:12And again, it's very much like a GPS.
2:32:15The GPS knows how you're going to get to
2:32:17where you're going from the point that
2:32:19you start. And a link state protocol has
2:32:22this same idea because they're both kind
2:32:24of based on Dystra's algorithm, which is
2:32:27this open shortest path first network
2:32:30topology concept. You're going to figure
2:32:33out the path that a particular packet is
2:32:36going to take before you even start
2:32:38sending it. If something happens along
2:32:41the way, then the route would get
2:32:43recalculated and the routers along the
2:32:46path would make adjustments as they
2:32:48went. But basically, you're sending it
2:32:50to the next router along the way. That's
2:32:53going to be the quickest way of getting
2:32:55from point A to point B and getting that
2:32:59message there as quickly as you can. So,
2:33:01that's the open shortest path first
2:33:03routing protocol.
2:33:06In this lesson, we're going to be
2:33:08talking about the address resolution
2:33:10protocol or ARP. Now, what ARP does is
2:33:13it provides a lookup between a layer 3
2:33:17address and a layer 2 address. So, if
2:33:20I've got an IP address, which is a layer
2:33:223 address, in order to get a message to
2:33:25that IP address, I actually need to know
2:33:28what layer 2 address to send it to.
2:33:30Because remember, we're on the local
2:33:32area network, and I need a MAC address
2:33:35to send it to in order to get it to
2:33:38where it's going. When we're on the
2:33:40local network, an IP address doesn't
2:33:42actually do it for me other than locally
2:33:45an IP address will serve as a lookup
2:33:47tool for a physical or MAC address. So,
2:33:51I've got a capture going here. I've just
2:33:54been capturing some packets on my local
2:33:57network. Going to do a stop and do a
2:34:00filter on ARP just so we're looking only
2:34:03at the ARP messages. What ARP is is a
2:34:06two-step process. ARP sends out a who
2:34:09has or a request message. So I've got an
2:34:13ARP message here. You can actually see
2:34:16there's no internet protocol in here.
2:34:18You see we go directly from the layer 2
2:34:21protocol or Ethernet straight into the
2:34:24address resolution protocol which is a
2:34:26layer 3 protocol. Now the reason for
2:34:28that is because I'm not actually sending
2:34:31messages in a way that would leave the
2:34:34local network. So this is a step above
2:34:37layer 2, but I'm actually doing some
2:34:39lookups on layer 2. And so it just kind
2:34:42of sits alongside the internet protocol
2:34:45in terms of a protocol stack. So I've
2:34:48got a message here which is a who has
2:34:51message or an ARP request and you can
2:34:54see up here address resolution protocol
2:34:57request. Now how can I tell that it's a
2:35:00request? For a start, I can tell it's a
2:35:03request because I've got an op code that
2:35:05says it's a request. So request has an
2:35:08op code of one. And you can see down
2:35:11here in the raw capture, we've got a one
2:35:14in that particular field. Now, the other
2:35:18way is because I've got a sender MAC
2:35:21address and a sender IP address, and we
2:35:23can see those here. And I've got a
2:35:26target MAC address of all zeros because
2:35:28I don't know what the MAC address is. I
2:35:31do know what the target IP address is.
2:35:34So this particular IP address has sent
2:35:37out an ARP request for this IP address
2:35:41here, the 192.168.1.30.
2:35:45And since I don't know the MAC address,
2:35:46I've left that blank. And we should be
2:35:49able to find an is at message. And it
2:35:53may not actually correspond, but here
2:35:55happens to be an is message. So this is
2:35:58a reply. You can see an address
2:36:01resolution protocol reply here. And
2:36:03again, we've got an op code of two. And
2:36:05if I select that, you can see down in
2:36:08the raw message below, there's a two
2:36:10there. So that's my ARP reply. And here
2:36:15we've got the sender MAC address and the
2:36:17sender IP address. And now we've got the
2:36:20target MAC address filled in. And of
2:36:22course, we've got the target IP address.
2:36:25So, ARP, as I said, is a two-step
2:36:27protocol. You send out a request for the
2:36:31MAC address that belongs to a particular
2:36:33IP address, and you wait for a reply.
2:36:37There is a bit of a shortcut. You don't
2:36:40have to ask every time because we store
2:36:42an ARP table. So, here's the ARP table
2:36:45for a particular system. I keep track of
2:36:49IP address and MAC address in an ARP
2:36:52table and there would be a particular
2:36:53timeout for each entry here because we
2:36:56don't want to keep them permanently
2:36:57because sometimes MAC addresses and IP
2:37:00addresses change and so we have to
2:37:02refresh these on a somewhat regular
2:37:04basis. We do store entries though to
2:37:07keep from having to look things up every
2:37:10time we want to send a network message
2:37:12out. This just keeps things a little bit
2:37:14quicker so we can keep sending messages
2:37:18without always having to do the ARP
2:37:20lookup. Now, you'll notice here as we
2:37:23look through this ARP protocol that
2:37:26there's no actual authentication.
2:37:28There's nothing that would stop anybody
2:37:30from just replying on behalf of somebody
2:37:33else. We'll talk a little bit more about
2:37:35ARP spoofing in another lesson, but I
2:37:39just want to point out here that this is
2:37:41a very simple protocol. It's just two
2:37:43steps, a request and a reply. There's no
2:37:46authentication. There's no verification.
2:37:48It's just a very, very simple protocol.
2:37:51It's designed to be fast and efficient.
2:37:54And that's the address resolution
2:37:56protocol.
2:37:58In this lesson, we're going to be
2:38:00talking about ARP spoofing. And we
2:38:02talked about ARP or the address
2:38:04resolution protocol in a previous
2:38:06lesson. And as I mentioned then, it's a
2:38:08very simple protocol that's designed to
2:38:10map an IP address or a layer 3 address
2:38:13to a MAC address or layer 2 address. So
2:38:16if I've got an IP address and I want to
2:38:19deliver something locally on my network,
2:38:22I need a MAC address to know where to
2:38:24send it. That's even true trying to send
2:38:27something off the local network. I need
2:38:29the MAC address of my local gateway. ARP
2:38:33is a very simple protocol that just does
2:38:36a very simple mapping between layer 3
2:38:38addresses and layer 2 addresses. Because
2:38:42it's very simple and there's no
2:38:45authentication or verification built
2:38:47into it, it's prone to what we call
2:38:49spoofing. So I can pretend to be a
2:38:53system that I'm not actually. So, I do
2:38:56that by sending out what we call
2:38:59gratuitous ARPs. A gratuitous ARP is
2:39:02where I am sending out a reply without
2:39:05actually getting a request. I could
2:39:08actually do a spoof here of my default
2:39:11gateway on my system. And what that
2:39:13would allow me to do is it would allow
2:39:16me to get messages that were destined
2:39:19for the default gateway. So I could see
2:39:22messages that somebody was trying to
2:39:25send off the network and they would come
2:39:27to me rather than going to the default
2:39:30gateway because you can see here I'm
2:39:32actually sending out a reply saying
2:39:35192.168.1.1
2:39:37is actually at and this right here
2:39:39happens to be my MAC address. So I'm
2:39:42sending this out as a broadcast and you
2:39:44can see this here FF FFF and so forth.
2:39:48That's a broadcast. So, I'm sending this
2:39:49out to everyone on the network. I'm
2:39:52actually connected to a system that
2:39:55isn't my local system, but I've got
2:39:57Wireshark running here. I'm going to
2:39:59stop the capture here, and let's just
2:40:02take a look at the ARP messages.
2:40:05Now, what I should see down here is an
2:40:08awful lot of is at messages. And you can
2:40:11see that's true. We've got an ARP reply
2:40:14for 192.168.1.1.
2:40:18It's trying to redirect messages to a
2:40:21different system. If I clear this out,
2:40:24what I might see here, depending on the
2:40:27type of traffic that's going on on my
2:40:29network, is I might actually see
2:40:32messages that are being sent to a
2:40:35different host. And as I said, actually,
2:40:38I'm doing a capture from a system that's
2:40:41different than I was doing an ARP spoof
2:40:42on. It's actually the other system that
2:40:45would see those messages.
2:40:47What I could do is I've got this ARP
2:40:50reply. I could actually open up a new
2:40:53tab here and get into that system.
2:40:57And now if I were to do a TCP dump,
2:41:03I could do a capture here and see
2:41:06whether any messages were going to this
2:41:09system that were originally destined for
2:41:12another system. And actually there's not
2:41:16an awful lot of traffic going on on the
2:41:19network right now. You do see a couple
2:41:21of messages here that would be going to
2:41:24that particular system, but you can see
2:41:27all of the ARP messages of course that
2:41:29are being sent out. I'm doing a spoofing
2:41:32here where I'm actually requesting
2:41:34messages for my default gateway be sent
2:41:37to me rather than the gateway. Now,
2:41:41there's some other trickery that has to
2:41:44happen here. We've got to have something
2:41:46in the background that will actually
2:41:47send the messages off to the default
2:41:50gateway after we've seen them.
2:41:51Otherwise, it's pretty apparent what's
2:41:53going on when everybody's off-net
2:41:56traffic starts behaving strangely and
2:41:59web pages aren't loading and various
2:42:01other internet related services just
2:42:05stop functioning. But as you can see,
2:42:07ARP spoofing is actually a pretty simple
2:42:10process. There are a handful of tools
2:42:12that will do the spoofing for you. I
2:42:14just showed you one here called ARP
2:42:16spoof. There's another one called
2:42:18Edercap that will run under Linux and
2:42:21some other operating systems. There are
2:42:23other tools like Kane enable for
2:42:25instance that will do ARP spoofing as a
2:42:29function of something else that they do.
2:42:31But ARP spoofing generally is pretty
2:42:33simple to do and it's really a result of
2:42:37just the simplicity of the protocol and
2:42:39the lack of authentication and
2:42:41verification that was built into the
2:42:43protocol when it was originally
2:42:45designed. So that's ARP spoofing and
2:42:47some of the things that you can do with
2:42:49it.
2:42:51In this lesson, we're going to be
2:42:53talking about the reverse address
2:42:54resolution protocol or RARP. RARP is the
2:42:58reverse of the address resolution
2:43:00protocol or ARP. By reverse, I mean that
2:43:04I don't actually have a logical address
2:43:07or an IP address. What I have is a MAC
2:43:09address. If you remember, ARP is where I
2:43:12have a logical address or an IP address
2:43:15and I'm looking for a MAC address or a
2:43:18physical address. In this case, the
2:43:20reverse is true. What situations would
2:43:23that be useful? Well, if you are a
2:43:26diskless workstation, for example, you
2:43:29may need to get your IP address before
2:43:33you can pull the image for your
2:43:36operating system over. So, what happens
2:43:38is you don't have any hard drive
2:43:41yourself. Everything runs in memory. So,
2:43:43you don't have a place to store
2:43:45configuration details like an IP
2:43:47address. What you do have is the
2:43:50physical address that is burned onto
2:43:53your network interface card. So what you
2:43:55would do would be you would send out
2:43:58this reverse address resolution protocol
2:44:00request in order to get an IP address.
2:44:03So you can configure your network
2:44:04interface and then you can issue the
2:44:07request to the server where your
2:44:10operating system image is stored and you
2:44:12can pull that operating system image
2:44:14down and boot the operating system.
2:44:17though you can get running. So that's
2:44:19really what RARP or the reverse address
2:44:21resolution protocol is for. Now I've got
2:44:24a wire shark capture here. And we see
2:44:28the RARP request and it's really just an
2:44:30ARP request with a different op code.
2:44:33You can see the op code is three as
2:44:36opposed to the one and two that we saw
2:44:38in the ARP packet captures. An op code
2:44:42of three is a reverse request. So you
2:44:45can see here there are some differences
2:44:47from what we've seen previously. In this
2:44:50case we are sending a sender MAC address
2:44:54and a target MAC address. So that's the
2:44:57one thing that we do know. We know what
2:44:59our MAC address is. So we're going to
2:45:02populate the sender and the target MAC
2:45:05address with our MAC address because
2:45:08we're the ones whose IP address we're
2:45:11looking for. I know my MAC address and
2:45:14I'm the one who needs the IP address for
2:45:17me. So, I'm both the sender and the
2:45:20target. So, I don't have an IP address
2:45:22for the sender or the target. So, I'm
2:45:24going to leave those blank. But my MAC
2:45:26address, of course, is the same because
2:45:28I'm the sender and the target. The MAC
2:45:30address is going to be the same here
2:45:32between the sender and the target as you
2:45:34see. And if we look down at the Ethernet
2:45:382 header, you can see the destination
2:45:40for this particular message is a
2:45:43broadcast address. All FS is a broadcast
2:45:47MAC address. So that means everything on
2:45:51our physical network, the local area
2:45:53network that we are attached to, every
2:45:56system on that network is going to get
2:45:58this request hoping that somebody is
2:46:01around who can give us an IP address.
2:46:04And typically there would be a system
2:46:07that was capable of doing that.
2:46:09Something like a bootp server would give
2:46:11us the details that we were looking to
2:46:14get. That's how the reverse address
2:46:16resolution protocol works. And that's
2:46:18really the primary use for it to boot up
2:46:21configurationless systems. So discless
2:46:24systems that don't have any IP
2:46:26configuration stored on them. Or
2:46:29sometimes you'll use a pixie boot
2:46:31process that's pxe and that would do the
2:46:35same thing. It would go and probe for an
2:46:38IP address from the MAC address that it
2:46:41already had. So it doesn't have to be
2:46:43discless. If you wanted to boot an
2:46:46installation off the network, this is
2:46:49another way of doing it as well. But
2:46:51discless workstations were really the
2:46:53primary reason for having this reverse
2:46:56address resolution protocol because they
2:46:58were pretty common or starting to be
2:47:00common about the time that they were
2:47:02really implementing the reverse address
2:47:04resolution protocol. That was really
2:47:06kind of how it was seen for systems that
2:47:08didn't have an ability to store
2:47:10configuration details.
2:47:14In this lesson, we're going to be
2:47:15talking about internet registries. What
2:47:18is an internet registry? Well, an
2:47:20internet registry is a place where data
2:47:24regarding what goes on on the internet
2:47:26is stored. Not surprisingly, it's called
2:47:28a repository. So, what sorts of things
2:47:30do we store? Well, we store information
2:47:33about who owns a particular IP address.
2:47:37We store information about who owns a
2:47:40particular domain. We store information
2:47:43about different contacts on the
2:47:46internet. So if I've got a domain, I
2:47:49would have to be a contact and I could
2:47:51be an administrative contact or a
2:47:53technical contact on the domain. So I
2:47:56would have to have a contact record at
2:47:59one of these registries. We've got here
2:48:01the internet corporation for assigned
2:48:03names and numbers. and they're
2:48:05responsible overall for things like
2:48:09allocating IP addresses and maintaining
2:48:13the DNS root servers. So DNS is a
2:48:17hierarchy and we'll talk about that in a
2:48:20subsequent lesson. But the hierarchy
2:48:22actually has a root and these are places
2:48:25that you would go as part of your DNS
2:48:28query in order to figure out who you
2:48:30actually need to look up the information
2:48:32from. So Ian is responsible for managing
2:48:37these root servers or overseeing the
2:48:40root servers more specifically.
2:48:43You can see that they talk about a
2:48:46unique authoritative route for the DNS.
2:48:48That's where they're discussing the idea
2:48:51alternate DNS doesn't work very well.
2:48:54Ian is responsible for IP addresses and
2:48:58overseeing the DNS root servers.
2:49:01We've also got different regional
2:49:04internet registries. So for example,
2:49:07we've got Aaron and that's the American
2:49:10Registry for Internet Numbers. The
2:49:13American Registry for Internet Numbers
2:49:15is responsible for managing the IP
2:49:18address allocations for North America
2:49:22specifically.
2:49:24For example, I could do a query on Aaron
2:49:28to see who owns a particular IP address.
2:49:32Aaron provides that information via a
2:49:35tool called who is. So I do a who is
2:49:38lookup and I specify a particular server
2:49:41and I'm going to Aaron and I'm asking
2:49:43about a particular IP address that I
2:49:46happen to know is in North America. You
2:49:49can see that it belongs to a company in
2:49:52Broomfield, Colorado called Level 3
2:49:54Communications. You can use these
2:49:57regional registries to look up who owns
2:50:00particular IP addresses.
2:50:02Now, Aaron, of course, isn't the only
2:50:05regional internet registry. We've also
2:50:07got RIPE and we've got Laknic and
2:50:11Afronic and APNic. And we've got
2:50:14regional registries around the world
2:50:17that are responsible for the different
2:50:19regions around the world. You can see
2:50:22all of these different registries just
2:50:24by going to their websites and you can
2:50:26see for example has data and tools. You
2:50:30can see statistics provided by the RIPEN
2:50:32NCC on the statistics page. These
2:50:36regional registries do a lot of work
2:50:38around managing a pretty large amount of
2:50:42data around who's who on the internet
2:50:45from the perspective of IP addresses and
2:50:48owners and contacts for the different
2:50:51domains and IP addresses. These are the
2:50:55regional internet registries and you can
2:50:58certainly take a look at your local
2:51:00registry and see what sort of
2:51:03information they provide and the
2:51:05services that they offer. But they're
2:51:07really useful for being able to look up
2:51:09information specifically about IP
2:51:12addresses and who owns them. And again,
2:51:15you would do that through the tool who
2:51:17is. And there are web-based tools to do
2:51:20that sort of lookup as well. If you
2:51:22don't happen to have a Unix-based
2:51:24operating system to run a who is from
2:51:26the command line, there are certainly
2:51:28websites that you can use to do who is
2:51:31lookups. So those are the internet
2:51:33registries and what they are good for
2:51:37from an internet addressing perspective.
2:51:42In this lesson, we're going to be
2:51:44talking about bootp and DHCP. BOOTP and
2:51:48DHCP are really more or less the same
2:51:51thing. It's just that bootp is an older
2:51:53protocol that doesn't have quite the
2:51:56level of configuration detail that DHCP
2:51:59does. So DHCP really builds on the older
2:52:03bootp. So bootp is the bootstrap
2:52:06protocol and DHCP is dynamic host
2:52:09configuration protocol. So again, I've
2:52:12got a wire shark capture here of some
2:52:15DHCP packets. We've got a DHCP discover,
2:52:20and that's where a client sends out a
2:52:23message looking for a DHCP address. Now,
2:52:28you'll notice here that DHCP uses UDP as
2:52:32its transport protocol. And you'll also
2:52:35notice that we've got a source port and
2:52:38a destination port here where the source
2:52:41port is the bootp client port and the
2:52:45destination is the bootp server port. So
2:52:4867 is the bootp server port and 68 is
2:52:52the bootp client port. The client is
2:52:55going to be expecting communication back
2:52:57on port 68. And of course it's sending
2:53:00to the server on port 67. It's using UDP
2:53:04primarily because it may not actually
2:53:06have an IP address and we can't
2:53:09necessarily establish a connection with
2:53:12a server. So, what we're going to do is
2:53:14just send out this message and we're
2:53:17going to negotiate an IP address and
2:53:19that'll all be done via UDP. So, you can
2:53:22actually see here the source address for
2:53:25the message is all zeros because we
2:53:27don't actually have an IP address yet.
2:53:30So, we're just going to send all zeros.
2:53:32And of course, the destination here is a
2:53:34broadcast message. So, we're sending it
2:53:36out to everybody. Now, we've got the
2:53:38bootstrap protocol. This is all of the
2:53:41messages that are involved in doing a
2:53:44DHCP discover. We've actually got no
2:53:47flags set here. And we don't know what
2:53:51our IP address is. And we don't have a
2:53:55relay agent or a next server IP.
2:53:59And the option here is a DHCP message
2:54:03type of DHCP discover. And we're looking
2:54:07for a client identifier.
2:54:10And we don't actually have a requested
2:54:12IP address. So if this is a system that
2:54:16has previously gotten a DHCP address
2:54:18from a server, it's probably going to
2:54:20request the same address that it already
2:54:23has, just for ease of use, so it doesn't
2:54:25have to reconfigure anything. And
2:54:28periodically, of course, these systems
2:54:30will send DHCP messages back out to
2:54:33renew the lease on the address that it's
2:54:36got. And we'll take a look at that
2:54:38renewal in a little bit. I send out a
2:54:41message saying I need an address. I get
2:54:44an offer back. And the offer contains
2:54:48information about the IP address. So,
2:54:51the IP address that is going to be
2:54:54offered is 192.168.0.
2:54:57010
2:54:59and the DHCP server you can see here is
2:55:02192.168.0.1
2:55:05and we can see it's a DHCP offer.
2:55:10I scroll down a little bit here. It's
2:55:12providing me my subnet mask. So
2:55:14255.255.255.0.
2:55:18The renewal time value is 30 minutes and
2:55:22you can see the lease time is 1 hour. So
2:55:25the renewal time is going to be half of
2:55:28the lease time. So in half of the time
2:55:31that you're provided a lease for, you
2:55:33have to go renew that lease and make
2:55:36sure that you can still have that IP
2:55:39address. And you can see here the DHCP
2:55:42server identifier. Now what I'm going to
2:55:45do is I'm going to acknowledge the offer
2:55:48that was made. So I'm replying to the
2:55:51server. So this is the server1010 and
2:55:54this is me now with the.1. So I'm going
2:55:58to reply to the server after configuring
2:56:02myself here and I'm going to say yes I
2:56:05will take that IP address and so I've
2:56:08taken that IP address. I've configured
2:56:10myself with everything that has been
2:56:12provided to me and I can go merily on my
2:56:15way. Now, on the server side, I've got a
2:56:18configuration file up here for a DHCP
2:56:22server. There's actually a lot of
2:56:24different things that I can set on the
2:56:26DHCP server side that would be provided
2:56:29to the client. So, we saw the IP address
2:56:32and we saw the subnet mask. So, at the
2:56:35top of the file here, you can see where
2:56:37it says start and end. That would be the
2:56:40IP addresses that we could use to hand
2:56:43out to clients who were interested in
2:56:46getting a DHCP address. So, we've got
2:56:50the number of addresses we can use. And
2:56:54down here, we've got the amount of time.
2:56:58All of the lease times and the renewal
2:57:01times are all configurable. So, I could
2:57:04do something longer than an hour. If my
2:57:07network is pretty stable and I don't
2:57:09have a lot of movement on it, I may want
2:57:12to offer leases of a much longer time
2:57:15than an hour. I could offer on the order
2:57:17of days and that would keep traffic flow
2:57:20to my DHCP server at a minimum. So, I'm
2:57:23not having clients constantly requesting
2:57:27lease updates. So, I'm going to keep a
2:57:29lease file. You can see here there is a
2:57:32lease file that allows me to be able to
2:57:35map MAC addresses to IP addresses. So I
2:57:38can make sure if a particular MAC
2:57:41address asks for an IP address and it
2:57:44doesn't remember the IP address that it
2:57:46previously had, I can just give them
2:57:48that IP address again and then I have to
2:57:50make any changes. So I can have a lot of
2:57:54options here that I could configure.
2:57:56Pretty common ones here. There's a DNS
2:57:59option where I could specify the DNS
2:58:01servers. There is a subnet mask. There
2:58:04is a router option so I can specify the
2:58:07default gateway which would be required
2:58:10in most cases. There is a winds server
2:58:13so I could specify the Windows naming
2:58:16server that would be used in a Windows
2:58:18network. I can specify the domain name.
2:58:22So the default domain name I could
2:58:24specify that. In this case, we're just
2:58:26going to say it's local. And there's the
2:58:28lease time. 10 days of seconds is
2:58:31864,000
2:58:33seconds. And you can see some other
2:58:36options that are here as well. So
2:58:38there's a log server, a cookie server, a
2:58:40domain, a swap server, time server. Time
2:58:44servers are sometimes helpful if you
2:58:46want to be able to set a particular time
2:58:48server so everybody is syncing to the
2:58:50same time server and they all have the
2:58:52same time. So you can see there's a lot
2:58:54of configuration possibilities with DHCP
2:58:58and we've looked at just a few of them,
2:59:00but that's how BOTP and the DHCP
2:59:03protocols work.
2:59:07In this lesson, we're going to be
2:59:08talking about IP configuration. We're
2:59:10just going to be going through
2:59:12configuring IP on a Windows system and
2:59:16looking at the configuration that's in
2:59:18place. So, I want to start out looking
2:59:21at the IP configuration on the system.
2:59:24So, I'm going to start out just doing an
2:59:26IP config. And that shows me just the
2:59:30basic information for the different
2:59:32adapters that are on this system. I
2:59:35could also do an IP config /all and that
2:59:38would show me some more detailed
2:59:40information like the default gateway for
2:59:43example the DHCP server and some
2:59:46additional information that I don't get
2:59:48if I just do an IP config. You can see
2:59:52we've got the physical address of the
2:59:54MAC address which is bound to the
2:59:56network interface and we've got the IP
2:59:59address and you'll notice it says IPv4
3:00:02because this is IP version 4 and there
3:00:06is an IPv6 address as well. With the
3:00:10most recent versions of Windows and
3:00:12frankly most other modern operating
3:00:14systems, IPv6 is enabled by default.
3:00:18It's just not typically used unless you
3:00:20happen to be connected to an IPv6
3:00:23enabled network. So now what I want to
3:00:25do here is I want to go into control
3:00:29panel and we're going to walk through
3:00:32just doing a basic configuration.
3:00:35So, the way this is set up right now is
3:00:38that it's set up using DHCP. And we've
3:00:41talked about DHCP, and we'll talk more
3:00:43in subsequent lessons about what DHCP is
3:00:47and how it works. But what DHCP does
3:00:50here is it provides me a configuration
3:00:54for my network settings without actually
3:00:58having to go in and manipulate them or
3:01:01manage them by hand. the system would
3:01:04come set default with DHCP
3:01:08and so all you have to do is turn it on.
3:01:10If there's a DHCP server on your
3:01:12network, you're automatically going to
3:01:14get configured with an IP address and
3:01:17everything else that you need. And
3:01:19certainly if you are connected to a
3:01:21network that has an internet connection
3:01:23through a cable modem or a DSL modem,
3:01:26then those devices would typically have
3:01:29a DHCP server built into them. They're
3:01:32really simple to just plug in. You
3:01:34automatically get your IP configuration
3:01:37and it's set for everything that you
3:01:39need to just automatically connect and
3:01:41be out on the internet as well as on
3:01:44your local network. So, if I bring up
3:01:46properties on my local area connection,
3:01:50then I can go into internet protocol
3:01:53version 4. Now, I want to select
3:01:56properties here. Now you see it's set to
3:01:59obtain an IP address automatically and
3:02:01that would be using DHCP. What I could
3:02:04do is I could plug an address in here
3:02:08and I'm going to use one that would be
3:02:10on this particular network. When I hit
3:02:13tab from the IP address, it populated
3:02:16the subnet mask for me based on what it
3:02:19thought the subnet mask probably should
3:02:21be. And that was really based on the
3:02:24classes of addresses that are here. So
3:02:27this 192.168.1
3:02:30happens to be a class C address and the
3:02:33subnet mask for a class C address would
3:02:35be this 255.255.255.0.
3:02:39So my default gateway is 192.168.1.1.
3:02:44My preferred DNS server I could set
3:02:48192.168.1.1
3:02:50here because there does happen to be a
3:02:52DNS server in that. I could do validate
3:02:56settings upon exit which would check all
3:03:00of my settings and make sure they are
3:03:02correct. And now when I close this, it
3:03:05should reconfigure the network interface
3:03:08for me. And now I can go back over here
3:03:12and if I do IP config, you can see that
3:03:15it is set with the values that I had set
3:03:18in there. So it's now set to
3:03:21192.168.1.210
3:03:22210 with my subnet mask here. And the
3:03:26default gateway of course is
3:03:28192.168.1.1.
3:03:30That's how you would do manual
3:03:32configuration using Windows and the
3:03:36network properties as opposed to just
3:03:38allowing the default DHCP connection. If
3:03:41you needed to set an IP address manually
3:03:44using a Windows system, that's how you
3:03:46would do it.
3:03:49In this lesson, we're going to be
3:03:50talking about IP fragmentation. One of
3:03:53the core functions of the internet
3:03:55protocol is to manage fragmentation.
3:03:58What that means is that we've got a
3:04:01discrepancy between the size of the data
3:04:04that we can send and the size that the
3:04:09physical networking medium will accept.
3:04:12So for example, Ethernet will take 1500
3:04:16bytes and that includes headers. We can
3:04:19send 64k bytes through an IP packet.
3:04:24Obviously there's some size difference
3:04:26and what ends up happening is that the
3:04:29IP datagramgram or IP packet ends up
3:04:32getting fragmented.
3:04:34And we can take a look at some
3:04:36information here. Just going to do a
3:04:38quick packet capture. And we can see
3:04:42some messages.
3:04:44We've got IP and you can see that we've
3:04:49got no flag set. There's no fragment
3:04:52offset. And we've just got messages that
3:04:55are going. So there's actually no
3:04:57fragmentation going on here that we've
3:04:59seen so far. So just to demonstrate the
3:05:02concept, I'm actually going to send some
3:05:04messages that are going to have to be
3:05:07fragmented. And I'm going to do that by
3:05:10specifying that the size of each packet
3:05:14is going to be too big to send out on
3:05:18the wire. So, I'm going to send this to
3:05:21my local network router or my default
3:05:25router. You can see 3,18
3:05:29bytes are going. And that's because I
3:05:31specified the size as 3100. And we've
3:05:35got to add on additional bytes for the
3:05:38extra headers. Let me kill that. And now
3:05:42we can go back and look at the wire
3:05:45shark capture. Let's just pull up an
3:05:47ICMP filter here.
3:05:51You can see there are three fragments
3:05:53here. Frame 448, 449, and 450 are all
3:05:59fragments. So, let me clear this out
3:06:01because we're not actually seeing the
3:06:02fragments because we don't know just
3:06:05from the fragment what we're actually
3:06:06looking at here. Once we've put it
3:06:08together, we figure out what's actually
3:06:11going on here. What we've got here is a
3:06:14fragmented packet. You can see where the
3:06:17flags say more fragments and in this
3:06:21case the fragment offset is zero. You
3:06:23may be wondering how the receiver knows
3:06:27that all of those packets belong
3:06:28together. Well, take a look at the IP
3:06:32identification field here. It's 54511.
3:06:36And we've got another message here that
3:06:39should be a fragment of the same one.
3:06:42We've also got 54511.
3:06:45And the fragment offset is 1480. We've
3:06:49already taken,480
3:06:52bytes. So, we're going to slot this one
3:06:55into 1,480
3:06:57because we start counting at zero. That
3:07:001480 bytes went into slots 0 to 1479.
3:07:05We're going to slot the first bite of
3:07:08this fragment here into slot 1480. And
3:07:13we've got the last one here. Again, the
3:07:15IP identification field says 54511.
3:07:19and we've got a fragment offset of 2960,
3:07:23which we would expect because we've got
3:07:251480 from the two packets that were
3:07:28ahead of it. Because of that, we're now
3:07:31slotting into offset 2960.
3:07:34So, I specified 1,500. We only got 1480
3:07:38in each one. And that's because of 20
3:07:40bytes of header. So, we only had 1,480
3:07:44bytes of actual data when it got to the
3:07:47other end because we pulled the header
3:07:49off. And so, that's where we end up with
3:07:521480. But you can see the way that we
3:07:55reassemble these in IP is the IP ID here
3:07:59will actually tell us that these three
3:08:01packets belong together.
3:08:04We've got these three with the same IP
3:08:07ID. The offset of course is different
3:08:10because we've got a chunk of data and
3:08:13then a second chunk of data and then a
3:08:15third chunk of data and every one of
3:08:17those of course increments the bite size
3:08:20and so we've got to be able to slot them
3:08:23into the appropriate place. Again, one
3:08:26of the critical functions of the
3:08:28internet protocol is to be able to
3:08:31handle fragmentation. We can see here
3:08:34using these largesized echo requests
3:08:37that we end up doing fragments based on
3:08:41the maximum transmission unit of the
3:08:44underlying networking protocol. In this
3:08:46case, it would be Ethernet. And again,
3:08:48the MTU of Ethernet is 1500 bytes. You
3:08:52can see again that we've got these
3:08:54fragmented packets. And that's really
3:08:56one of the core functions of IP. And to
3:08:59put them back together, we need the IP
3:09:01ID. and of course the fragment offset.
3:09:06In this lesson, we're going to be
3:09:08talking about ICMP or the internet
3:09:10control message protocol. So the
3:09:13internet control message protocol is one
3:09:15of those protocols that's a helper
3:09:17protocol. It works in conjunction with
3:09:21IP and with the other protocols like TCP
3:09:24and UDP and it's there to provide
3:09:27information about what's going on on the
3:09:30network. There are a couple of things
3:09:33that ICMP is useful for. One of them is
3:09:36to perform diagnostics and allow
3:09:39diagnostic messages to pass through the
3:09:42network. Another one is to perform error
3:09:46functions. So if something happens on
3:09:49the network like there's congestion for
3:09:51example or if a system goes down then
3:09:56ICMP is there to provide the messages
3:10:00going back to the originating system to
3:10:03let them know what's happening. On top
3:10:05of that ICMP is as I said a helper
3:10:09protocol. So it doesn't have IP
3:10:11underneath it. It actually sits
3:10:12alongside IP in the protocol layers. You
3:10:17can see here the internet layer. We've
3:10:19got IP and we've got ICMP. ICMP really
3:10:23sits at the internet layer and it sits
3:10:25alongside IP. If you open up an ICMP
3:10:29message in a packet capture tool like
3:10:32Wireshark, you won't actually see any IP
3:10:35headers. All you'll see is ICMP. There
3:10:37will be no IP at all. So you'll go
3:10:40straight from the layer 2 header, which
3:10:42would be Ethernet, right up to ICMP, and
3:10:45there would be nothing else. As I said,
3:10:47ICMP is really useful for diagnostics.
3:10:51It's useful for error messages. It helps
3:10:54in things like determining whether a
3:10:57system is up or determining how far away
3:10:59a system is. And we'll look at uses of
3:11:03those types of MP messages in the coming
3:11:07lessons.
3:11:10In this lesson, we're going to be
3:11:11talking about ICMP message types. As I
3:11:14mentioned previously, ICMP is useful for
3:11:18diagnostics. It's useful for providing
3:11:21error conditions to a requesting or
3:11:24originating host. ICMP is a control
3:11:28message or a control message protocol.
3:11:30Let's take a look at some of the
3:11:32messages that you could actually see
3:11:34when you are making use of ICMP. So,
3:11:37we're looking at the ICMP RFC that was
3:11:40written in September of 1981. And you'll
3:11:43see it's actually RFC 792 and the RFC
3:11:47for IP internet protocol is RFC 791. So,
3:11:52we're looking at RFC 792 here. And if we
3:11:55just scroll down, we'll start looking at
3:11:58the different messages.
3:12:00So, right now, we've got a destination
3:12:02unreachable message. A destination
3:12:04unreachable message has to do with the
3:12:07system that is trying to be contacted
3:12:11isn't actually available. So that's a
3:12:14type three message. And you'll see in
3:12:16ICMP, we've got a type and a code. When
3:12:20we're talking about unreachable, there's
3:12:21actually a few conditions that might
3:12:24render a system unreachable or a
3:12:26destination unreachable. Code zero is
3:12:29the network is unreachable. Code one,
3:12:31host unreachable. Then we've got
3:12:33protocol and port unreachable and
3:12:35fragmentation and DF set or source route
3:12:39failed. So those are some conditions
3:12:42that would make a destination be
3:12:45unreachable. So we've got a type of
3:12:47destination unreachable. And then we've
3:12:49got codes that give further detail as to
3:12:53what makes the destination unreachable.
3:12:56We've got a time exceeded message. This
3:12:58is a pretty simple one. the message that
3:13:02was being sent didn't get to its
3:13:05destination before the time to live
3:13:07expired. Right here, the code is time to
3:13:10live exceeded in transit and the type
3:13:13happens to be 11. Now, scrolling down a
3:13:16little bit further, we've got a
3:13:18parameter problem message and there's a
3:13:21problem with a parameter in the message
3:13:24that was sent. Source quench message has
3:13:28to do with a system that's actually
3:13:30receiving too much traffic. You may send
3:13:34a source quench message saying, "Slow
3:13:36down. Don't send me any more messages
3:13:39just yet until I'm ready to catch up
3:13:41because I'm just getting too much data."
3:13:44This is a redirect message. So, this one
3:13:47says that the messages that are being
3:13:51sent need to go somewhere else. We're
3:13:54going to send a message back saying the
3:13:58messages need to be redirected.
3:14:00So, here's a pretty common one right
3:14:02here. We've got an echo and an echo
3:14:04reply. And that would be in the ping
3:14:08messages where you would use that if you
3:14:10want to see whether a system is up. You
3:14:13would use the ping utility and it would
3:14:16use MP type zero or type 8 and the code
3:14:22happens to be zero. So, interestingly,
3:14:24they don't use the same type for both
3:14:26messages and then specify whether it's a
3:14:29request or a reply in the code. The type
3:14:31specifies whether it's an echo message
3:14:33or an echo reply. So, type 8 is an echo
3:14:37message and type zero is an echo reply.
3:14:40So you can see there are several
3:14:42different types of messages that ICMP
3:14:45specifies and it has to do with
3:14:48diagnostics of the network as well as
3:14:50error conditions that may exist either
3:14:52on the host or within the network.
3:14:55They're really all there to help
3:14:57communications go faster, more
3:15:00efficiently, and make sure that errors
3:15:03can be recovered from gracefully. If we
3:15:06don't actually send error messages back,
3:15:08then systems may have to wait until some
3:15:12amount of time is exceeded before they
3:15:14can do something else. So in this case,
3:15:17we can send error messages back and the
3:15:19system should be able to recover cleanly
3:15:22and gracefully from those error
3:15:24conditions and either retransmit as
3:15:27necessary or abort the communications.
3:15:31So that's really what ICMP is there for
3:15:34to manage those types of events and
3:15:36these messages that we have looked at
3:15:38are really useful in helping that
3:15:41process along.
3:15:44In this lesson, we're going to be
3:15:46learning about the ping utility and the
3:15:48underlying ICMP messages that make the
3:15:52ping utility work. What is ping? Well,
3:15:55some people will tell you ping stands
3:15:56for packet internet groper. In reality,
3:16:00ping is really just a name that was
3:16:03given to this utility because it mimics
3:16:06the sound used in sonar. If you are
3:16:10trying to locate something with sonar,
3:16:12you would send out a ping and if you got
3:16:15a ping in response, then you would know
3:16:18that whatever it was you were looking
3:16:20for was really there. So, you get an
3:16:22echo back. In this case, what we are
3:16:24doing is we are sending ping messages
3:16:28and looking for echoes back. So you can
3:16:32see here I'm pinging a device on my
3:16:34local network and I can see that that
3:16:37system happens to be up. Let me actually
3:16:40start off a packet capture.
3:16:46Then I'm going to do the ping again.
3:16:50So that's on my local system. And now
3:16:52let me ping something that's not on my
3:16:55local system. We'll just see whether
3:16:57there's any differences in the messages.
3:17:02So let's do ICMP. We'll do a filter. Let
3:17:07me just stop the capture here.
3:17:10We've got some MP messages. First of
3:17:13all, we can see that the source is
3:17:16192.168.1.22,
3:17:1822 which is me and the destination is
3:17:21192.168.1.1
3:17:24which is the device that I was pinging.
3:17:26In this case it happens to be the local
3:17:28gateway on my network. So I can open up
3:17:32the MP message and I can see it's a type
3:17:368 and a code zero. So a type 8 is a ping
3:17:40or an echo request and the data just is
3:17:44some garbage data. doesn't really mean
3:17:47much of anything. I could actually use
3:17:50ping to send data and I could send
3:17:54larger sized packets and that might give
3:17:57me a sense of how long that messages are
3:18:00taking to get from point A to point B
3:18:03and back with larger messages.
3:18:06So here's my echo reply and you can see
3:18:09the type is zero echo reply and of
3:18:12course the code is zero as well. So,
3:18:15these are all going to be pretty much
3:18:17the same. Let's scroll down and look for
3:18:21the messages that I was sending to the
3:18:24network that was not my local network.
3:18:27So, does it look any different? No. From
3:18:29an ICMP perspective, it actually looks
3:18:32exactly the same. Not surprisingly, ICMP
3:18:34is really ICMP. The only difference
3:18:36would be maybe that there was an ARP
3:18:39request that may have been different. In
3:18:41this case, probably not because what I
3:18:43was pinging the first time around was my
3:18:45local gateway. What I'm seeing here is
3:18:48the echo request and of course I'm going
3:18:50to get an echo reply back. And again,
3:18:53I'm just sending 56 bytes of data as
3:18:57part of the echo message.
3:18:59I could actually specify that I wanted
3:19:02to give a larger packet size and I could
3:19:06actually specify a particular payload if
3:19:09I wanted to do that. And again, that
3:19:11would have to do with if I wanted to see
3:19:14how long larger messages were taking
3:19:17because this ping message really isn't
3:19:19that large. If we go back to the message
3:19:23here, opening this up, we can actually
3:19:25see the total length is 84 bytes. So, in
3:19:29total, I've got 84 bytes that I'm
3:19:32sending. And that's not really very
3:19:33large. So I could specify that I wanted
3:19:36to send a really large message like
3:19:38a,000 bytes for example or 1,200 or 1300
3:19:42bytes or maybe even something larger in
3:19:44which case it would have to be
3:19:46fragmented more than likely based on the
3:19:48maximum transmission unit of the local
3:19:50network. Again, we've got this ping
3:19:53utility that uses the ICMP echo request
3:19:57and reply messages in order to determine
3:20:00whether systems are up or whether
3:20:02there's an error condition on the
3:20:04network that may prevent us from getting
3:20:06traffic to and from that particular
3:20:08system.
3:20:11In this lesson, we're going to be
3:20:12talking about ICMP error messages. Error
3:20:15messages are really one of the most
3:20:17critical portions of the ICMP protocol.
3:20:20Yes, it's nice to do ping requests, but
3:20:23really the day-to-day grind of an ICMP
3:20:27protocol is really in the error messages
3:20:29because it ensures that traffic is
3:20:32flowing cleanly through the network and
3:20:34it helps applications respond gracefully
3:20:37to failures if there are any. I'm going
3:20:39to start up a packet capture here just
3:20:41so we can see some messages and I'm
3:20:45going to use a utility that's actually
3:20:47based on the idea that ICMP uses error
3:20:51messages. So I'm going to do a trace
3:20:53route and a trace route is going to show
3:20:56me the route through the network that a
3:20:59particular set of packets is going to go
3:21:01through. So you can see that we're doing
3:21:04a route through these several devices.
3:21:09For every hop and on the left hand side,
3:21:12the number indicates the hop. We're
3:21:15sending out three messages.
3:21:17Actually, it looks like in some of these
3:21:19cases, we went a different route. The
3:21:22first ICMP message went through this
3:21:25device here, the 25. The second one went
3:21:28through this device, which would be 165.
3:21:32And then the third message went back to
3:21:35where the first message was. And the
3:21:37same thing with hop 10, 11, 12, 13, and
3:21:4014. Looks like they went through
3:21:43different devices, which could have to
3:21:45do with load balancing. It could have to
3:21:47do with maybe some routes are causing
3:21:50problems and one second, one route is
3:21:53better, another second, another route is
3:21:55better depending on congestion and
3:21:56various other things. So again, we're
3:21:59seeing some information that ICMP
3:22:01provides us and we can see these types
3:22:05of messages here. So let me go back to
3:22:08my packet capture. I'm going to stop it.
3:22:11And now I just want to look at the ICMP
3:22:13messages. So you can see that the
3:22:17messages we're seeing here are time to
3:22:19live exceeded. And that's actually how
3:22:21trace route works.
3:22:25If I clear this out and I take a look at
3:22:29this message here, which is the message
3:22:33that is going to www.google.com,
3:22:36you can see that the time to live is
3:22:39one. Now, what happens is I set the time
3:22:42to live to one and it's going to get to
3:22:45the very first router on the path that's
3:22:48going to decrement it to zero and it's
3:22:51going to send back this MP time to live
3:22:54exceeded. I'm going to get this time to
3:22:57live exceeded from the second device
3:22:59along the path and all the way up until
3:23:01we finally get to the system that we are
3:23:04trying to communicate with on the other
3:23:06end. So let me set a filter type here of
3:23:09ICMP again. And you can see all of the
3:23:10time to live exceeded. Then at the very
3:23:13end, what I'm getting is destination
3:23:16unreachable, port unreachable. And
3:23:18that's because we're trying to
3:23:20communicate with a port that doesn't
3:23:22actually exist or isn't open on the
3:23:25destination system. So trace route
3:23:28relies on the ICMP destination
3:23:31unreachable message in order to figure
3:23:34out that we're finally at our
3:23:36destination. So we get that destination
3:23:39unreachable message. Trace route says
3:23:41yes, I'm done. That may be a port
3:23:44unreachable. It may be a host
3:23:46unreachable. So if the host doesn't
3:23:49actually exist, I may get a host
3:23:50unreachable message from a device next
3:23:54up in the chain. But the port
3:23:56unreachable message here that I can see
3:23:58and let me close down IP and we can take
3:24:01a look at the ICMP message. We get a
3:24:04destination unreachable for the type and
3:24:06the code is port unreachable. That port
3:24:09unreachable tells me that I got to the
3:24:12system. It's just that the port I was
3:24:14trying to send a message to doesn't
3:24:16actually exist. This is a handful of the
3:24:19messages that you will see. And these
3:24:23are pretty common ones. these time to
3:24:25live exceeded and destination
3:24:27unreachable whether it's port
3:24:29unreachable or host unreachable these
3:24:31are pretty common ICMP error messages
3:24:34and as I said this is really how trace
3:24:37route works it's designed around the
3:24:39idea that these ICMP messages are going
3:24:42to come back so we're going to set the
3:24:45time to live really low and then
3:24:47increment it so we can figure out all of
3:24:50the steps along the way so when I get
3:24:52this time to live exceeded The device
3:24:54that I get the time to live exceeded
3:24:56from is that next hop. So we can see
3:25:00this comes from 64.223.94.1.
3:25:04So I know that that's the next hop after
3:25:07192.168.1.1
3:25:10which was the first hop that I got time
3:25:12to live exceeded. So I got a time to
3:25:14live exceeded. That tells me that's the
3:25:16next router along the path because it
3:25:19decremented the time to live, got it to
3:25:21zero, and it's sending me this ICMP
3:25:24error message back. Lots of different
3:25:26types of MP error messages. These are
3:25:29pretty common ones. And as I said, there
3:25:31are utilities like trace route that are
3:25:34just designed around these ICMP error
3:25:37messages because we know how they work
3:25:40and they're pretty predictable in when
3:25:42we can get those error messages and how
3:25:44we can trigger them.
3:25:48In this lesson, we're going to be
3:25:49talking about ICMP attacks. So, what's
3:25:52an ICMP attack? An ICMP attack is a
3:25:56packet that's designed to do something
3:25:58bad to a particular system. And the
3:26:02protocol that we are using is ICMP. So
3:26:05there's a couple of different ways of
3:26:07doing attacks using MP. If I just use
3:26:11ping, which is going to be a pretty
3:26:13common way of performing ICMP attacks,
3:26:16although we could use packet crafting
3:26:18tools, ping is pretty easy. It's pretty
3:26:21reliable. I could do this for example.
3:26:26I could send a ping with a really large
3:26:30bite count. If a large number of people
3:26:33were to send these ping messages, then
3:26:36we could overwhelm the system that we
3:26:39are sending all these messages to
3:26:40because what we're doing is we're
3:26:42sending a lot of data at that system. If
3:26:45we were to go back to Wireshark and get
3:26:49a capture going here just so we can see
3:26:51these messages.
3:26:55So we got a few of these messages now
3:26:57and we can go back to Wireshark.
3:27:00Stop capture and we'll take a look at
3:27:04ICMP. Now one of the nice things about
3:27:07ICMP is there's no actual verification
3:27:10of who is sending the message. So what I
3:27:13could do would be to have a program that
3:27:18spoofed or altered this source address.
3:27:21So it wasn't me, it was somebody else.
3:27:24And then what I could do would be to
3:27:27send a large message to a particular
3:27:30destination. And let's say the source
3:27:33that I was pretending to be didn't have
3:27:35a lot of bandwidth, but the destination
3:27:38did have a lot of bandwidth. And so I
3:27:40was sending a lot of messages out
3:27:42pretending to be somebody who didn't
3:27:44have a lot of bandwidth and sending them
3:27:47to this other device that did have a lot
3:27:49of bandwidth and I could get replies to
3:27:52go back to the source that I was
3:27:54pretending to be. And if I set large
3:27:57packet sizes as I did here and several
3:28:00of us did it, I could potentially
3:28:02overwhelm this source address.
3:28:05That sounds kind of complicated. So
3:28:08there's actually another way of doing
3:28:10that. So I could actually do something
3:28:12like this. In this case, I am pinging
3:28:15the broadcast address. So you can see
3:28:18here once I cancel this, you can see I'm
3:28:21getting several messages back. So I'm
3:28:24getting messages back from basically all
3:28:26of the devices on a network. This type
3:28:30of attack is most useful if I can spoof
3:28:33the source address. I could get a lot of
3:28:37systems replying to you for example
3:28:41rather than me. So I send out a couple
3:28:44of messages and you get a large number
3:28:46back. Now this particular type of attack
3:28:48is called a smurf attack. It's what we
3:28:51sometimes call an ICMP broadcast
3:28:53amplifier. So I could send messages to a
3:28:56broadcast address and get a large number
3:28:59of messages back. If the network
3:29:02happened to be really large, I'm going
3:29:03to get a lot of messages back. And if I
3:29:06set the packet size really large on top
3:29:08of it, I'm going to get a lot of really
3:29:10large messages. So, that's a pretty good
3:29:13way of overwhelming systems. And it was
3:29:16pretty common a dozen years or so ago.
3:29:19And we have since more or less defeated
3:29:22this particular type of attack because
3:29:24most of the devices and systems on the
3:29:28internet now have configuration that
3:29:31prevents this sort of thing from
3:29:32happening. So generally you wouldn't
3:29:35reply to a broadcast message that came
3:29:39from a system not on your network. So,
3:29:42in this case, I'm actually sending
3:29:44messages to systems on my network.
3:29:46They're replying. If I were to try to do
3:29:49this to a network that wasn't actually
3:29:53local to me. For example, if I did this,
3:29:57I'm not actually going to get anything
3:29:59back. And that's because the devices on
3:30:01the internet and the routers are all
3:30:04really set to block this sort of message
3:30:06or at least ignore it and not reply to
3:30:08it. These are some of the types of
3:30:10things you can use ICMP for to do
3:30:14attacks. And it's some of the types of
3:30:16things that you may see from time to
3:30:18time in people attempting to attack you
3:30:20is you may see ICMP used in this
3:30:23particular way.
3:30:27In this lesson, we're going to be
3:30:28talking about uses of the transport
3:30:30layer. What's the transport layer used
3:30:32for? Well, primarily the transport layer
3:30:34is used for multipplexing. Now, what do
3:30:37I mean by multipplexing? If we've got a
3:30:40logical address, which would be the IP
3:30:42address, and that's at the IP layer or
3:30:45the network layer if we're talking about
3:30:46the OSI model. If I want to communicate
3:30:49with you, I am going to send a
3:30:51communication to that IP address. Now,
3:30:55how are you going to differentiate who
3:30:58you are talking to for any given
3:31:01application? So let's say I want to use
3:31:04web services and email services. How are
3:31:08you going to differentiate whether I am
3:31:10trying to do a web service or an email
3:31:13service to you? Well, that's where we
3:31:16get into multipplexing. By
3:31:17multipplexing, we are talking about
3:31:20being able to do multiple things over
3:31:22the same logical address. So we do that
3:31:26through the use of ports. Now you can
3:31:28see here a source port and a destination
3:31:31port. I happen to be looking at a TCP
3:31:33packet here. UDP is the same thing. I
3:31:37can show you UDP packets out of this
3:31:39capture
3:31:41and we can take a look at the source and
3:31:43the destination port there. What we're
3:31:46talking about is ports and the ports
3:31:49give us the ability to have multiple
3:31:52applications communicating at the same
3:31:54time. That's what I mean by
3:31:56multipplexing. The other thing that the
3:31:59transport layer is good for is it's good
3:32:02for doing end-to-end communications. End
3:32:05toend communication means that in the
3:32:08case of TCP for example, TCP is a
3:32:11reliable protocol and it's
3:32:13connectionoriented. So TCP handles
3:32:16setting up and tearing down the
3:32:17connection. It handles doing
3:32:19retransmits. In the case of UDP, it's
3:32:22unreliable. So we don't need to worry so
3:32:25much about doing retransmits. But there
3:32:28is a little bit of validity checking
3:32:30because there's a check sum. The
3:32:32transport layer handles the endtoend
3:32:35communication and that also includes
3:32:39making sure that the application gets
3:32:42the message that it is supposed to be
3:32:44getting to the best degree possible that
3:32:47we can. getting the message all the way
3:32:50to the other end and communicated to the
3:32:52correct port which would be mapped to
3:32:54the correct application on the receiving
3:32:57side.
3:33:00In this lesson, we're going to be
3:33:01talking about the TCP headers. So much
3:33:04like IP that has a set of headers, TCP
3:33:07also has a set of headers that serve
3:33:09different functions more specific to the
3:33:11needs of the transmission control
3:33:14protocol or TCP. So let's take a look at
3:33:17these headers. Starting off at the very
3:33:20top, we've got a source port here. And
3:33:22again, like always with Wireshark, when
3:33:25I select a particular field from the
3:33:28packet or the datagramgram, then I'm
3:33:31going to see the bytes highlighted in
3:33:34the raw output at the bottom here. So
3:33:36you can see I've highlighted the source
3:33:39port and we can see the two bytes here
3:33:42that are used for the source port. So in
3:33:45this case we've got a source port of
3:33:4650,443.
3:33:49Our destination port is 443.
3:33:53In this case Wireark has done the nice
3:33:56thing of indicating that that's HTTPS
3:34:00which is secure HTTP. Now the next thing
3:34:03that we've got is we've got a sequence
3:34:06number. And the sequence number is used
3:34:09for a couple of things. If the sin bit
3:34:11or the synchronized bit is set, this is
3:34:14the initial sequence number. Otherwise,
3:34:17this is just the sequence number that
3:34:20has to do with getting the packets in
3:34:24the right order when they get to the
3:34:26destination. So, the sequence number is
3:34:28going to be about getting the packets
3:34:32sequenced, of course. So I get packets 1
3:34:362 3 4 for example. If they arrive 2 4 3
3:34:401 then the receiving end can put them
3:34:43back into the correct order based on the
3:34:45sequence number. So acknowledgements
3:34:48when they are received are actually to a
3:34:50particular sequence number so that the
3:34:53sending end can say yes I sent this
3:34:56packet with this particular sequence
3:34:58number and I've received an
3:35:00acknowledgement for that particular
3:35:01sequence number. Therefore, I know that
3:35:03that packet was received at the other
3:35:06end. I don't have to worry about sending
3:35:07it again. That's what the sequence
3:35:09number is used for. As I mentioned, the
3:35:12acknowledgement number is used to
3:35:15acknowledge a particular sequence
3:35:17number. And if the act bit is set, then
3:35:22the acknowledgement number is the next
3:35:24sequence number expected. The sequence
3:35:27number and the acknowledgement number
3:35:29are really tied together in terms of
3:35:32making sure that packets get from point
3:35:35A to point B and we can make sure that
3:35:38they've been received and we just check
3:35:40them off saying yes it was sent and yes
3:35:43the other side received it. The next
3:35:45field here is a header length and
3:35:48sometimes that's called the data offset
3:35:50meaning the data offset is the offset
3:35:53within the packet where the data starts.
3:35:55But this is really the size of the TCP
3:35:58header and this is in 32bit words. So we
3:36:02can see here the value is B 0. That
3:36:07tells us that we've got 44 bytes that
3:36:10are being used for the header. So the
3:36:14header length is 44 bytes. The next
3:36:17thing that we've got is the flags. And
3:36:20there are a number of flags. The really
3:36:23important ones that we're going to be
3:36:24talking about has to do with really the
3:36:27ones below this urgent flag here. This
3:36:31one is reserved. The non and congestion
3:36:34window and ECN you'll see used less
3:36:37likely, but these others tend to be
3:36:39pretty important. The urgent flag has to
3:36:43do with urgent data. Urgent data would
3:36:46get received more quickly. As mentioned
3:36:49previously, the acknowledgement flag
3:36:52says, "Yes, I'm acknowledging something
3:36:54that you have sent." The push flag is
3:36:58about making sure that whatever data is
3:37:01received is pushed directly up to the
3:37:03application. It's not left sitting in a
3:37:05buffer. So if you set the push flag, the
3:37:07buffer is going to immediately get
3:37:10cleared and sent off to the application
3:37:12rather than just sitting there
3:37:14accumulating until the application may
3:37:17come to get the buffer or whether we're
3:37:20waiting until a certain number of bytes
3:37:22are read before we send the buffer up to
3:37:24the application. The push flag really
3:37:26makes sure that the data gets sent up
3:37:30immediately. The reset flag has to do
3:37:33with resetting connections. And if we
3:37:36get a message, for example, that we're
3:37:39not expecting, we would reply to it with
3:37:41a reset. The synchronize flag has to do
3:37:44with initializing connections. So I
3:37:48would send a message with a synchronize
3:37:50flag set if I wanted to start a
3:37:53connection with another endpoint. Now,
3:37:56the synchronized flag is really tied in
3:37:58very closely with the three-way
3:38:00handshake that is particular to TCP, and
3:38:04we'll talk about the three-way handshake
3:38:06in a subsequent lesson, but that's what
3:38:08the synchronize flag is for. Now, the
3:38:11FIN flag is kind of the opposite of the
3:38:13synchronized flag. The FIN flag has to
3:38:16do with ending connections. So, FIN for
3:38:20finish. So, we're closing a connection
3:38:22if we're using the FIN flag. Now we have
3:38:25a window size value and the window size
3:38:29is really the number of bytes that can
3:38:32be sent out without receiving an
3:38:34acknowledgement back. So I could send
3:38:3865,000 bytes in data without getting an
3:38:42acknowledgement back, which allows me to
3:38:44go pretty quickly. So, I can just throw
3:38:46a bunch of data out onto the wire and
3:38:48just keep sending it up until either I
3:38:50get an acknowledgement, in which case I
3:38:52can send some more, or I hit this window
3:38:55size, meaning I would stop and wait for
3:38:57an acknowledgement. And if I didn't get
3:38:59an acknowledgement within a certain time
3:39:00period, I'd start doing retransmits.
3:39:03So, now I have the checksum field, and
3:39:06the checksum is pretty much what it
3:39:08says. The checksum is just the checksum
3:39:12of the header here. The checksum says
3:39:15either something's been altered or
3:39:17nothing's been altered based on the
3:39:19calculation of the checksum value. Then
3:39:22we have a series of options here. We've
3:39:25got maximum segment size, a few no
3:39:28operations, window scale, timestamps,
3:39:31TCP sack permitted, and end of option
3:39:34list. So these are all options and
3:39:36frankly they're optional to the
3:39:38messages. The primary TCP headers are
3:39:41the ones that are above the options and
3:39:44those are the ones you're going to see
3:39:45in every packet. So that's the set of
3:39:49headers and the uses for those different
3:39:52headers and what they all mean. And as I
3:39:55said, you're going to see those headers
3:39:57in any TCP packet. Just based on this,
3:40:00you would be able to decipher what's
3:40:02going on with this particular message
3:40:05and where it is in a particular
3:40:08communication stream based on how these
3:40:10different header fields are set.
3:40:15In this lesson, we're going to be
3:40:16talking about the TCP handshake. Now,
3:40:19the TCP handshake is really critical to
3:40:22the functioning of TCP. It's the
3:40:26protocol for establishing a connection
3:40:28between two systems. And that connection
3:40:32is really important from a TCP
3:40:34perspective because without that
3:40:37connection, then I wouldn't be
3:40:39communicating with you because I can't
3:40:41guarantee that you're actually there to
3:40:43receive messages. While I was talking, I
3:40:46was just setting up a packet capture so
3:40:49that I've got a good clear three-way
3:40:51handshake. So, I just went out to a
3:40:53website because I know that website
3:40:55traffic is HTTP and HTTP uses TCP as its
3:41:00transport protocol. In order to get to
3:41:03that web server, I know that I'm going
3:41:05to do a three-way handshake. We're going
3:41:08to be looking for some traffic here. And
3:41:11here's the beginning of that. So, I've
3:41:14got a SIN message. So, I've got my TCP
3:41:17portion, and we can see the destination
3:41:19port is 80. And so that's the web
3:41:22traffic. And my source port is just a
3:41:24random port that's been chosen and
3:41:26assigned to this particular request. So
3:41:29the important thing here is the flags.
3:41:32And you can see the sin flag set. And my
3:41:35window size here is 65535.
3:41:38So that's the first message. The first
3:41:40message in a three-way handshake is a
3:41:43synchronized message. And so if we're
3:41:45talking about point A and point B, point
3:41:48A sends out a synchronize message to
3:41:50point B that says I want to start
3:41:52communicating with you. Now the next
3:41:55message that gets sent is the sin act.
3:41:58So the synchronize flag is set and the
3:42:01acknowledgement flag is set. And what
3:42:04that says is I received your synchronize
3:42:07message. So, I'm acknowledging your
3:42:09synchronize message and I am here to
3:42:12continue this communication. Now, we
3:42:15could stop here except the problem is
3:42:18that point B doesn't know whether point
3:42:21A is being spoofed or if maybe it
3:42:24dropped offline or something else
3:42:26happened to it. And so, what we need to
3:42:28do now is have point A right here send
3:42:32back an acknowledgement. So, that's the
3:42:34three-way handshake. The three-way
3:42:37handshake is point A saying, "Hi, I'm
3:42:40here. I want to talk to you." Point B
3:42:42saying, "Hi, I'm here. I'm okay to talk
3:42:45back." So now point A knows that point B
3:42:49is there and ready to talk. But point B
3:42:52still isn't completely sure about point
3:42:54A. So point B sends back this
3:42:58synchronize acknowledgement or sin act
3:43:00and then waits for point A to send back
3:43:03just an act saying, "Yep, I got it. I'm
3:43:06good. Now we can communicate." So that's
3:43:10the three-way handshake. As I said, it's
3:43:11really important because what it does is
3:43:14set up the reliability of the
3:43:16communication between point A and point
3:43:18B because point A now knows that point B
3:43:21is there and vice versa. and they've
3:43:24established a window size. Right here,
3:43:27we've got an 8242 for a window size
3:43:30based on the adjusted values from the
3:43:35communication that's been going on. And
3:43:37we'll talk a little bit more about
3:43:39window sizes and the sliding window in a
3:43:41subsequent lesson. But there's a little
3:43:43bit of negotiation that goes on here. Of
3:43:46course, once I've set up the
3:43:48communication, then I can issue my HTTP
3:43:51request. But I've got to do this
3:43:53three-way handshake here in order to
3:43:55satisfy the requirements of TCP that
3:43:58I've got a reliable connection and that
3:44:00I know the messages are going to go
3:44:01through and I've got my initial sequence
3:44:04numbers set up so that I can now make
3:44:07sure that I get packets in the right
3:44:09order. I can acknowledge packets. I can
3:44:11do all of that stuff. We've got the
3:44:13connection set up. We are started down
3:44:16the road of being able to manage the
3:44:18flow control, all of that. The TCP 3-way
3:44:22handshake is really important and it's
3:44:25really important to understand how it
3:44:27works and being able to see it here in
3:44:30Wireshark really hopefully will help
3:44:32demonstrate to you what's going on.
3:44:37In this lesson, we're going to be
3:44:38talking about acknowledgements.
3:44:40Acknowledgements is really a
3:44:42conversation about flow control and
3:44:44reliability because acknowledgements are
3:44:47all about ensuring that the data that is
3:44:50sent gets there in a timely fashion and
3:44:53not only in a timely fashion but in the
3:44:56correct order. I've got a packet capture
3:44:59that we actually used in the three-way
3:45:01handshake conversation and it's a good
3:45:04one to take a look at acknowledgements.
3:45:06So I've got an HTTP get request. You can
3:45:10see above here, this is the end of the
3:45:12three-way handshake in packets 66 and
3:45:1567. That's the second and third stage of
3:45:18the three-way handshake. Now I've got
3:45:21the three-way handshake out of the way.
3:45:22I can do a request for the protocol that
3:45:26I'm using, in this case, HTTP. So, I can
3:45:29do my get request here. What I want to
3:45:31do is take a look at the sequence
3:45:34number. You can see I'm sending a
3:45:36message from source A to destination B
3:45:40and I'm setting my sequence number of
3:45:43one. In this case, the next message
3:45:46happens to be an acknowledgement and the
3:45:48acknowledgement should be to sequence
3:45:50number one. So I'm acknowledging
3:45:53sequence number one. I've acknowledged
3:45:56this packet. Now what I'm sending is
3:46:00another reply but this is actually sort
3:46:03of a new stream. And so this is a
3:46:06sequence number and it's saying the
3:46:08acknowledgement number meaning in this
3:46:10case the next sequence number should be
3:46:121110.
3:46:16So here's my acknowledgement from here
3:46:19and it's saying my sequence number is
3:46:221110. And so I have acknowledged
3:46:25sequence 1110. At this point, we start
3:46:28getting into some TLS communications,
3:46:31which is encrypted. So we're starting up
3:46:34a whole new stream here with some TLS
3:46:38connections. But we still ought to be
3:46:39able to see additional acts to sequence
3:46:43numbers. So again, you can see here
3:46:45there's an acknowledgement message and
3:46:48we've got the sequence number of 3106
3:46:51and acknowledgement number of 9989.
3:46:55A sequence number is used to acknowledge
3:46:59a particular sequence number that was
3:47:01set previously and we do that using the
3:47:04acknowledgement flag. we send an
3:47:07acknowledgement back saying, "Yes, I got
3:47:10the packet that was sent using sequence
3:47:13number 3106."
3:47:16So, we could actually go back through
3:47:19here and find 3106
3:47:22and we should be able to find the
3:47:25origination of that particular message.
3:47:293106 is the acknowledgement number and
3:47:32we did find the act 23106
3:47:36right down here. So you can see that we
3:47:39go back and forth between sequence
3:47:41number and acknowledgement number and
3:47:42the acknowledgements are really
3:47:44important because they help the sender
3:47:47determine whether a message has been
3:47:49received or not. If I don't get an
3:47:51acknowledgement to a particular sequence
3:47:53number, I don't know whether that packet
3:47:55has been received. And so within some
3:47:58period of time I would need to do a
3:48:00retransmit to make sure that that data
3:48:02does get there. That sequence number and
3:48:05acknowledgement number are really
3:48:07important from a flow control
3:48:08perspective because they ensure that the
3:48:11data gets from point A to point B and
3:48:14has been acknowledged as being received
3:48:17so we can continue moving on and
3:48:19continuing sending more data. So that's
3:48:22how acknowledgements work.
3:48:24Acknowledgements, as I said, are really
3:48:26important to ensuring that all of the
3:48:29message has been sent and received and
3:48:32there's no miscommunication in between
3:48:35the sender and the receiver and that we
3:48:38get to a place where all of the data is
3:48:42good on both sides.
3:48:45In this lesson, we're going to be
3:48:47talking about the sliding window. A
3:48:49sliding window is really just a chunk of
3:48:53bytes that slides over the stream of the
3:48:57data that's being sent. And I've
3:49:00actually got a packet capture up here.
3:49:01We can take a quick look at some window
3:49:03sizes. Right here, we get a window size
3:49:05of 222 bytes. So that's the number of
3:49:09bytes that are going to be allowed to be
3:49:11transmitted without actually receiving
3:49:14an acknowledgement. We've got this chunk
3:49:17of bytes and let's say we've got 4,000
3:49:20bytes for example. That 222 is the
3:49:23window of bytes that can be kind of up
3:49:27in the air until we get acknowledgement
3:49:29for the bytes that have been sent. We
3:49:32can't actually slide the window over the
3:49:35remaining bytes that need to be sent. So
3:49:38let's take another look at this. Let's
3:49:40say that these chunks right here are
3:49:42bytes. So this is my first bite, my
3:49:45second bite, my third bite, and so on.
3:49:48And let's say we've got a window of
3:49:51eight. So I'm going to send those eight
3:49:54bytes out. Let's say that we actually
3:49:57get acknowledgments back to these four
3:50:01bytes. Now, this is my window here. And
3:50:04until I get an acknowledgement back on
3:50:06this first bite, I can't actually slide
3:50:09the window along. Now once I get
3:50:12acknowledgements back, let's say I get
3:50:14acknowledgements from the first three
3:50:16bytes. Now I can actually slide the
3:50:19window over the remaining bytes.
3:50:23So now my window of eight bytes has slid
3:50:26over. This is actually my sliding
3:50:29window. The window is the opening that
3:50:32we've got in the stream of data. And
3:50:36that opening is only so many bytes wide.
3:50:40And that window slides along as we
3:50:44receive acknowledgements to the earliest
3:50:47bytes in the window. We continue to
3:50:50receive acknowledgements. And now we can
3:50:52continue to slide the window along. So
3:50:57now here's my window over the next
3:50:59section of bytes. And we continue to
3:51:01receive acknowledgements and we can
3:51:03continue sliding that window along.
3:51:07That's what the sliding window is. And
3:51:10it has to do with this window size here,
3:51:13which tells me how big that window is.
3:51:16And in this case, it's 222 bytes. At
3:51:19different times, we may set it to
3:51:21different values. And of course, there
3:51:23are going to be different values on
3:51:25either end of the conversation. So,
3:51:27we've got A and B. Let's say the window
3:51:29size from A to B is 222 bytes and from B
3:51:33to A is 8,242
3:51:36bytes. We could have different windows
3:51:38in different directions. We would have
3:51:41to have this sequence number and
3:51:43acknowledgement number used in order to
3:51:46slide the window along because remember
3:51:48we're using the sequence number to
3:51:50determine where in the stream we are at
3:51:53any given point. And the acknowledgement
3:51:55number says I actually received a
3:51:58communication from you with this
3:52:00particular sequence number. So then we
3:52:02can just tick those bytes off saying
3:52:04we've acknowledged those bytes and then
3:52:06we can slide that window along. Remember
3:52:09we were doing the sliding window over
3:52:11here. So that's how the sliding window
3:52:15works. Hopefully, it's a little bit
3:52:17better of a visual representation of the
3:52:21sequence number and acknowledgement
3:52:22number working hand in hand in order to
3:52:25make sure that we're transmitting data
3:52:28in a way that is reliable and we can
3:52:32verify that not only it got there, but
3:52:34it got there in one piece and we've
3:52:36acknowledged that it actually got there.
3:52:39So, the sliding window again has to do
3:52:41with making sure that we're in the right
3:52:43place in the stream of data and that
3:52:47we're getting acknowledgments all along
3:52:49the way. And then we slide the window
3:52:51along based on the acknowledgements that
3:52:54we've actually received.
3:52:58In this lesson, we're going to be
3:52:59talking about session tearown. This is
3:53:01actually the flip side of the coin to
3:53:04the three-way handshake that was
3:53:06described in a previous lesson. The
3:53:08session tearown has to do with making
3:53:11sure that both ends of the communication
3:53:14stream realize that the other end is
3:53:16going away or is not going to be
3:53:18transmitting any longer. Now the
3:53:20interesting thing about this is that
3:53:22while one side may originate the
3:53:25communication once that communication is
3:53:27up it's really birectional and it's not
3:53:30always just a case of point A sends a
3:53:33message and point B sends a response
3:53:35back. There could be messages
3:53:37originating from both sides and
3:53:40responses going back and forth. So it's
3:53:42really a birectional communication
3:53:44stream. What we need to do then is make
3:53:48sure that both sides realize they need
3:53:51to stop sending. And it's not just a
3:53:53question of the originator stops sending
3:53:56requests and then sends the session
3:53:58tearown because the other side may
3:54:00actually be trying to originate
3:54:02something as well. So both sides really
3:54:05need to tear this down. Let's take a
3:54:08look at a TCP session here. So we're
3:54:11going to follow this particular TCP
3:54:13stream. And I've got the messages here.
3:54:17The tearown is right here. We've got the
3:54:22originator here 192.168.1.22
3:54:26sending to the receiver 173.194.75.105.
3:54:31It's sending a fin and an a. So I'm
3:54:35saying tear down the communication from
3:54:38my side and the other side responds with
3:54:42a fin and an act as well saying yep, got
3:54:45it. We're going to tear the session
3:54:46down. That's how we would tear a session
3:54:49down by using the fin method. And the
3:54:52other side would need to reply. So we
3:54:55know that both sides have actually done
3:54:57a fin. Otherwise, one side could do this
3:55:00fin to close their side of the stream.
3:55:03But if the other end doesn't do the
3:55:06same, then we're not really sure what
3:55:08state the connection is in. Because, as
3:55:10I said, it's really birectional, meaning
3:55:13both sides can originate communications
3:55:16rather than just being a receiver and
3:55:19responder or a sender. Both sides can be
3:55:22a sender or a receiver and responder.
3:55:26Because of that, we really need to tear
3:55:27down from both ends. And that, as I
3:55:30said, you can see happening here. We're
3:55:32tearing down one side and then we're
3:55:34tearing down the other side there.
3:55:37That's what a session tear down looks
3:55:39like. We do a FIN message and it's got
3:55:42to be acknowledged with a FIN message on
3:55:46the other side in order to ensure that
3:55:48both sides have actually torn the
3:55:50connection down and we could be sure
3:55:52that there's no more communication that
3:55:55will be arriving.
3:55:58In this lesson, we're going to be
3:55:59talking about TCP states. TCP is a
3:56:03connectionoriented protocol. And because
3:56:05of that, and because we have this
3:56:07three-way handshake that's used to
3:56:10establish those connections, we end up
3:56:13with a set of states based on where the
3:56:17connection is in process. So, we're
3:56:20going to use a utility called netstat in
3:56:23order to take a look at some of the
3:56:25states of the TCP connections that we've
3:56:28got on this particular system. The first
3:56:30one I want to show you is listen. Now
3:56:34I'm looking at the ports that are
3:56:37listening and what that means is an
3:56:40application has bound itself to a
3:56:42particular port and it's listening for
3:56:45connections which means in TCP language
3:56:49it's awaiting a sin packet from a client
3:56:54system. So we've got some servers here.
3:56:57For example, here's a web server. You
3:57:00can see it's listening on the HTTP port
3:57:03and it's waiting for a SIN message from
3:57:07a client. Those are listen states and
3:57:10you can see I've got a number of servers
3:57:12here that are listening. Now, there are
3:57:15other states as well. These are streams
3:57:18which are not the same as the sockets
3:57:21that we're really talking about with
3:57:23TCP. This is all local. So connected
3:57:26isn't really a state. This is something
3:57:28else. Here's where we've got a
3:57:30connection that has gone through the
3:57:32three-way handshake. Because we've gone
3:57:35through the three-way handshake and
3:57:38we've established a connection, we have
3:57:41an established state. Now, here's
3:57:43another state and that's close wait.
3:57:47That's where we've attempted to start
3:57:50closing the connection. So, one side or
3:57:53the other has sent out the fin message.
3:57:57That's part of the close cycle, but
3:58:00we're in a state where one side has
3:58:03closed, but the other side hasn't
3:58:05closed. So, we're waiting for the close
3:58:08to actually complete. That's a couple of
3:58:11states that I can show you here on this
3:58:14system. There are several other states
3:58:17that TCP can be in. We can just take a
3:58:20look through some of these others. The
3:58:23states that are listed here are listed
3:58:26based on the side of the connection that
3:58:28you're at. Of course, the listen side is
3:58:31a server only state. So only the server
3:58:35can listen because that's the side of
3:58:37the connection where the application is
3:58:40that is bound to a particular port. So
3:58:42that's the side that listens. Now the
3:58:45client side is going to send a sin and
3:58:49so we'll be in a sin sent state. Once
3:58:52the server has received that sin message
3:58:55will be in a sin received state. Now
3:58:59this sin sent sin received state can be
3:59:02in something that's called halfopen. The
3:59:05server will be in a halfopen state once
3:59:08the sin has been received and the sin
3:59:11act has been sent. Until that final act
3:59:14is received, we're really in a halfopen
3:59:16state because we haven't completed the
3:59:19connection. So that we've got an
3:59:21established connection. We are not
3:59:24really open at this point. So we're half
3:59:26open. Once the sin, the sin act and the
3:59:30act have been sent and received and the
3:59:33three-way handshake has been completed,
3:59:35we are in an established state. We also
3:59:39have fineight one and fin two which has
3:59:42to do with whether we have sent a fin
3:59:45and haven't received it or not. We could
3:59:47be in close wait which means that we are
3:59:50waiting for the connection termination
3:59:53from the local user and we could also be
3:59:57in a closing state where we are waiting
4:00:00for a termination request
4:00:02acknowledgement from the other side. So
4:00:05we've sent a FIN and we're waiting for
4:00:06the acknowledgement. We also have time
4:00:09wait and we have closed. Now closed
4:00:13obviously means there's nothing
4:00:15listening. there's no communication on
4:00:18that particular port at all. These are
4:00:21the various states that we can find TCP
4:00:25connections in. As I said, if you just
4:00:28use netstat here, you can see different
4:00:32connections in different states. Right
4:00:35now, we just have a couple of
4:00:37connections that are in established
4:00:40states, and we've got one in a close
4:00:42weight. And I can show you again the
4:00:46ones that are in a listening state.
4:00:50That's some of the states that you'll
4:00:52find TCP in. And the utility that you
4:00:56can use both on Linux and on Windows is
4:00:59netstat. And netstat will show you the
4:01:01network status, including all of the
4:01:05connections that you may have. And it's
4:01:08a good way actually of seeing the
4:01:10communication that's going on on your
4:01:12system to other systems that are around.
4:01:19In this lesson, we're going to be
4:01:20talking about port behavior. Port
4:01:22behavior is how a particular port
4:01:25responds based on whether there is an
4:01:28application listening on that port or
4:01:30not. I'm going to demonstrate three
4:01:33different scenarios here. or one of
4:01:35which is going to be where there is an
4:01:37application listening on a particular
4:01:39port and one of them is going to be
4:01:42where there isn't an application
4:01:44listening and a third one is going to be
4:01:48where I am doing some firewall
4:01:51manipulations to cause the traffic to
4:01:54behave in a particular way.
4:01:57So I'm going to use a utility called end
4:02:00mapap. NMAP is a port scanner and it's
4:02:03going to allow me to send packets to
4:02:06determine whether ports are open or not.
4:02:10I'm going to check three different
4:02:12ports. Port 3, port 80, and port 5555.
4:02:18And I'm going to check that on
4:02:19192.168.1.39,
4:02:22which is a system that's on my local
4:02:25network. So, we're running the port scan
4:02:29and we've got one port that's closed,
4:02:32one port that's open, and one port
4:02:35that's filtered. What's the difference
4:02:37between those three scenarios here? And
4:02:40what do the packets actually look like
4:02:43that come from end map? If I do a filter
4:02:47here just to see the packets that are
4:02:50going to that particular system, I'm
4:02:53going to see a packet here that is going
4:02:57to port 80. And so here we get the SIN
4:03:02message going out to port 80. Here we
4:03:05get the SIN message going out to port
4:03:085555.
4:03:10And here we get the SIN message going
4:03:12out to port 3. So, port 80, I get the
4:03:16sin act back and then I send the act in
4:03:20reply. So, I've got the three-way
4:03:22handshake. Now, I've got a connection
4:03:25open and that's on the open port. So,
4:03:29here I actually am going to just reset
4:03:32the connection and just forget about it.
4:03:35So, what I'm doing is really just
4:03:37closing the connection because what
4:03:39we're saying here is we didn't really
4:03:40mean to open it. We do some more
4:03:44messages out to port 5555.
4:03:49And since we don't get anything back, we
4:03:52are going to say that the port is
4:03:55actually filtered because the correct
4:03:58behavior would be to get a reset back
4:04:02from the server. The system 1.39
4:04:06should actually be sending us a reset
4:04:09back on port three, which is our closed
4:04:13port. So I'm going to filter based on
4:04:17port three. So if I set up a capture
4:04:20filter here, I'm going to say TCP port
4:04:23equals 3. And you can see where I send
4:04:26the sin message out on port 3. Here I
4:04:30get the reset back from the server
4:04:33saying there's nothing actually at this
4:04:36port so don't bother continuing. That's
4:04:39what happens when you've got a closed
4:04:41port. You'll get a reset back.
4:04:45And if we go back here, you'll see port
4:04:483 showed as closed. So port 55555
4:04:53shows as filtered because we have a
4:04:57situation where we sent multiple SIN
4:04:59messages in order to establish a
4:05:02connection to that particular TCP port
4:05:04and we never got a response back. The
4:05:07RFC specifies that if the port is
4:05:10closed, the system should send a reset
4:05:13back to indicate that the port is
4:05:15closed. Sometimes we don't actually
4:05:18prefer that behavior because maybe we
4:05:21want the system to appear not to be
4:05:24there. Or maybe we want to cause
4:05:27adversaries to slow their progress down
4:05:30as they are engaging in reconnaissance
4:05:34activities. If I've got to send multiple
4:05:37SIN messages and wait for replies and
4:05:40I'm doing this on multiple ports, I'm
4:05:43going to take a long time to do scans.
4:05:47That may be another reason why you set a
4:05:50firewall to respond in a manner where
4:05:53packets actually get dropped rather than
4:05:56responded to appropriately. So, we can
4:05:59see three different states where we've
4:06:02got open, closed, and filtered. And the
4:06:05way that the systems reply with an open
4:06:09port, we get the three-way handshake.
4:06:12With a closed port, we get a reset back.
4:06:15And with a filtered port, what happens
4:06:18is the initial message just gets
4:06:21dropped. And so no response is actually
4:06:23generated and returned. That's the
4:06:27different messages that you'll see
4:06:29happen based on the state of the TCP
4:06:33ports that you're trying to connect to.
4:06:38In this lesson, we're going to be
4:06:39talking about uses of UDP. UDP is a user
4:06:43datagramgram protocol. And the user data
4:06:46grand protocol is used for things that
4:06:49really just need speed and aren't
4:06:52concerned so much with whether messages
4:06:55get to the destination and whether they
4:06:58arrive there in the correct sequence or
4:07:00not. UDP is really all about getting
4:07:02something out onto the wire really fast
4:07:04and not really worrying so much about
4:07:06whether it gets there. some uses of UDP
4:07:10here. For example, we've got a DNS
4:07:13packet. And of course, we'll get into
4:07:15DNS in subsequent lessons, but DNS is
4:07:17how we do lookups of names from the name
4:07:21to an IP address or vice versa. So with
4:07:24a DNS lookup, I'm really looking for
4:07:26speed because if I have to do a DNS
4:07:29lookup, then I really want the name to
4:07:32come back quickly or the IP address to
4:07:34come back quickly so that I can continue
4:07:37doing the actual work, which is sending
4:07:40the request to the correct IP address. I
4:07:43need to do that really fast and I don't
4:07:45worry so much about whether it actually
4:07:47gets there. And I'm really not going to
4:07:49be worried about sequencing because DNS
4:07:51requests and replies are small enough
4:07:53that they're going to fit inside one
4:07:56datagramgram. I really want to get it
4:07:58out quickly. If I don't get a response
4:08:00fast enough, then I'm going to send out
4:08:02another request to another DNS server.
4:08:04And in the meantime, if the other server
4:08:06gets back to me, great. If not, I've got
4:08:08a second request that's gone out. So,
4:08:11I'm really looking for something that's
4:08:13fast and not really worried so much
4:08:15about efficiency. Other uses for UDP,
4:08:19gaming protocols, for example, would use
4:08:21UDP because often you want something to
4:08:24get there quickly. If you are moving
4:08:27around in a game, you want those updates
4:08:29sent quickly. And if they don't get
4:08:31there, it's not really a big deal
4:08:33because you're going to send out another
4:08:34one pretty quickly anyway. That's why
4:08:37gaming often uses UDP when you're
4:08:39talking about online games. Voice over
4:08:42IP, video streaming, the same idea. I
4:08:45don't worry about sequencing with video
4:08:48or audio streaming because if something
4:08:52comes out of order, then I'm probably
4:08:55just going to drop it. And I'm not going
4:08:57to wait for missing packets because if I
4:09:01wait for missing packets, then what's
4:09:03going to end up happening is I'm going
4:09:05to end up with really choppy audio. I'd
4:09:07rather drop a couple of packets and the
4:09:10ear or the eye will actually fill in
4:09:12missing information. So that's why I'm
4:09:15going to use UDP for streaming media. So
4:09:18that's just some uses of UDP. Again, UDP
4:09:21is really where I want to do something
4:09:23really fast and get it out on the wire,
4:09:26not really worry about all of the
4:09:28overhead of doing connection setups and
4:09:31retransmits. As an application, I will
4:09:34worry about whether I retransmit or what
4:09:36I do in terms of sequencing.
4:09:40In this lesson, we're going to go over
4:09:42what a UDP packet actually looks like.
4:09:45Now, there's not really an awful lot to
4:09:47a UDP packet. And I've got a packet
4:09:50capture here. You can see here, this is
4:09:52actually a pretty small packet. And the
4:09:54headers are actually really small. So,
4:09:56what I've got is just a source port. If
4:10:00I select the UDP header, you can see
4:10:02down here the entire length of the UDP
4:10:05header is 1 2 3 4 5 6 7 8 bytes.
4:10:10Actually, four of those are the ports.
4:10:14I've got my source port here, which is
4:10:16these two bytes, and I've got my
4:10:19destination port, which is these two
4:10:21bytes here. The length is another two
4:10:23bytes, and then the check sum is two
4:10:26more bytes. So, a total of eight bytes
4:10:29for the UDP headers. And that's really
4:10:32all there is to it. Again, what we're
4:10:34looking for with UDP is we're looking
4:10:36for just getting the packet out onto the
4:10:39wire quickly and not worrying about a
4:10:42lot of overhead. We're actually going to
4:10:44calculate a check sum because that's
4:10:47useful. We don't want to actually take a
4:10:49look at something that's been corrupted
4:10:50in transmission. So we do do a
4:10:53calculation of a check sum and we will
4:10:56take a look at that on the receiving end
4:10:58but mostly it's about doing the
4:11:00multipplexing
4:11:02and it's about providing information
4:11:04about the length of the packet. So we
4:11:08actually know where all of the
4:11:10information is and whether all of it's
4:11:12been received. So if we don't get 97
4:11:15bytes worth of data then we haven't
4:11:18received everything. If we get more than
4:11:20that, in either of those cases, the
4:11:22check sum probably won't compute anyway,
4:11:24and so we'll end up discarding the
4:11:26packet. So that's really all there is to
4:11:29UDP headers. It's really just the source
4:11:32port and the destination port. And
4:11:34again, that's two bytes. So that's
4:11:3765,536
4:11:39possible values in each of those
4:11:42locations or each of those positions. So
4:11:44you can have values in these ports of 0
4:11:48to 65,535
4:11:51just because that's what you get with 16
4:11:54bits worth of data. We get 64k of values
4:11:58here in each of these locations. And
4:12:01then the length also gives us the
4:12:04ability to have lengths worth 64k or
4:12:0765,536
4:12:09bytes. That's the largest packet size
4:12:12that we could see. That would be
4:12:14unusual. And of course, anything that
4:12:16large would probably require
4:12:18fragmentation at the IP layer anyway.
4:12:21That would be a really large packet
4:12:23size. Usually what we'll see,
4:12:26particularly with UDP, is small packets
4:12:29that are meant to get there in a timely
4:12:32fashion. So again, we're talking about
4:12:34online gaming, we're talking about
4:12:36streaming media like audio and video.
4:12:38Voice over IP certainly falls into that
4:12:41as well because of course that's
4:12:42streaming audio. That's really why we
4:12:45don't have anything in the UDP headers
4:12:47other than the multipplexing information
4:12:49here which is the port information. And
4:12:52then just a check sum in a length to
4:12:54make sure that we've got everything that
4:12:56we expect to have and that it looks like
4:12:59it hasn't been corrupted in
4:13:00transmission. And that's really all
4:13:02there are to the UDP headers.
4:13:07In this lesson, we're going to be going
4:13:08over a voice over IP call to demonstrate
4:13:12streaming audio using UDP. We get kind
4:13:15of a bonus here because in this case,
4:13:18SIP is the session initiation protocol
4:13:21and it's actually the signaling protocol
4:13:23that establishes the parameters for the
4:13:26call. So we can get to a point where we
4:13:29can send streaming audio and both sides
4:13:32are using the same codecs and the same
4:13:35compression methods and all of the same
4:13:38audio parameters. So when I send some
4:13:40audio to the other end, it can actually
4:13:43do the decoding and turn that digital
4:13:46audio back into analog audio that your
4:13:49ear can hear. In this case, we've got a
4:13:52SIP message and it's actually using UDP
4:13:54as well. SIP is capable of using both
4:13:59TCP and UDP. In this case, we are using
4:14:02UDP as the transport layer protocol for
4:14:07the session initiation protocol. So, not
4:14:09only are we going to be transferring
4:14:11audio over UDP, but we're also doing the
4:14:14signaling over UDP as well. Without
4:14:17getting into a great deal of detail
4:14:19about how SIP works, this is actually a
4:14:21call setup. An invite gets sent from the
4:14:24caller to the colle and then we've got
4:14:27some interim status messages. So you've
4:14:30got a trying message that goes back and
4:14:32says, "Yep, I'm trying to ring your
4:14:34party." And then you get a ringing
4:14:36message. Then there is a whole lot of
4:14:39other stuff in this packet capture here.
4:14:42So let's actually do a filter on SIP.
4:14:44We've got a 100 ringing. And then you've
4:14:47got 200, okay, which means something
4:14:50picked up. You can see that the session
4:14:53is actually being established here. Now
4:14:56let's do a filter on RTP because RTP is
4:14:59the real time protocol. That's where the
4:15:01actual audio would happen. Again with
4:15:05RTP which is streaming audio, what we
4:15:08want is we want the messages to be sent
4:15:11really quickly without having a lot of
4:15:13overhead. So again, we've got UDP here
4:15:16and we've got a source port and a
4:15:18destination port and that's really all
4:15:19there is. So the real-time transport
4:15:22protocol actually handles some of the
4:15:25other information around making sure
4:15:28that we are talking to the right party.
4:15:31There's a synchronization source
4:15:33identifier and a sequence number. And of
4:15:35course, we've got the payload type. If
4:15:37we were using the wrong kind of codec,
4:15:39for example, the other end wouldn't be
4:15:41able to decode it. Why again do we use
4:15:44UDP here? Because I don't really care
4:15:47about doing a session establishment. I
4:15:50don't need to do a connection because
4:15:52really SIP is handling that for me. My
4:15:55signaling protocol is handling my
4:15:58session establishment for me. So I don't
4:16:00need the three-way handshake of a
4:16:02connection establishment. I also don't
4:16:05want to worry about retransmits and
4:16:09waiting for the messages to get in the
4:16:11right order because otherwise I end up
4:16:13with delays and choppiness in the audio
4:16:17stream. What's going to happen is if I
4:16:20am missing audio, we're just going to
4:16:22drop those packets. And there's
4:16:24something on the order of like 15
4:16:25milliseconds. So if we drop a couple of
4:16:27packets there, your ear's really not
4:16:29going to hear it. You can see the
4:16:31messages going back and forth from the
4:16:33source to the destination. All of the
4:16:36information here about the codec that
4:16:37we're using and the type of audio and
4:16:40you've got the sequence number and the
4:16:42time here that helps us make sure that
4:16:45we are getting messages from the right
4:16:47place. So again, we don't need UDP to
4:16:50handle that for us because the protocol
4:16:53that sits on top of UDP is doing the
4:16:56sequencing and making sure that we're
4:16:58getting information from the right place
4:17:01and that it's coming in in the right
4:17:02sequence. If we get a sequence number
4:17:06that happens to be out of order, we're
4:17:08just going to drop it and we're not
4:17:09going to try to play that. But the
4:17:12overhead protocol or the RTP is actually
4:17:15doing the work that TCP might otherwise
4:17:18do for us. So we don't need the overhead
4:17:21of TCP to handle that because the
4:17:24application is doing it through all of
4:17:26the parameters in the real-time
4:17:28transport protocol. In cases where your
4:17:31application is doing a lot of the
4:17:35overhead work that TCP might otherwise
4:17:38provide for you, you don't really need
4:17:40TCP, particularly if what you're looking
4:17:42for is real-time communication and
4:17:44something fast and we don't want to
4:17:47worry about waiting for packets to get
4:17:50in so that we can reorder them and play
4:17:53them back in the right place. What we
4:17:55want is to make sure that we play
4:17:57messages that arrive as soon as they
4:17:59arrive. So, if you've got an application
4:18:01that's handling all of that overhead for
4:18:03you, you really don't need TCP. And
4:18:06that's certainly what's going on here
4:18:08where we're using RTP and we don't need
4:18:11TCP for it. We would use UDP in that
4:18:15case.
4:18:18In this lesson, I'm going to be talking
4:18:19about the purposes of the session layer.
4:18:22The session layer is layer five of the
4:18:24OSI model and it's really there to do
4:18:28session management. The application
4:18:30probably manages this. It's probably not
4:18:33something separate. But in terms of an
4:18:36abstract model where we break out
4:18:38specific functionality, the session
4:18:41layer is actually there to do the
4:18:43session management and handle things
4:18:45like authentication and authorization as
4:18:48well as doing things like recovering a
4:18:52session if information is lost or the
4:18:55session gets somehow abnormally
4:18:57terminated. It's there to do a
4:18:59restoration of the session if those
4:19:02sorts of things happen. So we can bring
4:19:04the session up cleanly again. And there
4:19:07are a number of protocols that actually
4:19:09fit into the session layer which you may
4:19:12or may not be familiar with but you
4:19:13probably use on a regular basis. One of
4:19:15the big ones is a remote procedure call
4:19:18which is where we use functionality from
4:19:21a library that exists on another system.
4:19:25So an application on one system can make
4:19:28a procedure call or a function call to a
4:19:31library that exists on another system
4:19:33and actually make use of the information
4:19:36that exists on the other system through
4:19:38that library. A number of other
4:19:41protocols that fall into that that you
4:19:43may be familiar with include net bios
4:19:45and PPTP as well as some of the Apple
4:19:47talk protocols as well. It really fits
4:19:51in with the layer five of the OSI model
4:19:54and it goes into the application layer
4:19:56when we're talking about the TCP IP
4:19:58architecture. Coming up, we'll be
4:20:00looking at some of the different
4:20:03protocols that fit into this layer. But
4:20:06remember, the services that we're really
4:20:07talking about primarily when we're
4:20:09talking about the session layer are
4:20:11things like authentication and
4:20:12authorization as well as session
4:20:14management, creation, termination,
4:20:17restoration, all of those sorts of
4:20:19things. So that's really what we're
4:20:20talking about when it comes to the
4:20:22session layer.
4:20:25In this lesson, we're going to be
4:20:26talking about SSL in TLS. So the first
4:20:30thing I want to do is I just want to get
4:20:31a packet capture going so that we can
4:20:33take a look at what is happening on the
4:20:36wire once we're done doing this little
4:20:38demonstration here. So SSLTS is the
4:20:42secure socket layer or transport layer
4:20:45security. SSLTLS are all about doing
4:20:49encryption. That's primarily why we use
4:20:52SSLTLS.
4:20:54SSLTLS
4:20:56is primarily a session layer protocol.
4:20:59Let me just demonstrate here how we
4:21:01would do this. So I'm going to open up
4:21:03SSL and I'm going to use Sclient connect
4:21:07and we're just going to use Google
4:21:09because it's easy. And so I'm going to
4:21:12connect to port 443 at www.google.com.
4:21:16And what we can see here is the session
4:21:20beginning. You can see here that we are
4:21:23connected and we are doing some
4:21:26certificate exchanges. We're actually
4:21:28getting the server certificate here.
4:21:31We're doing an SSL handshake. And you
4:21:34can see that it's reading 1,772
4:21:37bytes and written 316 bytes. So what
4:21:40it's doing is it's setting up this
4:21:42session so that it can do the encryption
4:21:46for this particular session. So there's
4:21:48an SSL handshake that is done in order
4:21:51to get the session set up. And the
4:21:54session has a number of parameters like
4:21:57which encryption cipher we're going to
4:21:59use and setting up keys for the session
4:22:02and a number of other parameters. And
4:22:04those all have to be done initially
4:22:07during the handshake so that both ends
4:22:10know what those parameters are so that
4:22:12the session can continue with everything
4:22:14in place on both sides and both sides
4:22:18basically speaking the same language.
4:22:20So, I'm just going to issue a get here
4:22:24and we can close the connection out and
4:22:28go over and take a look at the packet
4:22:29capture and see what that looks like.
4:22:32We're done there. Let's swing over and
4:22:34take a look at the packet capture. Now,
4:22:37I'm going to stop the capture first. I'm
4:22:40going to filter on TCP and then we can
4:22:43take a look at what's actually going on
4:22:45here. You can see we're doing the
4:22:47three-way handshake. So that's the TCP
4:22:49portion here. So we're sending the SIN,
4:22:51getting the SIN act back and then
4:22:54getting the act back in reply. So now we
4:22:57have the client hello and this is really
4:22:59the session establishment. The client
4:23:02sends a hello and you can see here it's
4:23:04using SSL version 2. The server actually
4:23:08replies using TLS version one. The
4:23:11server sends back a server hello. And
4:23:15we're going to open this up.
4:23:18And the handshake protocol is just a
4:23:20server hello and the version is TLS
4:23:23version one.
4:23:25You can see a session ID here. So the
4:23:28session ID length is 32. We've actually
4:23:31got a session ID and it looks like it's
4:23:33setting a cipher suite that it wants to
4:23:36use. Now the server is actually going to
4:23:39send a certificate to the client so that
4:23:42the client can do some verification and
4:23:45also part of that certificate is the
4:23:48public key for the server. Now we do a
4:23:52client key exchange and then we do a
4:23:55change cipher spec that's the server
4:23:58sending to the client. Here you can see
4:24:00the source is the Google server and the
4:24:04client is the destination here the
4:24:06192.168.1.22.
4:24:09So we're doing a change cipher spec and
4:24:12once we've done that you can see it's
4:24:15changed the encryption and what that
4:24:18really does is now we're sending
4:24:21encrypted messages back and forth. And
4:24:24so you can see there's application data
4:24:26and it's encrypted at that point. So
4:24:28everything going forward from here is
4:24:31going to be encryption or encrypted
4:24:34messages unless there's a new sender
4:24:37that gets introduced in the middle of
4:24:39this. For example, a new server that's
4:24:41sending data to the client or in the
4:24:44case where the client or the server
4:24:47needs to renegotiate something. But
4:24:49basically the session is set up at that
4:24:52point and then all it is is encrypted
4:24:55messages back and forth. But you can see
4:24:57that there was a session establishment
4:25:01where there was some negotiation and a
4:25:04little bit of authentication as well
4:25:06with the certificate. That's how SSLTS
4:25:10works at a very very high level and
4:25:13primarily we're going over it just to
4:25:16demonstrate it as a session layer
4:25:19protocol and looking over very quickly
4:25:22the overhead that's associated with
4:25:25establishing a session in order to do
4:25:28the encrypted transfer of the messages
4:25:31which is really what SSL is there to do
4:25:33is to set up that encryption and then do
4:25:35the encryption once the session is
4:25:37establish established.
4:25:41In this lesson, I'm going to be going
4:25:43over SSH and I'm going to be going over
4:25:46SSH as a session layer protocol. So SSH
4:25:51is the secure shell. What it does is
4:25:54establish an encrypted communication
4:25:57channel so that you can do remote
4:26:00console login as well as other things.
4:26:02There are file transfers that are part
4:26:05of what SSH does. But primarily SSH is a
4:26:11remote console login protocol and it's
4:26:14really designed as a replacement for
4:26:16TNET. I've got a packet capture going on
4:26:19here. So let me go over and I'm going to
4:26:22establish an SSH session and then we can
4:26:25take a look at what that looks like when
4:26:27it hits the wire. Of course, a lot of
4:26:28that is going to be encrypted because
4:26:30once the SSH session is started, then we
4:26:34are going to be dealing with encrypted
4:26:36messages. is we're not actually going to
4:26:38be able to see anything of what's going
4:26:40on there, but we'll be able to see the
4:26:42session establishment as part of how SSH
4:26:46works and how it gets going. So, I've
4:26:49got a system on my local network that I
4:26:52call Bill after Bill the cat. It very
4:26:55quickly opens up the session. I've
4:26:58actually got it set to go verbose, which
4:27:01means it's going to tell me everything
4:27:02that it's doing. So you can see the Open
4:27:05SSH version that I'm using. It's using
4:27:08OpenSSL0.9.8.
4:27:11We're reading some configuration and now
4:27:14we're doing a connection and that would
4:27:17be the TCP connection. And we're
4:27:19checking the remote protocol version
4:27:21which appears to be version 2.0. And we
4:27:24know the remote software version is Open
4:27:27SSH 5.9. We are doing compatibility mode
4:27:31for protocol 2.0. O local version string
4:27:35is SSH.2.0-open
4:27:38SSH. Now we're doing an SSH2 message for
4:27:42a key exchange initialization sent. And
4:27:46then one was received.
4:27:48We're doing a key exchange from server
4:27:51to client using AES1 128 and then from
4:27:55client to server also using AES1 128.
4:27:59And you can see we're sending some
4:28:02additional messages. And all of this is
4:28:05doing the negotiation for the encryption
4:28:10and the ciphers that are going to be
4:28:12used when we actually get the session
4:28:14set up. We are checking the host key. In
4:28:18this case, we're checking it against one
4:28:19that we know. It happens to be one
4:28:22that's already there. You can see that
4:28:24we did a signature verification and we
4:28:27see that the signature is correct. Now
4:28:29we're just checking a bunch of
4:28:32parameters and settings. It looks like
4:28:34we sent some new keys as well. Now it's
4:28:38doing the authentication which of course
4:28:40is part of the functionality of a
4:28:42session layer protocol. It offers
4:28:44authentication.
4:28:46In this case, we're going to do public
4:28:48key authentication. So we're going to be
4:28:51handing off the RSA public key and the
4:28:54server does the acceptance of that
4:28:56public key. And it says here
4:28:58authentication succeeded. So I've been
4:29:00authenticated. Now it's going to log me
4:29:02in. Now let me log out here. And you can
4:29:05see that we're actually tearing it all
4:29:07down. And then we've closed the
4:29:09connection. So let's go back to the
4:29:12Wireshark capture here. I'm going to
4:29:15filter it based on IP address just to
4:29:18make sure I really get what I'm looking
4:29:20for here. So I'm going to set the IP
4:29:23address of 39 which I know is the server
4:29:26that I am using. And you can see the
4:29:29setup here. So we've got the SIN the
4:29:32SINAC and the A of the TCP setup because
4:29:35of course SSH runs over TCP. We're doing
4:29:38a TCP setup here. Now we're doing this
4:29:42server protocol and client protocol. And
4:29:45this is really what we looked at before.
4:29:47So the server says this is what I've
4:29:49got. And then the client says, "This is
4:29:51what I've got." And then you can see the
4:29:54key exchange here. The client does a key
4:29:57exchange initialization. The server does
4:29:59a key exchange initialization.
4:30:02And now we're doing some Diffy Helman
4:30:05key exchanges. And that's a way of doing
4:30:08a key exchange in a secure fashion. So
4:30:11Diffy Helman is a particular protocol
4:30:13for doing the establishment of session
4:30:16keys. So you're not actually
4:30:18transmitting any keys in the clear. So
4:30:22it's doing the diffy helman exchange and
4:30:24running the diffy helman protocol so
4:30:26that we can set up new session keys for
4:30:30this session.
4:30:32Now we've got some new keys and we're
4:30:35starting to send encrypted messages at
4:30:38this point. So you can see the encrypted
4:30:41request packet and the response packet
4:30:43and these are all encrypted at this
4:30:45point. So now we've got the session
4:30:48established and we are doing an
4:30:51encrypted transfer. Everything is
4:30:54basically up and running right now. You
4:30:57can see that we're actually tearing the
4:30:59session down. So we're doing a finac.
4:31:03We've really torn the session down at
4:31:04this point. So that was where I closed
4:31:07the session. But you can see the session
4:31:09establishment and the authentication
4:31:12that was part of again the functionality
4:31:15of a session layer protocol. SSH being a
4:31:18session layer protocol does all of the
4:31:21establishment of the parameters for the
4:31:23transfer of information at again a
4:31:26higher layer than the network layer or
4:31:29even the transport layer. This is all
4:31:31about higher layer protocols doing a
4:31:33negotiation so that they can make sure
4:31:36that they can continue to communicate
4:31:39and get that session established so
4:31:41we're all talking the same language and
4:31:43all talking on the same page. And again,
4:31:45the authentication that's part of a
4:31:47session layer protocol was done as well,
4:31:50both with the server identification as
4:31:53well as checking the public key as part
4:31:56of the authentication. So that's SSH
4:31:59again at a very high level and really
4:32:02just kind of at a message level for
4:32:04understanding how SSH gets set up and
4:32:08the steps that we go through to get an
4:32:10SSH session established.
4:32:30In this lesson, we're going to be
4:32:31talking about the RTP control protocol,
4:32:34also called RTCP. The RTP control
4:32:37protocol is a sister protocol that goes
4:32:41along with the real- time protocol. And
4:32:43the real-time protocol is used for
4:32:45streaming audio, streaming video. And it
4:32:48actually carries the media for the
4:32:51particular session that's in progress,
4:32:54whether it's audio or whether it's
4:32:55video. Along with that streaming audio
4:32:59or video, we need to be able to carry
4:33:02data about the stream. And so that's
4:33:05what RTCP is for. RTCP is there to
4:33:09provide statistical information and
4:33:12quality aspects and provide information
4:33:15about the session itself. As a result,
4:33:18we end up with a session layer protocol.
4:33:22And the session layer protocol is for
4:33:25session checkpointing and recovery. and
4:33:27it allows different streams of media to
4:33:31be able to be combined in cases where
4:33:34maybe you've got different sources of
4:33:37media from different locations. So let's
4:33:40take a look at the RTCP.
4:33:44I've actually got a whole call here.
4:33:47This is a H323 call and H323 is a voice
4:33:51over IP protocol that's responsible for
4:33:54signaling along with the media here. We
4:33:57can just do a filter on RTCP. And here's
4:34:01an RTCP packet. This is UDP. And just
4:34:04like RTP is UDP because we want it there
4:34:08quickly and we don't really care so much
4:34:10about whether they come in out of order
4:34:12or whether messages are dropped or not
4:34:15because we're really concerned with just
4:34:17playing the media as we get it. So this
4:34:20is RTCP the sender report and you can
4:34:24see we've got the sender source and
4:34:27we've got some timestamps and then we've
4:34:29got senders packet count and senders
4:34:32octat count. So along with that, we get
4:34:35the source description and we've got
4:34:38chunk one. There's an identifier and
4:34:42then we've got a type which is a CNAME
4:34:46and we've got text which is out channel.
4:34:49And so you've got the session
4:34:50description here and statistics about
4:34:54the session itself. Because what we're
4:34:57talking about is a streaming media
4:35:00session, in this case streaming audio,
4:35:02we've got a protocol that's actually
4:35:04responsible for carrying information
4:35:06about the session, which is what lands
4:35:08it in the session layer of the OSI
4:35:11model. So we've got RTCP here, which is
4:35:15a session layer protocol. This happens
4:35:19to run over UDP. Typically what you'll
4:35:22find is RTCP runs in a paired port with
4:35:26RTP. So we've got a destination port of
4:35:30501 and probably we'll find a
4:35:34destination port for the RTP of 5000.
4:35:40And that's exactly what we find here. So
4:35:42we've got RTP, we've got a destination
4:35:45port of 5000, which means the RTCP is
4:35:48port 501. And that's just kind of how
4:35:51they're paired. Often you've got the RTP
4:35:54on the even numbered port and the RTCP
4:35:57on the oddnumbered port that's paired
4:35:59with it. And they're just the
4:36:00consecutive port numbers. That's RTCP.
4:36:03And again, that's just another session
4:36:05layer protocol.
4:36:08In this lesson, we're going to be
4:36:09talking about the remote procedure call.
4:36:12It's a protocol that's often called RPC.
4:36:15And there are many implementations of
4:36:17RPC or RPC like protocols. So RPC is
4:36:22actually a case where you've got two
4:36:25systems. Maybe you've got a client and a
4:36:27server for example where you've got two
4:36:30programs that need to communicate with
4:36:32one another and maybe one program is
4:36:36running on a completely different system
4:36:38or a different architecture. This is one
4:36:40way of getting processes or programs to
4:36:44communicate in ways that they may not
4:36:47otherwise be able to. So you could have
4:36:50one program actually making calls to
4:36:52another program to get functionality
4:36:55that the calling program doesn't
4:36:57actually have. There's actually a lot of
4:37:00functionality that you use on a pretty
4:37:02regular basis probably that uses RPC. So
4:37:06RPC's actually been around for a long
4:37:09time and we'll just take a quick look at
4:37:11the sequence of events during a remote
4:37:13procedure call. So first of all, the
4:37:16client program actually calls a little
4:37:19stub function local to the calling
4:37:22program. All of the parameters and data
4:37:25that the function needs to have in order
4:37:27to operate gets called with that local
4:37:29function or local procedure. That stub
4:37:32then puts all of those parameters into a
4:37:35message and then makes the call to send
4:37:38the message out onto the wire to the
4:37:41remote system. That's where we get into
4:37:43the networking aspect. It gets sent over
4:37:46the wire to the remote system. The
4:37:48remote system receives it, pulls the
4:37:51message apart, gets the parameters that
4:37:54it needs, calls the procedure that is
4:37:56living on the server with those
4:37:58parameters, gets the reply, and then
4:38:01sends the reply back. That's how that
4:38:04actually works. And just walking through
4:38:06the quick sequence of events here during
4:38:09an RPC, it's reasonably straightforward.
4:38:11Rather than making a local function call
4:38:15and just having that function operate on
4:38:18your system, what you are doing is
4:38:20really making a function call over the
4:38:22network or over the wire. As usual, I've
4:38:26got a wire shark capture here. What
4:38:28we've got here is actually a DCER RPC
4:38:32function and there's some server message
4:38:35block stuff in here as well. And the
4:38:38reason for that is because there is a
4:38:42lot of RPC built into the way Windows
4:38:45does networking. Whether it's
4:38:47communicating with the server for login
4:38:49and getting information about users and
4:38:52printers and file shares or whether it's
4:38:56doing file transfers, there's a lot of
4:38:58remote procedure call built into that.
4:39:01We've got here a few packets that are
4:39:04actually RPC packets and just want to
4:39:08show a couple here. This is where we're
4:39:11actually doing an RPC call. We're doing
4:39:14a TCP message. Here's the net bios
4:39:18session service. And net bios is another
4:39:20session layer protocol. Net bios has
4:39:23also been around for a long time. We've
4:39:26also got some application layer
4:39:28protocols like server message block.
4:39:31Right here is where we have the remote
4:39:33procedure call which is actually the
4:39:35session aspect of it. The reason that
4:39:38it's a session aspect is because we
4:39:41establish this connection with the other
4:39:44system in order to transfer messages
4:39:47back and forth in order to achieve a
4:39:50particular goal or outcome. And so
4:39:53there's this session that gets
4:39:55negotiated and we do a number of things
4:40:00to set up this session and establish the
4:40:02communication. So for example, you can
4:40:05see here in the RPC message, we're using
4:40:09version five and we can see that the
4:40:12packet type is a request. Here you can
4:40:14see the packet flags and we've got
4:40:17object and did not execute. So we've got
4:40:20the ability to pass errors. We've got
4:40:23multiplex and cancel pending and then
4:40:25first fragment and last fragment set. So
4:40:28there's only one message. You can see it
4:40:31indicates a data representation. So that
4:40:34way both endpoints know what the data is
4:40:38going to look like. So for example, we
4:40:41are using asy characters and we're also
4:40:44using a little Indian bite order. What
4:40:47that means is the least significant bite
4:40:50is going to be transmitted first. In big
4:40:54Indian, the most significant bite gets
4:40:56transmitted first. In this case, we've
4:40:59got the least significant bite gets
4:41:01transmitted before the most significant
4:41:04bite. That's actually a bit backwards
4:41:06from how you would read. When we write a
4:41:09number, typically the most significant
4:41:11digits are going to be on the left hand
4:41:13side. In this case, maybe that's not
4:41:16quite so backwards because we're
4:41:18transmitting the smallest bytes first.
4:41:21So if you were to think about it, maybe
4:41:23that would be the rightmost bits and
4:41:26then follow that up with the most
4:41:28significant bits which would be towards
4:41:30the left. So some of it kind of depends
4:41:32on how you think about representation,
4:41:34but think about little Indian versus big
4:41:37Indian is which bytes get transmitted
4:41:39first and little Indian is the least
4:41:42significant bits. those get sent out on
4:41:44the wire first. So what we're doing here
4:41:47is we're negotiating the communication
4:41:50that we're going to have. So that's all
4:41:52part of the session establishment. Right
4:41:55down here is the operation that gets
4:41:58called and then we get the response in
4:42:02this message. And we still do the setup
4:42:05and negotiation of how all of this is
4:42:08going to work and how it's going to
4:42:10look. And you can see the call ID here.
4:42:14Again, we've got some information.
4:42:18This is actually the response to the
4:42:20message that was sent. This is really
4:42:24the return from the function call. This
4:42:26is all of the data that got returned
4:42:28from the function call that was made in
4:42:30this DSOR get primary domain
4:42:33information. This is the primary domain
4:42:36information that we are getting back.
4:42:38And you can see here it's a standalone
4:42:40workstation and that's the response to
4:42:44the particular message that was sent
4:42:46previously. So this is the remote
4:42:49procedure call protocol and as I said
4:42:53earlier there are actually a number of
4:42:55implementations of this. The RPC that we
4:42:58just saw is part of the server message
4:43:01block, which is the foundation of
4:43:03Windows networking and communication
4:43:06between domain controllers and clients
4:43:08and active directory servers and doing
4:43:11file sharing and print sharing. RPC is
4:43:14really a primary foundation for doing
4:43:18those types of functions and getting all
4:43:21of the benefit from doing Windows
4:43:23networking. RPC really sits very deeply
4:43:26underneath all of that. If you're using
4:43:28Java, you'll use remote method
4:43:30invocation, which is RMI, and it's very
4:43:33similar to RPC. SOAP is actually similar
4:43:37to RPC. It's kind of based on an RPC
4:43:41like functionality. Corba is something
4:43:44that's similar to RPC. It's kind of an
4:43:46old protocol, not one that you'll see an
4:43:50awful lot these days. XML RPC is kind of
4:43:54a web 2 thing that you'll see an awful
4:43:57lot with things like WordPress, the
4:43:59blogging software for example, or
4:44:01content management software. If you use
4:44:04image galleries in websites, those
4:44:07sometimes use an XML RPC. What that does
4:44:11is a remote procedure call, but it
4:44:13marshals all of the data up into XML and
4:44:18passes the XML object over as a
4:44:21parameter to the procedure call. That's
4:44:24something that you'll see on a pretty
4:44:25regular basis. Whether you recognize
4:44:27that you're seeing it or not is of
4:44:29course a different story. But RPC is
4:44:31really a foundational protocol that
4:44:34you'll see on a pretty regular basis. No
4:44:36matter whether you're doing web
4:44:37communication or whether you're doing
4:44:40just standard Windows desktoping, you'll
4:44:44see RPC get used on a pretty regular
4:44:47basis. So if you were to just pop up
4:44:49Wireshark on your Windows system and do
4:44:51a packet capture and just take a look at
4:44:53what's going on, you should see a fair
4:44:55amount of RPC traffic as you do the
4:44:58capture and take a look at what you're
4:45:00seeing on a normal day-to-day basis. So
4:45:03that's the remote procedure call. And
4:45:05again, that's another session layer
4:45:07protocol.
4:45:10In this lesson, we're going to be
4:45:11talking about the uses of the
4:45:13application layer or the purposes of the
4:45:15application layer. The application layer
4:45:18is the layer that sits the closest to
4:45:20the user. It's the layer that's
4:45:22responsible for a lot of the heavy
4:45:24lifting. What I mean by that is anything
4:45:28that an application needs needs to be
4:45:31handled in the application layer. if
4:45:34it's not actually handled in a lower
4:45:36layer. TCP for example handles
4:45:40retransmissions.
4:45:41If you were using UDP in your
4:45:44application layer protocol and you
4:45:47needed messages to be redelivered if
4:45:51they didn't actually get there, the
4:45:53application layer protocol would be
4:45:54responsible for handling that sort of
4:45:57thing. making sure that messages got
4:46:00from one end to another all the way
4:46:02through. Application layer protocols are
4:46:06things like remote login. So we would
4:46:09use telnet or we might use SSH file
4:46:13transfers FTP, TFTP, electronic mail,
4:46:16SMTP, IMAP, POP. There are a number of
4:46:20other protocols like the server message
4:46:22block protocol for example that allows
4:46:24us to do things like transfer files from
4:46:28one system to another. DNS is an
4:46:30application layer protocol that allows
4:46:32us to look up IP addresses from host
4:46:35names. And of course we've got HTTP
4:46:38which is the hypertext transport
4:46:40protocol. We'll be going into several of
4:46:43these protocols in subsequent lessons in
4:46:45more detail. So you can see the actual
4:46:49message level details of the protocols
4:46:52and see in many cases how they actually
4:46:56work and how the client and the server
4:46:59or the two different endpoints interact
4:47:01with one another and the specific
4:47:03messages that get sent back and forth.
4:47:06We'll be talking in more detail about
4:47:09these different application layer
4:47:11protocols. But as I said, at kind of a
4:47:13core functionality level, this is where
4:47:17the functionality actually touches the
4:47:20user. We've got things like HTTP, for
4:47:23example, which is the protocol that's
4:47:26used by the browser, which the user
4:47:30actually uses. So the browser uses HTTP.
4:47:34It's a protocol that's very very close
4:47:36to the user. SMTP, same thing. You've
4:47:39got an email client that needs to send a
4:47:42message. That email client that you are
4:47:45using is actually using SMTP underneath.
4:47:48It's not actually sending a message to a
4:47:51lower layer and that layer is sending
4:47:53SMTP. The application actually
4:47:56implements these protocols. things that
4:48:00users actually need to do are handled by
4:48:03the application layer. Not surprisingly,
4:48:06because the users use applications and
4:48:09the applications make use of application
4:48:12layer protocols. So, as I said, we're
4:48:14going to be getting into the
4:48:15nitty-gritty of some of these protocols
4:48:17like HTTP and the various email
4:48:20protocols, some file transfer protocols,
4:48:23and we'll take a look at Telnet as well.
4:48:26And of course we'll also dig into DNS
4:48:29because it's such a foundational
4:48:30protocol and it is at the application
4:48:33layer. But just at a high level once
4:48:36again the application layer protocols
4:48:39are the protocols that get implemented
4:48:42by the applications that the users use.
4:48:45And it's important to remember that
4:48:47distinction as opposed to the different
4:48:49layers that come below it, which these
4:48:52higher layer protocols make use of in
4:48:55transmission.
4:48:58In this lesson, we're going to be
4:48:59talking about HTTP. HTTP is the
4:49:03hypertext transport protocol. What it
4:49:06really is is the protocol that was
4:49:08designed for transmitting messages back
4:49:10and forth between a web client or a
4:49:13browser and a web server. Let's take a
4:49:16quick look here at HTTP and just some
4:49:20raw HTTP messages. Now, HTTP is a
4:49:24textbased protocol. And you can see I'm
4:49:27just typing what looks more or less like
4:49:31English here. And it's just in plain
4:49:34text. I'm not typing a lot of numbers
4:49:37that would be more indicative of a
4:49:39binary protocol. So what I'm typing here
4:49:42is actually the protocol commands. So
4:49:45what I've got on the first line is I've
4:49:48got my request and you can see what I'm
4:49:51requesting and then I've got HTTP and
4:49:54the version. HTTP 1.1 is currently the
4:49:58version that you're going to see a lot.
4:50:01You could use 1.0, zero, but the request
4:50:04would look a little bit different
4:50:05because there were some different things
4:50:07that were introduced with 1.1. One of
4:50:09the things was this idea of virtual
4:50:11hosts. And that's why I need the host
4:50:14line here because even though I'm
4:50:16connected to a particular IP address, I
4:50:18could have several virtual systems or
4:50:21virtual domains sitting on that one IP
4:50:24address. The protocol specifies that
4:50:27once I'm done with my request, I send a
4:50:30blank line and that indicates that I am
4:50:33done with the request.
4:50:35So what do I get back? Well, let's
4:50:38scroll up here. in addition to all of
4:50:40the JavaScript and the HTTP which is
4:50:44really the data that is being carried by
4:50:47this HTTP or the hypertext transport
4:50:50protocol. What I've got here is a set of
4:50:53HTTP headers that come in response. HTTP
4:50:57works in the way of a request and a
4:51:00response code. So I issued my request
4:51:03which was a get and the response code
4:51:06I'm getting here is a 200 okay. So the
4:51:10200 okay indicates not surprisingly that
4:51:13the request succeeded. Now I've got a
4:51:16number of other header fields here and
4:51:18you can see cache control and the
4:51:20content type specifies what I'm actually
4:51:23getting back. And right here it gives me
4:51:25a mime type of text HTML. So I know that
4:51:29I'm getting HTML in response as opposed
4:51:32to say a word document or a PDF file. So
4:51:36I've got some cookies and I can see that
4:51:40the server is the Google web server and
4:51:44I've got a transfer encoding of chunked.
4:51:47You can see here I've got the request
4:51:50right here which is the protocol itself.
4:51:54And again I get response codes from the
4:51:56web server indicating what actually
4:51:59happened. So what I could do would be to
4:52:01issue another request here
4:52:06and I'm going to say http1.1
4:52:10host again is www.google.com.
4:52:15And now what I get is a 404 not found.
4:52:18And so this is telling me that I've
4:52:21actually got an error because the 400
4:52:23series of codes are actually errors. So
4:52:26I've got 404 not found here. This is the
4:52:30HTTP that actually says, you can see
4:52:32right down here, that's an error. The
4:52:35requested URL was not found on this
4:52:37server. That's all we know. I could
4:52:40actually do the same thing here.
4:52:45So, we've been looking at just the raw
4:52:47messages, and this is what it would look
4:52:49like in a browser. So, we've got the
4:52:51image, a couple of images here, and then
4:52:54we've got a 404. That's an error. And
4:52:56the requested URL was not found on this
4:52:59server.
4:53:00Now, I've had a packet capture going
4:53:03here. I'm going to stop it now. And I
4:53:06can do HTTP just to filter everything
4:53:09down. And I'm going to scroll down until
4:53:12I find the request.
4:53:15Here's a request for the fu-fu
4:53:20blah. And then you can see here the
4:53:23message that we get back. The length is
4:53:261213.
4:53:28That's the 404 not found. Now there
4:53:31should be a difference here between that
4:53:33request and the request that comes from
4:53:36the browser. And there's a reason for
4:53:38that. The browser issues the get request
4:53:42and then the server replies with the 404
4:53:45not found. Now what the browser is going
4:53:48to do is it's going to actually look
4:53:50through that HTML and see that there
4:53:53were a couple of messages. The browser
4:53:55is going to issue two more get requests.
4:53:58Here you can see the two get requests at
4:54:01packet 953 and packet 956.
4:54:05And those two get requests are for the
4:54:08images. You can see the robot which was
4:54:11the background and then the small logo.
4:54:15The browser actually issues additional
4:54:18HTTP requests. And not only can we get
4:54:21HTML through HTTP, but we can also get
4:54:26these images. And that's exactly what
4:54:28happens here. I've got the robot and
4:54:31then I've got the 200. Okay.
4:54:34And you can see here I've got HTTP.
4:54:38And so we've got the 200. Okay. There.
4:54:41And then here is actually the graphics
4:54:43file. This is the PNG file or the
4:54:47graphics file pulled apart into its
4:54:50individual headers. So there ought to be
4:54:53another 200. Okay. To match the GIF
4:54:55file.
4:54:57And you can see here GIF 89A.
4:55:00What we get is a request to actually go
4:55:04get all of the elements of the page from
4:55:07the browser because a page is composed
4:55:09of potentially a large number of
4:55:12components. There's the text from the
4:55:15HTML. There's a number of images. There
4:55:18may be some objects with regards to
4:55:21cascading stylesheets or maybe
4:55:24JavaScript. So there could be a number
4:55:27of components to a web page and a
4:55:30browser is going to go and issue
4:55:33requests for all of those. If we get
4:55:37success then we're going to get a 200.
4:55:39Okay. If not we're going to get some
4:55:41sort of error message. So we might get a
4:55:45300 series message for example that
4:55:47could redirect us somewhere else. Or we
4:55:50could get a 400 series message saying
4:55:53the files not found, which is what we
4:55:54saw. 404 file not found. You might also
4:55:58see a 500 series message indicating that
4:56:01the server had a problem and we got a
4:56:04server error out of it. HTTP is an
4:56:07application layer protocol. And of
4:56:10course, it's application layer because
4:56:12that's where all of the functionality
4:56:15actually lives. And there's a lot of
4:56:17high-level functionality in terms of
4:56:20getting information from the user and
4:56:22then presenting data back to the user
4:56:25and making sure that all of the data is
4:56:27actually there that needs to be
4:56:29presented to the user. HTTP is an
4:56:32application layer protocol and it's
4:56:35designed to communicate between a web
4:56:38browser and a web server. Although there
4:56:41are a number of other uses for HTTP that
4:56:45we have found over the years, primarily
4:56:48it's a web client or browser and web
4:56:51server communication tool.
4:56:55In this lesson, we're going to be
4:56:56talking about Tnet. Tnet is kind of a
4:56:59bit of an oddity and one of the reasons
4:57:02I say that is because Tnet is a server
4:57:06and a client and a protocol. It
4:57:09sometimes gets confusing to talk about
4:57:12TNET because people may not necessarily
4:57:15be sure what you're actually referring
4:57:17to. I can actually use the TNET client
4:57:21without connecting to a TNET server.
4:57:23Tnet is just a client that allows me to
4:57:26do a TCP connection to any port that I
4:57:29specify. So I could do tnetgoogle.com
4:57:33port 80. That's just giving me a TCP
4:57:36connection to port 80, which allows me
4:57:38to issue HTTP requests to that HTTP
4:57:42server. Now, I can also use Tnet
4:57:46connecting to a Tnet server. And that
4:57:50server runs on port 23. So, I don't
4:57:54actually have to specify a port here.
4:57:57I'm just going to connect to
4:57:59192.168.1.39.
4:58:02I'm going to tell net in. This is going
4:58:04to allow me to do a remote login similar
4:58:08to SSH which of course is encrypted.
4:58:11This is plain text which means there's
4:58:13no encryption. Everything is in the
4:58:16clear. I'm going to type my password
4:58:20here and that's going to log me in.
4:58:24Again, I mentioned TNET is a server.
4:58:26Tnet is a client and of course Tnet's
4:58:28also a protocol. Let's go back to the
4:58:31packet capture that I started and we'll
4:58:33stop this and I can filter on TNET. You
4:58:37can see this is the beginning of the
4:58:39Tnet session. I'm going to close up the
4:58:42other protocols here and we'll just take
4:58:45a look at Telnet. So, what we've got
4:58:47here is all of the negotiation for how
4:58:52the session is going to go. You can see
4:58:55we're doing authentication and we're
4:58:59going to do terminal type and terminal
4:59:01speed and flow control. Then the server
4:59:04replies do terminal type terminal speed
4:59:07and X display which is something else.
4:59:11And then the server sends back some
4:59:14additional information. So we're doing a
4:59:16lot of negotiation for what's actually
4:59:19going to happen here. And you can see
4:59:22that the server actually turns echo on.
4:59:26And what that means is that the server
4:59:29will actually echo back what's typed.
4:59:32And we'll see in just a second that the
4:59:35system actually is kind of character by
4:59:38character. So this is the server sending
4:59:41the client this piece of data here. And
4:59:44it just says password. So we're
4:59:46prompting for the password. You can see
4:59:49what I mean here about character by
4:59:51character. So, Telnet is a character
4:59:54oriented protocol because we're only
4:59:56sending a character at a time. The
4:59:59reason for that is often there are
5:00:02applications that need individual
5:00:04characters or for example if you wanted
5:00:07to kill a program you would use C. that
5:00:11character would have to be sent without
5:00:13waiting for a enter key or a carriage
5:00:16return line feed because the client
5:00:19doesn't have any idea what's important
5:00:21and what's not important. It actually
5:00:23sends a character at a time as it's
5:00:26going. So this is the password that's
5:00:28being sent one character at a time. And
5:00:31now you can see we're sending the
5:00:33carriage return line feed to indicate
5:00:36that we're actually done. And now this
5:00:39is all of the welcome message being sent
5:00:42back to the client. Now we're done
5:00:45because we are at the prompt.
5:00:48You can see I was doing a little bit of
5:00:50typing here afterwards. That's actually
5:00:54represented again a character at a time.
5:00:57So, Telnet is a character-based protocol
5:01:00from the client side because again, the
5:01:02client has no idea what's important and
5:01:05what would need to be sent as a stream
5:01:08and what would need to be sent a
5:01:10character at a time. So, we just send
5:01:12everything a character at a time and let
5:01:15the server figure out what is a stream
5:01:18and what's just an individual character.
5:01:21I've got my client now connected to my
5:01:25server. And you've noticed that
5:01:28everything is sent in clear text. That's
5:01:30one of the reasons why you don't see a
5:01:32TNET server run very often. The Tnet
5:01:36server actually runs behind another
5:01:39piece of software. You would only see
5:01:41the Tnet server running if there's an
5:01:44open connection. And we have an open
5:01:46connection to this system here. Now I
5:01:49can see the TNET server is actually
5:01:52running. Otherwise there is another
5:01:55piece of software that actually manages
5:01:58whether the TNET server is going to
5:02:00actually launch or not launch. that
5:02:03helps keep the system protected because
5:02:05we can make determinations ahead of time
5:02:07whether we want to allow particular
5:02:09systems to connect because as I said
5:02:12TNET is a clear text protocol meaning
5:02:15there's no encryption and so as you can
5:02:17see it's really easy to be able to do
5:02:22things like sniff passwords from a TNET
5:02:26connection and as you can see you can
5:02:27see me typing the password of course
5:02:30it's a character at a time but it's easy
5:02:32to reassemble
5:02:33This is the password that I set on this
5:02:36particular dummy account that I created
5:02:38just for this demonstration. Telnet is a
5:02:41clear text protocol, but again it's also
5:02:44a client and a server and it's useful to
5:02:46understand the context that we are
5:02:48talking about when we start talking
5:02:50about Telnet. Telnet is of course the
5:02:53protocol here that runs on TCP and we
5:02:56were using a Tnet client in order to
5:02:59connect to a Tnet server. Again, the
5:03:03protocol itself is a bite or character
5:03:06oriented protocol that from the client
5:03:09sends a character at a time to the
5:03:12server. The server, which has a better
5:03:13idea of what's going on, can send entire
5:03:16streams back, much like when we got the
5:03:19welcome message right here. It sent
5:03:21entire streams back for the client to be
5:03:24able to display. So, that's Telnet in a
5:03:28nutshell. It's a pretty simple protocol,
5:03:30so there's not an awful lot to it. The
5:03:32real big part is the negotiation up
5:03:35front. Once the negotiation is handled
5:03:38as to how all of the flow is going to be
5:03:42managed and whether there's echo,
5:03:44whether there's not echo, whether it's a
5:03:46server echo or a local echo, that's all
5:03:50done way up front here during the
5:03:52initial connection. Once we get the
5:03:54connection established, it's just
5:03:56sending data back and forth from the
5:03:59client to the server and back.
5:04:03In this lesson, we're going to be taking
5:04:05a look at FTP. FTP is the file transfer
5:04:08protocol, and it gives us the ability to
5:04:13send messages back and forth primarily
5:04:16between Unix or Unix like operating
5:04:18systems. In the days before we had a lot
5:04:21of file sharing like Windows file
5:04:24sharing or even NFS which is the network
5:04:27file server for Unix like operating
5:04:30systems. We needed to be able to send
5:04:31messages back and forth and FTP was the
5:04:34way to do that. I'm just going to
5:04:36connect to a server that I've got on my
5:04:40local network. And you can see that I'm
5:04:43connecting to a pure FTPD server. And we
5:04:47are going to log in here.
5:04:50And I'm just going to give it my
5:04:52password.
5:04:54Now I can just list all of the files
5:04:58that are there. And there's not really
5:05:01anything there because I haven't put
5:05:02anything up. So let's take a look at
5:05:04what we've got here for the FTP
5:05:07messages. You can see again FTP is a
5:05:11clear text protocol. You can see I've
5:05:14sent the user request. User is the
5:05:18command that's being sent. So we've got
5:05:21the request command user and the request
5:05:23arg which is my username. I get a
5:05:27response and much like many other
5:05:29protocols like HTTP for example, I've
5:05:32got response codes. So the response code
5:05:35here is 331 which tells me that the
5:05:38username's okay, but I need a password.
5:05:41And now I've got a request command pass,
5:05:45which is the password command. Of
5:05:48course, the argument is the password for
5:05:51that particular user. So then we get a
5:05:54response. the user's logged in and the
5:05:56current directory is and it gives me the
5:05:58directory. So now here's a number of
5:06:01other commands. So we've got the system
5:06:03command and we've got the feature
5:06:06command and of course the system command
5:06:08replies with Unix and the feature
5:06:11command replies with a list of
5:06:14extensions supported. Then we get to
5:06:17where I send a list request and that's
5:06:21where we've ended so far. Let me
5:06:24actually dump that. Let me just create a
5:06:28file here. So, I'm going to create a
5:06:31file so I can send a file. And let me
5:06:34FTP back in.
5:06:39It's saying it's using binary mode to
5:06:42transfer files. There's a difference
5:06:44between asking and binary mode. Most of
5:06:47the time you're going to want to send
5:06:48binary mode. The difference is 7 bit
5:06:51versus 8 bit. If you send files in ASKI
5:06:56mode, you're only sending seven out of
5:06:58the eight bits in your bite. And that's
5:07:01because most files are only going to use
5:07:05the shorter ASKI set as opposed to
5:07:07extended ASI. So the shorter ASI set is
5:07:11only values 0 to 127. So we only need
5:07:15seven bits for that. If I want to get
5:07:18the full 8 bits which includes extended
5:07:20ASI and of course any executable that I
5:07:23send or zip file or anything like that
5:07:26has to be sent in binary mode because I
5:07:28need the full 8 bits otherwise I'm going
5:07:30to get corrupted messages. The file that
5:07:34I've created really there's nothing in
5:07:36it that I couldn't send seven bit and I
5:07:38could send asy. I'm going to leave it
5:07:41alone as binary because that's always
5:07:43going to be okay. So, I'm going to put
5:07:46file.txt.
5:07:48And you can see that we've accepted a
5:07:50data connection and we've transferred
5:07:53the file. Now, if I do an ls, you can
5:07:55see file.txt.
5:07:57I could also do a diir and do the same
5:08:01sort of thing. And you can see all of
5:08:03the commands that you can do here. So, I
5:08:07could actually send multiple files using
5:08:10anput, which would be multiple put.
5:08:13Similarly, I could do an M get which
5:08:15would be a multiple get. So, I put files
5:08:18and I get files. I could do a status and
5:08:23you can see what the status of my
5:08:26connection is and the version of the
5:08:30software that I'm using. All sorts of
5:08:32stuff about the session that I'm
5:08:33connected on. We should be able to go
5:08:36back here and let's take a look at FTP
5:08:39again.
5:08:41Now we can see I'm logging in again and
5:08:45I should be doing a put here. The FTP
5:08:49command is actually store. There could
5:08:53actually be a negotiation here about the
5:08:55port I'm going to use. And that's if we
5:08:59need to set up a separate data
5:09:00connection, but we're actually going to
5:09:02be using passive mode, which means we're
5:09:04going to connect over the ports that are
5:09:06already open. This is more firewall
5:09:08friendly. If you are doing active mode,
5:09:12which means we create new ports to send
5:09:15the data over, then the firewall needs
5:09:18to be able to know how to open those
5:09:20ports and allow the data stream through.
5:09:23In this case, we're just going to use
5:09:26the ports that are already open so we
5:09:30can avoid the issue with the firewalls.
5:09:33We're just sending data along at this
5:09:36point and we're going to be sending the
5:09:39message. Up here is where we accept the
5:09:43data connection and we successfully
5:09:46transfer the file. And then of course we
5:09:49do a listing down here. So we can see
5:09:53the file that we had put up. And that's
5:09:56the command that I typed was the list.
5:09:58You can see here how FTP works. Again,
5:10:01it's another reasonably simple protocol
5:10:03and the commands that we type actually
5:10:06translate to different FTP commands. In
5:10:09fact, some of them translate to the same
5:10:12command. You can see in this packet
5:10:15capture, there's actually two backtoback
5:10:17list requests. And that's because I
5:10:20typed ls, which is a Unix list command,
5:10:24and then I followed it up with diir,
5:10:26which is a Windows list command. They
5:10:28both generate the same FTP request
5:10:31command which is list. So diir actually
5:10:34translates to a list request and I get
5:10:38the response back. You can see the
5:10:41response that I'm getting here. That's
5:10:44how FTP actually works. Again, it's
5:10:46another clear text protocol. So you have
5:10:49to be careful where you run FTP because
5:10:52you can see here that the password is in
5:10:55clear text along with the username. And
5:10:58I'm just running a packet capture. I
5:10:59could run a packet capture on any
5:11:01network. If FTP is being used here, I
5:11:04can just start grabbing usernames and
5:11:06passwords and gathering that
5:11:08information. So clear text protocols,
5:11:11that means protocols without encryption
5:11:13are generally considered to be a bad
5:11:15thing. So here on my local network, I'm
5:11:18the only one here at the moment, the
5:11:20only one capable of seeing this
5:11:21particular information. So, for
5:11:24demonstration purposes here, it's not
5:11:25really a big deal. But if you wanted to
5:11:28use this in an enterprise environment,
5:11:31be aware that if you're using FTP
5:11:33without something like SSL over the top
5:11:35of it, you're running the risk of
5:11:37transmitting usernames and passwords.
5:11:40Now, there is a version of FTP that does
5:11:43anonymous connections, which means you
5:11:45don't have to log in at all. The
5:11:47downside to that is if you're using
5:11:48anonymous connections, you are
5:11:51potentially allowing somebody to just
5:11:53fill up your file system or you're
5:11:56allowing somebody to get access to maybe
5:11:59materials that they shouldn't have
5:12:01access to. So FTP doesn't often allow
5:12:06anonymous connections by default
5:12:08anymore. It used to be pretty much the
5:12:10case that FTP servers allowed anonymous
5:12:13access by default. these days,
5:12:15particularly with this one here, it
5:12:17comes installed without anonymous access
5:12:21allowed. So, I couldn't log in without
5:12:23actually providing a real legitimate
5:12:26username and password. That's FTP in a
5:12:29nutshell. And again, it's used for
5:12:31transferring files and getting access to
5:12:35file systems remotely.
5:12:39In this lesson, we're going to be
5:12:40talking about SMTP. SMTP is the simple
5:12:44mail transport protocol and it's the
5:12:46protocol that's used for sending
5:12:48messages from a sender to a recipient.
5:12:52Now, the process of receiving messages
5:12:54are entirely different protocols. So, I
5:12:57could send you a message and it goes and
5:13:00sits in a mailbox somewhere until you go
5:13:03and try and retrieve it. And that
5:13:04retrieval process is a couple of
5:13:07different protocols that we'll look at
5:13:08in subsequent lessons. Let's take a look
5:13:11at SMTP here. I'm going to use netcat
5:13:14which is just going to give me a
5:13:16connection to a server and I'm going to
5:13:19be able to type commands directly into
5:13:22the mail server. So in this case I'm
5:13:25using a Linux system that I've got here
5:13:27on my network. You can see that it's
5:13:30replying here saying that it's a Postfix
5:13:33server running on YUbuntu. And Postfix
5:13:35is a piece of software that handles
5:13:38SMTP. This says ESMTP, which is extended
5:13:43SMTP. That means that I'm going to use a
5:13:47slightly different set of commands than
5:13:49I would normally. So, what I would
5:13:51normally do would be to send a hello.
5:13:54And you can see the syntax here is hello
5:13:57host name. So, I'm just going to say
5:13:59blah.com because it doesn't much matter.
5:14:02And that's replying with its name. With
5:14:05ESMTP, I would vary that a little bit. I
5:14:09would use ehllo. And you can see again
5:14:12it very helpfully prompts me for a
5:14:14syntax and it says the syntax is ehllo
5:14:17host name. So I'm going to say ehllo
5:14:20blah.com just cuz it doesn't much
5:14:22matter. And now with ehllo I'm using
5:14:26extended smtp and it's providing me with
5:14:30all of these additional commands that I
5:14:33can use. I could use VRFY
5:14:37and I could verify an email address.
5:14:40Now, you can see here that what I've
5:14:42really gotten is kind of an ambiguous
5:14:44response. One of the reasons for that is
5:14:47VRFY can actually be a pretty dangerous
5:14:50command because what it does is it opens
5:14:53the door to spammers being able to check
5:14:55whether an email address exists or not.
5:14:58And because of that, they can start
5:15:00building up lists of valid user
5:15:02addresses and be able to have good email
5:15:06addresses that they can then sell on to
5:15:08people. So, I've actually gotten kind of
5:15:10an ambiguous response here. And one of
5:15:13the reasons is because it's not a good
5:15:16idea generally to have that command
5:15:18supported. So, while it's supported
5:15:21here, I'm not really getting a great
5:15:23response. So, how would I actually send
5:15:26mail? I would send mail doing the mail
5:15:29command and I would say mail from
5:15:32meme.com
5:15:35and that's okay. Now I would specify a
5:15:39recipient and I'm just going to say
5:15:42root. Now it doesn't actually like root.
5:15:46So let's try this again. So, I'm going
5:15:49to do my ehllo blah.com
5:15:53mail from meme.com
5:15:58rcp2.
5:16:00And let's see whether this one actually
5:16:02works. Partly I am having a problem with
5:16:06this because this is a mail server
5:16:08that's not really set up to do anything.
5:16:10It's just here for playing and that's
5:16:13actually telling me bad address syntax.
5:16:16But this is how SMTP works. You issue a
5:16:20number of commands and I would do mail
5:16:22from RCPT2
5:16:24and then if it accepted the RCPT2 so the
5:16:28recipient to line then I would type data
5:16:32and it would tell me you can start
5:16:34typing your message now. At which point
5:16:37interestingly I'd actually have to put
5:16:39the headers back in. And the reason for
5:16:42that is because these are just commands
5:16:45to the server. There's nothing that's
5:16:48actually going to show up in your
5:16:50message there. That just says this is
5:16:52who it's from. So we can verify that the
5:16:55sender is somebody that we accept and
5:16:58the recipient also somebody that we
5:17:00handle mail for and we can handle the
5:17:02recipient. The rest of it is actually
5:17:05specified in the text or the body of the
5:17:08message. So I would have a two line and
5:17:11I would have a from line and I would
5:17:13have a subject line as well. That's
5:17:16actually how that would work. And I can
5:17:18actually show you if I were to connect
5:17:22into my mail server for my particular
5:17:26domain. I would do this. And you can see
5:17:30this is also ESMTP.
5:17:32Let's just do a help first and I can
5:17:34show you a little something here. So you
5:17:36can see there's an O command and a start
5:17:39TLS. The start TLS says we're going to
5:17:43do an encrypted session. And the O says
5:17:46I'm actually going to authenticate
5:17:48before sending, which means I could send
5:17:51from anywhere in the world. And as long
5:17:53as I've authenticated, then it will
5:17:56accept messages from me. Otherwise, I
5:17:59would have a hard time sending through
5:18:01this because we have issues with open
5:18:04relays. An open relay is where anybody
5:18:07can connect to a mail server and send
5:18:09mail to anybody in the world. What I can
5:18:12do though is I can send a message to
5:18:14somebody that is handled at this
5:18:16particular mail server. So I could do
5:18:19mail from meme.com.
5:18:24And this is where we get into the
5:18:26relaying problem. It actually gets to be
5:18:28challenging to do mail unless you've got
5:18:31your own mail server. You've actually
5:18:33got to be able to do a lot of
5:18:36authentication. So, I could send mail
5:18:40using a mail client that was capable of
5:18:43doing authentication and we would be
5:18:47able to send that mail because the
5:18:49client would handle the authentication.
5:18:51There's some challenge response that
5:18:53goes along with it so that the password
5:18:56isn't actually sent in the clear and
5:18:58it's not something that I would be able
5:19:00to do just manually. So again, this is
5:19:03kind of why we do this messaging on
5:19:07local systems. And let's just see
5:19:10whether we can get mail out of here just
5:19:13because I'm on a system that this should
5:19:16actually know about and be able to
5:19:18accept messages from. I'm going to do
5:19:21mail from me at me.com RCPT2.
5:19:28and it's actually going to take that
5:19:29because I'm on the local system. So,
5:19:33it's actually going to say that's a
5:19:35network that I trust and so I'm going to
5:19:38get messages to anybody from this
5:19:41particular host because it's a network
5:19:43that I trust. So, you can either
5:19:45authenticate or you can be on a trusted
5:19:48network and an SMTP server would allow
5:19:50you to send messages through if you were
5:19:53on a trusted network. So now I would do
5:19:56data and I'm going to do two
5:20:00from
5:20:03subject is test message.
5:20:07Now I'm just going to say hi this is me.
5:20:11You can see in this line here that says
5:20:14354 end data with carriage return line
5:20:17feed dot carriage return line feed. All
5:20:20of that says you put a dot on an empty
5:20:22line and we're going to send the
5:20:24message. So you can see that it's cued.
5:20:26So the message should actually go at
5:20:28this point. Now I'm going to quit my
5:20:31session with the mail server and the
5:20:33mail should have sent at this point.
5:20:36That's how SMTP works. You can see just
5:20:39simple messages. You use mail from RCPT2
5:20:43and then data. And then again, you would
5:20:45fill in the actual bits that say to and
5:20:49from that want to be displayed inside
5:20:52the message itself. So that's how SMTP
5:20:55works. And as I said, in subsequent
5:20:57lessons, we'll talk about receiving mail
5:21:00using POP 3 and IMAP.
5:21:04In this lesson, we're going to be
5:21:05talking about POP 3. Now, POP 3 is a
5:21:09mail retrieval protocol, and we've
5:21:12talked about SMTP, which is how we get
5:21:15messages to other people. Now, if
5:21:17somebody sends a message to us, then we
5:21:19need to be able to retrieve it. So,
5:21:21let's just do a quick message here to
5:21:24myself. And I'm going to do a blah.com
5:21:30mail from meme.com
5:21:34rcpt2
5:21:37rick at localhost. And now I'm going to
5:21:41say data to
5:21:44from me atme.com
5:21:49date today
5:21:51subject how are you
5:21:55and now I can say hi this is me how are
5:22:00you doing
5:22:03now I've cued that message I can quit
5:22:06and now I can get into my mail server to
5:22:11retrieve the message. For POP 3, we've
5:22:15got 110 as the TCP port that we're going
5:22:19to connect to. So, I've connected to
5:22:22port 110 on TCP and I've got an okay
5:22:26message and that says you're okay to
5:22:28continue. So, now I'm going to log in.
5:22:30My username is Rick and my password and
5:22:34the request here is just pass. So I'm
5:22:37going to give it my password. It's going
5:22:39to say okay, meaning I've passed
5:22:42authentication at this point. So that's
5:22:44the first thing that I need to do for
5:22:46the POP 3 protocol is I need to
5:22:49authenticate. So the server knows who I
5:22:51am and what mailbox to point me to. Now
5:22:55I can do a list and I see I've got two
5:22:57messages. So I want to retrieve message
5:23:01two. You can see all of the message
5:23:04headers. It was delivered to me at
5:23:08localhost received from and here's of
5:23:11course all of the information that I put
5:23:13in. And then the mail server added a
5:23:16message ID and there's the actual
5:23:19message. So now what I can do is I can
5:23:23delete two. Now if I do a list, you can
5:23:26see there's just one message there. And
5:23:29I could actually delete that one as
5:23:32well. Now, if I do a list, I'm not
5:23:34actually going to see any messages. So,
5:23:37POP 3 is a pretty simple protocol.
5:23:40You'll see when you're using POP 3
5:23:43clients that you have things like
5:23:46whether you want to keep messages on the
5:23:48server or not. And that really has to do
5:23:51with whether it does a delete after it
5:23:54retrieves the message. If you say you
5:23:56don't want to leave messages on the
5:23:58server, it's actually going to delete
5:24:00all of the messages. It does keep track
5:24:03of the message index. So if you are
5:24:07keeping messages on the server, then we
5:24:10know what messages we have looked at
5:24:13based on this index right here. So the
5:24:16index is really just the message number.
5:24:19The message number and the message ids
5:24:22as well give us kind of where we are
5:24:25within the list of messages that are on
5:24:28the server. We've got this list of
5:24:31messages that we can manipulate as we
5:24:34need to, whether we delete them, whether
5:24:36we just retrieve them and leave them
5:24:37there or whether we retrieve and delete.
5:24:40Again, POP 3 pretty simple protocol. You
5:24:43do the authentication, then you can list
5:24:46the messages that you've got. You can
5:24:48retrieve, you can, of course, retrieve
5:24:50in any order based on giving it the
5:24:52message index number here. That allows
5:24:55me to kind of skip through as I want to.
5:24:59and be able to take a look at whatever
5:25:01messages I want and leave some of the
5:25:03other ones alone. And then of course we
5:25:06can delete and list again. As I said,
5:25:09POP 3 pretty simple, straightforward
5:25:11protocol. There are other message
5:25:14retrieval protocols. IMAP of course
5:25:16being the other big one. IMAP's really
5:25:19designed to store messages on the server
5:25:22itself. You can look at the messages,
5:25:25but IMAP's really designed to keep
5:25:27everything on the server, and we'll take
5:25:30a look at IMAP in a subsequent lesson.
5:25:34There are older versions of POP that you
5:25:36may run into very, very infrequently.
5:25:39There is a POP 2, for example. POP 3 is
5:25:42really the current version. It's the one
5:25:44you're going to see the vast majority of
5:25:47times when you connect to a POP server.
5:25:50But this is POP 3 and how POP 3 works.
5:25:56In this lesson, we're going to be
5:25:57talking about Windows file sharing. I'm
5:26:00talking about Windows file sharing, but
5:26:02frankly, the protocols are the same
5:26:04whether I'm doing Windows file sharing
5:26:06or print sharing or a lot of
5:26:08communication that goes on just between
5:26:11different Windows systems on a network.
5:26:14in terms of communicating names and
5:26:16statuses. The protocols that get used
5:26:19are really very much the same for all of
5:26:22that different functionality.
5:26:25As usual, I've got a packet capture
5:26:27here. And what I'm looking at in the
5:26:30protocol column is SMB. SMB is the
5:26:34server message block. And server message
5:26:37block is actually the protocol that is
5:26:40implemented for Windows systems to be
5:26:43able to transmit this information
5:26:46including sharing files. Now SMB has
5:26:50actually evolved from some other
5:26:52protocols. Net BIOS for example started
5:26:55in the early 1980s and it provided basic
5:26:59input output services for network
5:27:02systems. Then we had net buoy which was
5:27:05kind of a standalone protocol that
5:27:07allowed for small networks to be able to
5:27:10come up very quickly and easily and
5:27:12share information. There was LAN manager
5:27:16which was an IBM related protocol. All
5:27:19of these protocols went into the
5:27:21evolution of how Windows systems
5:27:24communicate. Now, we're at a point where
5:27:27we're using server message block, but we
5:27:29still have remnants of some of these
5:27:31other protocols. For example, you can
5:27:33see the net bios session service here.
5:27:36The real heart of this is the server
5:27:39message block protocol. We've got a
5:27:41server message block header and we've
5:27:45got an NT status here and we've got an
5:27:47SMB command. You can see the SMB command
5:27:50is trans 2 and we've got some flags.
5:27:55There's a tree ID. And what this says is
5:27:58we're looking at a Windows share that's
5:28:02at the system at the IP address
5:28:05192.168.114.129
5:28:09and the share name is test. We've also
5:28:13got a user ID here and the user ID is
5:28:162048 and that helps tell us whether
5:28:19these users are authorized to use the
5:28:22resources that they have requested.
5:28:25We've got this trans request here and
5:28:28that would be a transfer command and
5:28:32we've got a query path info and query
5:28:35path info parameters level of interest
5:28:38is just standard. What we're looking for
5:28:41is a file name and the file name is
5:28:43torture qfileinfo.ext.
5:28:46So we're checking to see about this
5:28:49particular file here. Now you can see
5:28:52that the protocols in use are pretty
5:28:54dense and there are a lot of components
5:28:58to it. Server message block is actually
5:29:01a very complex protocol in part because
5:29:04of the wide variety of functionality
5:29:07that it is required to support. We've
5:29:10got these trans 2 requests and
5:29:12responses.
5:29:14So we've got a delete request and you
5:29:17can see the SMB command is delete
5:29:21and again we're using this particular
5:29:24share the share test at this IP address
5:29:27192.168.114.129
5:29:31and again we're dealing with the same
5:29:33user ID 2048
5:29:35and the file name that we are looking to
5:29:39delete is tests file info. We've got a
5:29:43response and the response actually says
5:29:46the status is that the file is a
5:29:48directory. So we aren't actually able to
5:29:52delete this particular file because the
5:29:55files a directory. So now we're going to
5:29:57issue a delete request of tests file
5:30:00info/star.
5:30:02And what that's going to do is it's
5:30:05going to say let's delete everything in
5:30:07that directory. We've got some trans
5:30:10requests here as well. And that would be
5:30:13to get information about the files. So
5:30:17we should get a file list back from this
5:30:21particular request.
5:30:23It looks more or less like there's not
5:30:26anything in the directory because what I
5:30:28really got here was two responses. So
5:30:32I've got dot which is the current
5:30:34directory and then the other one would
5:30:37be dot dot which would be the directory
5:30:40up above. So that would be the two files
5:30:43that I found here.
5:30:47Now we're going to issue a delete
5:30:49directory request and we can also create
5:30:52a directory and we can set some
5:30:55information about files and directories
5:30:58that are there. In this case, we are
5:31:00looking to set some information on
5:31:03fname_est_18.txt.
5:31:07So, you can see here that we've got a
5:31:09lot of different types of capabilities
5:31:12and commands that can be issued. As I
5:31:14said, SMB is a very complex protocol
5:31:18just because of the wide variety of
5:31:21functionality that it has to implement.
5:31:24So there's a lot of different commands
5:31:26and each of those commands has a
5:31:29different set of information that's
5:31:31involved in making the command work. So
5:31:34we've got different statuses and
5:31:37different flags and different parameters
5:31:40based on what the request is. It's not
5:31:43as straightforward a protocol by any
5:31:45means. HTTP, for example, is a pretty
5:31:48straightforward protocol. SMTP is a
5:31:50pretty straightforward protocol. SMB
5:31:52takes a lot of time to really understand
5:31:56how it works and the different commands
5:31:59that are used. Just scrolling down
5:32:01through here, you can see all of the
5:32:04different types of commands. And of
5:32:05course, this isn't even a complete list
5:32:07of the commands that are available
5:32:09within SMB. Again, this is just a brief
5:32:13overview of SMB and some of the
5:32:15capabilities and mostly just what the
5:32:17packets look like. You can see most of
5:32:20the time it's going to be over TCP.
5:32:22You're going to have a short header for
5:32:24the net bios session service because
5:32:27that's just still there. And then of
5:32:29course we get into the server message
5:32:31block protocol and all of the
5:32:34information that is carried within it.
5:32:36And again depending on the different
5:32:39command that has been issued, you're
5:32:41going to have some variable set of
5:32:43information and parameters within each
5:32:46individual packet. If you want to learn
5:32:49more about the server message block and
5:32:52all of the different commands that are
5:32:54supported and really understand it at a
5:32:56much much deeper level, you should read
5:32:58the documentation that's available at
5:33:01microsoft.com.
5:33:03Wireshark is really helpful when you
5:33:05want to look deeply inside messages that
5:33:09are on the wire and see how it actually
5:33:12looks when it's being implemented and
5:33:15used. There's a big difference between
5:33:18simply looking at documentation and the
5:33:20different status codes and actually
5:33:22following a request as it goes through.
5:33:26For example, we've got a delete request
5:33:29and you can follow this delete request
5:33:31in the messages back and forth. Being
5:33:34able to see those messages and the
5:33:36different parameters within them here
5:33:38within Wireshark is really important.
5:33:40and it's a much much different
5:33:42experience than just simply reading
5:33:44documentation in a book or on a web
5:33:46page.
5:33:49In this lesson, we're going to be
5:33:51talking about DNS basics. DNS is the
5:33:54domain name system and it's the system
5:33:58or set of protocols and procedures that
5:34:01we use to be able to look up host names
5:34:04from IP addresses and IP addresses from
5:34:07host names. So it's really this global
5:34:10database if you will of storing
5:34:13information that allows us to have a set
5:34:16of information that the computer uses
5:34:18which is the IP address and also have a
5:34:21set of information that we would use
5:34:23which would be domains and host names.
5:34:26We are not capable really of memorizing
5:34:29a whole lot of IP addresses. So, we
5:34:31really need host names, but the computer
5:34:33can't really use host names directly.
5:34:36And so, what it needs is a set of IP
5:34:38addresses. DNS uses a hierarchy. The
5:34:42hierarchy is really sort of a tree
5:34:45structure. What we've got here is a
5:34:47sample of what we call top level domains
5:34:50or TLDDs. These are some of the early
5:34:53ones. We've got.com and.net and.org. Of
5:34:56course, there are a whole lot of others.
5:34:59There are country codes. For example, US
5:35:02would be the United States.UK would be
5:35:05the United Kingdom. All of the different
5:35:07countries around the world have their
5:35:09own country codes and those are top
5:35:11level domains as well. There are really
5:35:14a set of DNS servers that actually store
5:35:17information about all of the different
5:35:21entries in these different top level
5:35:23domains. So, for example, we've got
5:35:25Google here. If I wanted to find some
5:35:28information about one of the host names
5:35:30at Google, let's just say that we had
5:35:34another domain that was labs.google.com.
5:35:38And what I was really looking for was
5:35:41the host www.labs.google.com.
5:35:46As I said, this is a tree structure. And
5:35:48so we do this thing called a recursive
5:35:51lookup. So the first place that we are
5:35:53going to go is the DNS server for
5:35:56the.com domain which is going to provide
5:36:00me information on where to go to get
5:36:03something about the google.com domain.
5:36:07So the first place I'm going to start is
5:36:09the dot level. So we're going to work
5:36:11right to left when we're talking about
5:36:14parsing a host name. So, I've got to go
5:36:16to the DNS server that handles the dot
5:36:20top level domain, and I'm going to ask
5:36:23it about Google. Then, this is where we
5:36:25get into the recursive bit. I'm going to
5:36:28go ask Google about labs.google.com.
5:36:33Once I have got that information, now I
5:36:35can go to the DNS server for
5:36:37labs.google.com
5:36:39and I can ask it about the specific host
5:36:42name that I want, which is www.labs
5:36:45labs.google.com.
5:36:47So we've got this recursive structure
5:36:50around how we do queries. So I ask the
5:36:53top level domain in order to figure out
5:36:55the second level domain. And if there's
5:36:58something beyond that, then I need to
5:36:59ask the second level domain about the
5:37:02third level domain. So in order to look
5:37:04up the host name www.labs.google.com,
5:37:08which is a fully qualified domain name,
5:37:11I start at the top. Then I move down and
5:37:13I move down until finally I can ask the
5:37:16DNS server here about this specific host
5:37:20name. That's the hierarchical nature of
5:37:23DNS. And DNS servers actually store
5:37:27information about where the root servers
5:37:31are. The root servers are the set of
5:37:34servers that manage the top level
5:37:36domain. I've got all of my root servers
5:37:39here. And this is a cache file that's on
5:37:42a DNS server that's running on Linux. So
5:37:45there needs to be this set of hints for
5:37:47the DNS servers that are all local to be
5:37:51able to look up the top level domains.
5:37:54So I'm going to ask my local DNS server
5:37:58and the first thing it's going to do is
5:38:00it's going to figure out which of these
5:38:02root servers it needs to ask about the
5:38:05top level domain. The queries all
5:38:07originate locally. So I ask my local DNS
5:38:11server and then it goes off and does the
5:38:13recursive query unless of course the
5:38:15information is stored in its cache
5:38:17because it's going to actually keep
5:38:20information for some period of time in
5:38:22order to prevent a whole lot of
5:38:24questions being asked over the network.
5:38:26Keeping the information locally or
5:38:28caching it locally helps speed that
5:38:31process up a lot. The first time you go
5:38:33to a web server, for example, it may
5:38:35take a little bit longer because they're
5:38:37doing the DNS lookup. Every subsequent
5:38:40time you go to that web server until the
5:38:43cache times out, you're using the local
5:38:45copy of that IP address to host name
5:38:48match and the local server will reply to
5:38:52you with that information and it won't
5:38:55have to go ask again. So, it's much much
5:38:57faster. Here are all of the hint files.
5:39:00You can see actually the different
5:39:02organizations that formerly held these
5:39:05root servers and the root servers may
5:39:08very well still be in these locations,
5:39:10but we've standardized the names now
5:39:13rather than using the older names that
5:39:16we had previously used. These are all of
5:39:18the root servers and they manage all of
5:39:21the top level domains. They have all of
5:39:24the information about the second level
5:39:26domains that exist under their top level
5:39:28domains. So that's the basics of DNS and
5:39:32how DNS operates.
5:39:36In this lesson, we're going to be
5:39:38talking about the DNS protocol. DNS, of
5:39:41course, is the domain name system, and
5:39:44DNS is a way of looking up IP addresses
5:39:47from host names. Well, why do we need to
5:39:50do that? because the computer can't
5:39:53actually use the host names that we use,
5:39:57which look more or less like English.
5:39:59www.microsoft.com,
5:40:02for example. We would have a website or
5:40:05a web address that's easy for us to
5:40:08remember as opposed to the IP address
5:40:11that the computer actually needs to be
5:40:13able to make the connection. because we
5:40:16can't remember IP addresses easily. We
5:40:19need host names to be able to go to and
5:40:21domain names to be able to go to. So, as
5:40:24a result, we need some system that's
5:40:27capable of doing that lookup for us. DNS
5:40:30actually is capable of handling several
5:40:33different functions. One of which is to
5:40:36look up an IP address from a host name.
5:40:39Another one is to look up a host name
5:40:42from an IP address. I've got a packet
5:40:45capture here where we've got some DNS
5:40:48packets. Here's the DNS query and you
5:40:52can see that it sits on top of UDP. Now,
5:40:56why does it sit on top of UDP? The
5:40:58reason it sits on top of UDP is I don't
5:41:01actually want to take the time to
5:41:02establish a connection to a DNS server.
5:41:05What I want is to have multiple DNS
5:41:07servers and I'm going to just fire a
5:41:10query out to the first server. If I
5:41:12don't get a response in a reasonable
5:41:14amount of time, I'm going to fire a
5:41:16query out to my second server and so on
5:41:18until I get a response. Because we're
5:41:21not connectionoriented, it doesn't
5:41:23really matter whether my first DNS
5:41:26server responds after I've sent the
5:41:29request to the second server. Because if
5:41:31I get the response from the second
5:41:33server, I've already got the query
5:41:35answered. So, I'm just going to discard
5:41:38the second reply and I'm going to go
5:41:40with the first reply that I get. Here's
5:41:42where we're doing a query. So, again,
5:41:45it's on top of UDP. And here's actually
5:41:48the DNS query itself.
5:41:52So, we've got some flags here saying
5:41:54this is a standard query. And we've got
5:41:57one question here. I could actually have
5:41:59multiple questions, but I've only got
5:42:01one question. And what's my query? Well,
5:42:04my query is I've got a host name here
5:42:09and what I want is a host address. So,
5:42:11I'm doing an A record lookup. So, there
5:42:15are several records that DNS supports.
5:42:18The A record or address record is one of
5:42:21them. So, I want the IP address based on
5:42:25this particular host name. I could also
5:42:28do a reverse lookup of the IP address
5:42:32and get a host name from it. So, here's
5:42:35actually where we've got the reply. You
5:42:37can see the DNS response and we've got
5:42:41flags that indicate this is a response
5:42:44to a query. Recursion is desired.
5:42:47Recursion is available. The server is
5:42:50capable of doing recursive queries. Now,
5:42:53some servers may actually not be able to
5:42:56do recursive queries, meaning they can't
5:42:58go to the root servers and be able to do
5:43:01lookups. The only thing those servers
5:43:03are capable of doing is responding about
5:43:07the particular DNS entries that they
5:43:10know about the host names and the IP
5:43:12addresses that they have been configured
5:43:14with. So, here's the query. We are
5:43:17looking again for www.google.com.
5:43:20We are looking for a host address from
5:43:24this host name. Here's actually my
5:43:27answer. In this case, I've actually got
5:43:29several different replies. There are
5:43:32several IP addresses that match this
5:43:34particular host name. You can see that
5:43:38we've got the same information here on
5:43:40all of them, of course, other than the
5:43:42address. So, I've got the name and it's
5:43:44an A record. I've got a time to live,
5:43:47which means this is how long this data
5:43:50is going to be considered good before
5:43:52you really need to ask again. The data
5:43:55length is actually four bytes. I'm going
5:43:58to copy this value here because I'm
5:44:01going to do a reverse lookup on it. So,
5:44:04you can see all of this information and
5:44:07this is all of the different IP
5:44:10addresses that match this particular
5:44:12host name. Now we can look at another
5:44:15lookup here. And this is just a simple
5:44:19lookup of a web server. Looks like we're
5:44:23actually going to get two replies. One
5:44:25says it's a CNAME, which is a canonical
5:44:28name or an alias. The primary name is
5:44:31was here.com. Now, we're going to look
5:44:34up was here, and find that it actually
5:44:36has this IP address. We looked up
5:44:40www.wuzere.com, was here.com discovered
5:44:42it was an alias for was here.com and
5:44:45looked up was here.com and now we've got
5:44:47the IP address. What I can do is do a
5:44:51reverse lookup on the IP address
5:44:5474.125.131.103.
5:44:59So I've done a reverse lookup and that's
5:45:01what this indicates here. The ptr says I
5:45:04really want the name the host name of
5:45:08this IP address. What I have discovered
5:45:11here is that there is no host name for
5:45:14this IP address. So there's no reverse
5:45:16entry. There's no way of looking up a
5:45:19host name for this particular IP
5:45:21address. Just going to verify that with
5:45:24another tool here. This tool indicates
5:45:28that we've got a host name of
5:45:31VC-in-f1031e00.net,
5:45:37net which is not actually what we got
5:45:40using dig. So host actually gives me a
5:45:43slightly different response. But what I
5:45:45can do is do reverse queries and get
5:45:49host names from IP addresses. And of
5:45:52course what you'll commonly use is DNS
5:45:56to get IP addresses from host names. So
5:45:59that's what DNS looks like both from a
5:46:02functional perspective as well as a
5:46:04protocol perspective.
5:46:08In this lesson, we're going to be
5:46:09talking about firewalls. Firewalls are
5:46:12either devices or pieces of software
5:46:16that can allow or prevent network
5:46:19traffic. The idea behind a firewall is
5:46:23that it can protect your network or
5:46:26maybe even your device. A firewall can
5:46:29sit in front of a network and protect
5:46:31the network or it can actually reside on
5:46:34your computer. computer itself and
5:46:36protect your computer. Windows, for
5:46:39example, has a firewall built into the
5:46:42device. Apple has a firewall that's
5:46:45built into the software. And you can
5:46:48also get these hardware devices. And
5:46:51you'll see things, for example, on your
5:46:55DSL modem, you'll find cases where
5:46:59there's a firewall.
5:47:01So, I can bring up a DSL modem here, and
5:47:05we should be able to take a look at the
5:47:08firewall settings. You can see the
5:47:09firewall settings here. We've got
5:47:12several possibilities. There's maximum
5:47:16security, typical security, minimum
5:47:18security, and then of course down here
5:47:20we've got custom security where we can
5:47:23do our own custom rules inside the
5:47:27firewall. We can do things like port
5:47:29forwarding and we can set up a DMZ host.
5:47:33So there are a number of companies that
5:47:36are involved in creating firewalls.
5:47:39Checkpoint is a pretty big firewall
5:47:42vendor. They do a lot of security
5:47:44appliances. So it's their software
5:47:47running on a really industrial-grade
5:47:51piece of hardware. Cisco of course has
5:47:54firewalls as well. And you can actually
5:47:57embed software for their firewalls
5:48:00inside of their routers or you can buy
5:48:03their adaptive security appliances that
5:48:06will also do some firewalling.
5:48:09So there's lots of different ways to
5:48:12implement a firewall and it of course
5:48:14depends on the needs of your network or
5:48:18yourself. There's a handful of different
5:48:21types of firewalls as well. So initially
5:48:24we just had very simple packet filters
5:48:27and they were capable of dropping or
5:48:30allowing packets based on very simple
5:48:33rules. And then we got stateful
5:48:36firewalls and the idea of a stateful
5:48:38firewall is it actually keeps track of
5:48:41whether connections are open or not. And
5:48:44finally, we have application layer
5:48:46firewalls. And those are firewalls that
5:48:49are more specific about what they know
5:48:52about particular application protocols.
5:48:55So they can allow good protocol commands
5:48:58and disallow bad protocol commands and
5:49:01that protects the application itself
5:49:03from crashing based on malformed
5:49:06requests. So, there's a lot of different
5:49:09types of firewalls and there are
5:49:11probably firewalls embedded in devices
5:49:14that you use on a pretty regular basis.
5:49:16We're actually going to go through some
5:49:19firewall configuration in the coming
5:49:23lessons here and we'll also go through
5:49:25some just basic packet filtering as
5:49:28well.
5:49:31In this lesson, we're going to be
5:49:32talking about stateful firewalls. I've
5:49:35got Linux running here and Linux
5:49:37actually includes a stateful firewall or
5:49:40has the capability of including a
5:49:41stateful firewall and that stateful
5:49:43firewall is called IP tables. IP tables
5:49:47is something that you typically
5:49:50configure using a set of text rules
5:49:54although you can actually get graphical
5:49:56interfaces for it that can make
5:49:58configuration easier. But today we're
5:50:01just going to do some very basic
5:50:04configuration here. The first thing I
5:50:06want to do is I'm going to set a rule
5:50:09that's going to append to the output
5:50:13chain. IP tables actually has the
5:50:15concept of rule chains. And there are by
5:50:19default rule chains for input, output,
5:50:21and forwarding. In the output chain,
5:50:24this is going to affect traffic that's
5:50:26going out from this particular system.
5:50:29So, I'm going to go on the output chain
5:50:31and I'm going to say the protocol is TCP
5:50:35and I'm going to say minusm state
5:50:37because we're going to filter based on
5:50:40state and the state I'm going to filter
5:50:44based on is new. So, anything new
5:50:48leaving this system is going to get
5:50:50dropped. So, I'm going to try to connect
5:50:53to Google on port 80.
5:50:56We're not actually getting much of
5:50:58anywhere.
5:51:00So if I flush that rule now
5:51:04and try that connection again, now I get
5:51:07through.
5:51:11And let me just put it back in place
5:51:13here. And now I can show you the list of
5:51:16IP tables rules that are in place. So
5:51:19you can see there's only one rule here
5:51:22and it's a drop rule. And you can see
5:51:25we've actually caught 66 bytes with it.
5:51:28This is from any to any. It doesn't
5:51:31matter where it's going or where it's
5:51:33coming from. If the state is new, we're
5:51:36just going to drop it. See the target
5:51:37here is drop. So I'm going to flush the
5:51:40rules again. Again, I'm going to work on
5:51:43the output chain because it's easier to
5:51:44demonstrate sitting on the box. If I'm
5:51:47trying to do something from outside and
5:51:49I get the rules wrong, then I run the
5:51:52risk of locking myself out. So, I'm
5:51:54working on the box and it's just easier
5:51:56to demonstrate output rules based on
5:51:59that. Although the same types of rules
5:52:01apply on the inbound chain and the
5:52:03forward chain as well. So here what I
5:52:06want to do is say protocol ICMP. I'm
5:52:09going to do minus M state is new minus J
5:52:15drop. You'll see here that ICMP is not a
5:52:19protocol that actually has a concept of
5:52:21state. So, IP tables is actually going
5:52:24to keep track of that for us, whether
5:52:27the protocol is stateful or not. It's
5:52:29actually going to keep a table of the
5:52:32state of various connections. So, I'm
5:52:35going to ping 192.168.1.1.
5:52:39And I can't actually do that. So, let's
5:52:42flush the rules again. And now let's do
5:52:45the ping and see now it works because
5:52:47the rule in the IP tables rule set is
5:52:51gone. I can also filter based on
5:52:54specific ports. Going to append to the
5:52:58output chain again and I'm going to do
5:53:01PTCP
5:53:03dport is going to be 80. So I can
5:53:07connect to any other port other than
5:53:09port 80. Now I'm going to do the minus m
5:53:12state again. state is new or I could do
5:53:16established as well or even related. So
5:53:20basically any state is going to be
5:53:23disallowed if it's port 80. Now I'm
5:53:25going to say J is drop.
5:53:28Let's try Google again. Port 80.
5:53:34I get nothing. Let's try the same host
5:53:39on port 443. See now I get connected
5:53:43because of course I am connecting on a
5:53:46port other than port 80. You can see I'm
5:53:50doing different states here not just new
5:53:52states but established and related
5:53:54states as well. So those are the
5:53:56different states that IP tables
5:53:58understands. I could for example
5:54:01disallow new on input but allow
5:54:05established or related on input and then
5:54:08only allow new on the output. So I could
5:54:11for example connect outbound and it
5:54:14would allow those return connections
5:54:17coming back in but anything else would
5:54:19be dropped. I can do a lot of different
5:54:22things with IP tables. just really
5:54:24barely scratched the surface of some of
5:54:27the things that we can do with IP
5:54:28tables, but I did want to show you the
5:54:31different states that we're capable of
5:54:34keeping track of in IP tables and the
5:54:38ways that we can block messages based on
5:54:42the state of the connection. And again,
5:54:43with TCP, with state, we're talking
5:54:45about the three-way handshake. With UDP,
5:54:48of course, there's no state. So, IP
5:54:51tables actually has to keep track of if
5:54:53something's gone out and then we'll know
5:54:56whether something comes back again or
5:54:58not. That's just a little bit about IP
5:55:00tables as a stateful firewall.
5:55:06In this lesson, we're going to be
5:55:07talking about access control lists. Now,
5:55:10an access control list is something that
5:55:12could typically run inside of a router.
5:55:15And what I've got here is the emulation
5:55:18of a router. So, I don't actually have a
5:55:20router that I'm connected to, but I am
5:55:22running router software inside of an
5:55:25emulator, and I'm going to keep getting
5:55:27error messages because, of course, I'm
5:55:29sitting on the console, and anytime
5:55:31something happens, I'm going to get
5:55:33messages. So, we're going to have to
5:55:35work through that. I'm going to go into
5:55:38configuration mode, and I'm going to add
5:55:41an extended access list, which gives me
5:55:44some additional capabilities.
5:55:47Now if I ask for a little bit of help
5:55:49here, I can say permit.
5:55:52Then it wants to know which protocol
5:55:54that I want to permit. So I can do TCP.
5:55:58Now it wants to know the source address.
5:56:01So I could do any. I could specify a
5:56:04destination address. I could do
5:56:07192.168.1.245
5:56:10as an example.
5:56:12Now it wants to know the wildcard bits
5:56:16which would be 0.0.0.0
5:56:19in this case because we're not talking
5:56:21about subnet masks. We're talking about
5:56:23Cisco wildcard bits which are really
5:56:26sort of the inverse of what a subnet
5:56:29mask would look like. Now I can do
5:56:33things like equal 80 as an example. So
5:56:37now I've got an access list that allows
5:56:40packets coming in on port 80. I could
5:56:44also do something like access list 101
5:56:49deny.
5:56:51And now I could deny for example ICMP
5:56:57access list 101 deny ICMP
5:57:02any any. And I can save that. And now I
5:57:06could do show access list 101.
5:57:11And here are my two access list entries.
5:57:15So I'm permitting TCP on the web port.
5:57:18So I've got equals www. And now I'm
5:57:22denying ICMP from any host to any host.
5:57:27And in this case, I'm doing an access
5:57:30list specifically for this host right
5:57:32here, 192.168.1.2.
5:57:35245.
5:57:36That's just a little bit about access
5:57:38list. Of course, you could see as we
5:57:40went through, I can do a lot of
5:57:43different things with access lists. I
5:57:46can deny, I can have a dynamic, I can
5:57:50permit, and I could actually just do a
5:57:53remark here, which would put a comment
5:57:54in. So, if I did a permit, now I can do
5:57:58a lot of different protocols here. And
5:58:00based on the protocol, I've got other
5:58:03options that I can set. I've got a lot
5:58:05of capabilities here, even within just
5:58:08simple access lists. These access lists
5:58:11shouldn't be used as something that you
5:58:14would replace a stateful firewall with,
5:58:18but it really makes a good way of doing
5:58:21some basic filtering at the edge of the
5:58:24network, maybe before you get to the
5:58:26firewall and take some of the load off
5:58:28the firewall and just knock down some of
5:58:31the just real dumb things that may be
5:58:34entering your network. So that's access
5:58:36control lists. And in this specific
5:58:39case, we were looking at access control
5:58:41lists on a Cisco router in emulation.
5:58:47In this lesson, we'll be talking about
5:58:49application layer firewalls. Application
5:58:52layer firewalls sound like kind of a big
5:58:54concept, and yet it's pretty common to
5:58:57see application layer firewalls in a
5:59:00business situation. Although you may not
5:59:02necessarily think of what you're doing
5:59:05as an application layer firewall.
5:59:07Basically, an application firewall is
5:59:10something that's capable of
5:59:12understanding the application protocol
5:59:15and making determinations about what to
5:59:17do based on the protocol commands that
5:59:21are coming through. A basic application
5:59:24firewall and one that's pretty common to
5:59:26see is a proxy server. I've actually got
5:59:29one right here or this is the
5:59:31configuration for a proxy server. I've
5:59:33got the proxy server Squid and this runs
5:59:36on Linux and you can see the different
5:59:39sorts of things that we can configure
5:59:42inside the proxy server. For example, I
5:59:45could do some rate limiting with the
5:59:48proxy server. I can make sure that we're
5:59:52using particular protocols. I can block
5:59:56based on different types of websites.
6:00:00That's one thing a proxy server is
6:00:02pretty good for is being able to make
6:00:05sure that the users of the proxy server
6:00:08are going to websites that are actually
6:00:11approved or acceptable. So, this would
6:00:14be a good thing, for example, to use in
6:00:16a school. You're protecting the students
6:00:19from being able to either accidentally
6:00:21or on purpose go to things like porn or
6:00:24gambling sites, as an example. And of
6:00:27course, you could do the same thing in a
6:00:29business situation. You can keep people
6:00:31from parking themselves on ESPN, for
6:00:35example, and just reading sports news
6:00:37all day long. Proxy servers are good for
6:00:39that. You can also use a proxy server to
6:00:43do things like check for malware as the
6:00:47connection is running through the proxy
6:00:49server. So, you can do a lot of
6:00:51different things with a proxy server.
6:00:54And configuring a proxy server is
6:00:56actually pretty simple. Just as an
6:00:59example, I'm going to go to the
6:01:02preferences under Firefox. And the
6:01:05reason I'm using Firefox instead of a
6:01:07different browser, it's a little bit
6:01:08easier to see under Firefox because
6:01:11Chrome and Safari use some default
6:01:13network settings. And in this case, I'm
6:01:16doing it right inside the browser. And I
6:01:18can actually make it very clear what
6:01:21we're doing. So, if I go to advanced,
6:01:24then network, I go to settings, you can
6:01:27see I've got the ability to do no proxy
6:01:29or I can do a manual proxy
6:01:31configuration. So, in this case, I
6:01:34actually had a proxy server set up on my
6:01:36local system, which is what this is.
6:01:39What the browser is actually going to do
6:01:41is it's going to make a connection to
6:01:43port 8080 on my local system. Then that
6:01:48proxy server will forward the request on
6:01:50on behalf of me and my browser and the
6:01:54request will come back through the proxy
6:01:56server which is how we can do things
6:01:58like filtering. And with proxy servers
6:02:00you can also do caching and so it helps
6:02:04actually speed up your web browsing on
6:02:06your network. So we've got a Cisco ASA
6:02:09as another example here. It will do
6:02:12application layer protocol inspection.
6:02:14And that gives us the ability to do
6:02:17things like protect our mail servers
6:02:19from malformed network requests or
6:02:22protect our web servers from malformed
6:02:24HTTP requests. We've got another example
6:02:28here of a device that is an application
6:02:31layer firewall. Specifically, Blue Coat
6:02:33actually makes proxy servers that are
6:02:36pretty commonly used and they do these
6:02:40proxy servers that have functionality so
6:02:44you can protect your systems from
6:02:47malware and also do the site blocking
6:02:51and all of the other things that help
6:02:54protect your enterprise environment. So
6:02:57application layer firewalls come in a
6:03:00lot of different types based on the
6:03:02application. Another application layer
6:03:05firewall is for voice over IP and it's
6:03:09called a session border controller.
6:03:11There's a company called Acme Packet and
6:03:14they make session border controllers and
6:03:16they have the capability of doing a lot
6:03:18of different things based on the
6:03:21application. So they can do rate
6:03:23limiting for example. They can do
6:03:25bandwidth policing to make sure that
6:03:27you're not using too much bandwidth
6:03:29based on the codec that you're using.
6:03:32Acme packet makes another type of
6:03:35application layer firewall. In this case
6:03:37it happens to use VOIPE protocols
6:03:41instead of just a web protocol or a more
6:03:43common protocol that you would see on a
6:03:45more regular basis. Acme packet makes
6:03:48VOIPE application layer gateways. So
6:03:52there are several different types of
6:03:54application layer firewalls. We've got
6:03:57proxy servers. We've got session border
6:03:59controllers. We've got things like the
6:04:02Cisco ASA that just do standard kind of
6:04:05protocol fix up in denying malformed
6:04:08packets to come through. But at the end
6:04:11of the day, what they really are is
6:04:13application layer firewalls. And again,
6:04:16they're specific to the particular
6:04:19application protocol that's in use.
6:04:24In this lesson, we're going to be
6:04:25talking about intrusion detection.
6:04:28Intrusion detection is based on an
6:04:31examination of the packets as they
6:04:34either come through the network or come
6:04:36to a particular device. So in this case,
6:04:38we're talking about network intrusion
6:04:40detection. And so they are looking at
6:04:43messages passing over the network and
6:04:46they're comparing those messages against
6:04:48particular signatures. Maybe if you're
6:04:51looking for a back orifice connection or
6:04:56maybe a Zeus connection or something
6:04:58like that, you'd be looking for either a
6:05:00particular port or a particular packet
6:05:03signature. So intrusion detection is
6:05:07something that you would see pretty
6:05:09commonly in larger networks and you have
6:05:12the ability to configure a lot of
6:05:15different rules to look for different
6:05:17things. Right here what I'm actually
6:05:20running is a piece of software called
6:05:22Snort. And this is actually a web front
6:05:25end to Snort to look at rules. And so
6:05:29you've got the basic analysis and
6:05:31security engine. And this is actually a
6:05:34piece of software called Acid Base. I
6:05:37can take a look at the different alerts
6:05:40that came in today. And so I've got a
6:05:44number of alerts based on bad traffic,
6:05:47same source and destination. So this is
6:05:50the signature and this is the ID. I can
6:05:55also look up more information about this
6:05:57particular signature on Snort or in Bug
6:06:00Track or CVE. We've got information
6:06:03about the specifics. So I've got a
6:06:05source address and a destination
6:06:07address. And then I've got the layer
6:06:09protocol. So if I click on the source
6:06:12address, it gives me some additional
6:06:15detail here. I've got a number of
6:06:17sensors. I've got occurrences as the
6:06:20source address for this particular IP
6:06:22address. So, I've actually got 169,653
6:06:28entries as the source address through
6:06:32this particular intrusion detection
6:06:35device. So, I could check for port
6:06:38scans. And so, actually, what we've got
6:06:41here is an error. No file was specified
6:06:44in the port scan file variable. I'm
6:06:47going to go back home and see whether
6:06:50there's anything else. Let's take a look
6:06:52at the last source ports for TCP and see
6:06:55what we get. So, we've got this one
6:06:58here, and it looks like the source port
6:07:01is 80. And I've got 663 occurrences
6:07:06going back to August 4th of last year.
6:07:10So, I could look up the information at
6:07:13SANS about this particular alert and see
6:07:16what it has to say. Actually, what it's
6:07:19looking up is the port and port 80, of
6:07:22course, is the web port. So, this is a
6:07:25threat level of green, meaning it's
6:07:27pretty safe. So, we've got several other
6:07:31ports here that we could end up looking
6:07:33up more information about. And again,
6:07:36you could look at SANS for information
6:07:38about the particular port. This is just
6:07:42a pretty basic interface to an intrusion
6:07:45detection system. And the thing about
6:07:47intrusion detection systems again is
6:07:49they're based on rules or signatures.
6:07:53You have to create a rule, which means
6:07:55you have to know what it is you're
6:07:57looking for. Without telling the IDS
6:08:01what you're looking for, it has no
6:08:03ability to know what's good or bad. You
6:08:05actually have to tell it. There's a
6:08:07pretty high potential for false
6:08:09positives here if the server is
6:08:12misconfigured or if there's a rule that
6:08:16you probably don't want turned on based
6:08:18on the amount of traffic because you're
6:08:20going to get a high level of alerts for
6:08:22it. So intrusion detection can actually
6:08:25take a lot of care and feeding just to
6:08:28be able to run effectively. And again,
6:08:32you can see there's an awful lot of
6:08:33information in this one. And not all of
6:08:36it is all that useful. A lot of it,
6:08:39frankly, is bogus. I can take a look at
6:08:43the listing here. And I've got this bad
6:08:45traffic, same source and destination.
6:08:48Well, this is a multiccast address, and
6:08:50it's MP. So, it's not actually bad
6:08:54messages per se, but for whatever
6:08:56reason, those IGMP messages have gotten
6:08:59caught by this IDS. So that's where it
6:09:02takes a lot of work to do the
6:09:04configuration for intrusion detection
6:09:06and it also takes understanding the
6:09:09individual protocols so that you can
6:09:12actually write rules for the IDS. You
6:09:14have to know what the protocol headers
6:09:17and commands are so that you could write
6:09:20the rules and actually catch bad or
6:09:23malicious traffic. So intrusion
6:09:25detection is another way of doing
6:09:29network analysis at the protocol level.
6:09:34In this lesson, we're going to be
6:09:36talking about spoofing traffic. There is
6:09:38a lot of different ways of spoofing
6:09:41traffic. And one of the things that's
6:09:43pretty interesting is the way that we
6:09:45can do maninthe-middle attacks by
6:09:47spoofing addresses. So I've got a piece
6:09:50of software here called Edercap. What
6:09:53EderCap will do is it will spoof based
6:09:57on ARP or the address resolution
6:10:00protocol which we've looked at
6:10:01previously. So I'm going to do some
6:10:04spoofing based on ARP. The first thing I
6:10:07want to do is find all of the hosts on
6:10:10the network. And so I'm going to bring
6:10:12up my host list. This is my router, the
6:10:15192.168.1.1.
6:10:17I'm going to add that to target one. And
6:10:19then I'm just going to pick a bunch of
6:10:22other devices and add them to target
6:10:26two. And now what I can do is just do an
6:10:31ARP poisoning.
6:10:34So what I want to do over here is run
6:10:37TCP dump. And TCP dump is like Wireshark
6:10:40that we've been looking at previously,
6:10:42but it's a command line tool. And we're
6:10:45not actually going to dig into the
6:10:49actual packets. We just want to see
6:10:51where they're going to. So, we're doing
6:10:54a man-in-the-middle attack here.
6:10:57This is actually the man-in-the-middle
6:10:58attack right here. We've got a whole lot
6:11:02of devices that were basically telling
6:11:06the network that this device is actually
6:11:09at my MAC address. So the physical
6:11:13address is being used to populate the
6:11:17network's ARP caches so that basically
6:11:21all traffic comes to me rather than
6:11:24anyone else. Let's actually kill this
6:11:27for just a second so we can take a look
6:11:29at one of the things. Opus is actually
6:11:33this system here. There are a couple of
6:11:36messages here that I wouldn't normally
6:11:39see because I am on a switched network
6:11:42and so only messages directed to me come
6:11:45to me. Here's one for example. So we've
6:11:49got something from apple.com going to
6:11:52Oliver. And here's another one right
6:11:55here. Now these are messages that
6:11:57wouldn't normally go to me because I'm
6:12:00not actually Oliver. But what I've done
6:12:02here is I've told the network that I am
6:12:05Oliver as well as a number of other
6:12:07devices. And so I can get traffic to
6:12:10come to me rather than these other
6:12:13systems. Now, of course, I have to
6:12:15forward that traffic back out to them.
6:12:18Otherwise, it's pretty obvious that
6:12:20something bad is going on and people can
6:12:23start noticing that their connections
6:12:25aren't completing and all of the things
6:12:27that they normally do on the network
6:12:29aren't working. in which case they'll
6:12:31start calling somebody and it's pretty
6:12:33easy to figure out what's going on
6:12:35because they're going to see a whole lot
6:12:37of ARP messages going out saying I am
6:12:41these other IP addresses. So, one of the
6:12:44reasons that this works is because ARP
6:12:46has no authentication at all. The
6:12:48systems are pretty trusting. So, if I
6:12:51send out a bunch of these ARP messages
6:12:53with no requests to match them, systems
6:12:57are going to say, "Oh, well, I should
6:12:59probably keep track of that
6:13:01information." They're going to put it in
6:13:02their cache. And so, anytime they try to
6:13:05go to that particular IP address,
6:13:07they're going to look it up in their ARP
6:13:09cache, find that that IP address, or
6:13:12frankly all of the IP addresses come to
6:13:14my MAC address. And so, they're just
6:13:16going to forward all of their messages
6:13:17to me. So that's one way of doing
6:13:21traffic spoofing and we're actually
6:13:24spoofing addresses in that case in order
6:13:28to get traffic directed to us. In other
6:13:32lessons, we'll be talking about how to
6:13:34actually create false addresses at
6:13:37higher levels and we'll be doing that
6:13:40with some other tools.
6:13:43In this lesson, we're going to be
6:13:45talking about malicious traffic. Now,
6:13:47there's actually several kinds of
6:13:48malicious traffic. And sometimes there's
6:13:51actually traffic that appears to be
6:13:53malicious, although it may be just a
6:13:55problem with either a mistaken
6:13:58configuration or a piece of equipment
6:14:00that's maybe about to fail. What I'm
6:14:04actually going to look at though is a
6:14:05couple of different types of attacks.
6:14:07And a lot of these attacks actually have
6:14:10been mitigated by fixing the TCP IP
6:14:13stacks in the operating systems. We're
6:14:16going to be looking at a particular
6:14:19attack shortly where it's actually been
6:14:22fixed because it has to do with some
6:14:27data that's really not correct and it
6:14:30should have been ignored. But the first
6:14:32thing I want to look at is something
6:14:34that's called a sin flood. Now a sin
6:14:37flood has to do with the sin flag in the
6:14:39TCP header. We've got the sin flag set.
6:14:44Now, as you'll remember, a sin flag is
6:14:46actually the first step in the three-way
6:14:48handshake. And so, what we should expect
6:14:51back from this is a sin act from the
6:14:54recipient. What actually happens here is
6:14:58we've spoofed the source address. So,
6:15:00this is a forged source address. And so,
6:15:04the destination here is not going to
6:15:06reply to the system that actually sent
6:15:10the message. It's actually going to
6:15:12reply to this source address. And you
6:15:15can see there's a lot of random source
6:15:17addresses here. And the idea behind this
6:15:20is a system can only take in so many
6:15:23connections before the connection buffer
6:15:26is actually full. Any system has some
6:15:30maximum number of connections it can
6:15:32take. And in addition to that, it's got
6:15:35some maximum number, probably a not huge
6:15:39number of halfopen connections that it
6:15:42can accept before it has to start
6:15:44rejecting them because it's waiting for
6:15:46these halfopen connections to actually
6:15:50complete. So a halfopen is when I send a
6:15:53sin to a another system and that other
6:15:58system is going to respond with a sin
6:16:01act. Now, that other system is going to
6:16:03consider this particular communication
6:16:06halfopen until it receives an act back
6:16:09from me. In this case, because we've got
6:16:12a spoofed source address here, we're
6:16:14never actually going to get the act back
6:16:18because this source address here is
6:16:20spoofed. Now, if I do this from enough
6:16:24different systems with enough different
6:16:27source addresses here, what I can do is
6:16:29overwhelm the ability of the receiver to
6:16:33actually receive any new connections,
6:16:37which is a denial of service attack
6:16:39because legitimate connections are now
6:16:42no longer being formed because we've got
6:16:45these halfopen connection buffers full
6:16:48with these bogus halfopen connections.
6:16:51So that's what a sin flood is and that
6:16:54was pretty common a while back. It can
6:16:57still work to a degree although we have
6:17:00figured out some ways to mitigate that
6:17:02between timers and increasing buffer
6:17:05sizes and there are various other
6:17:08mechanisms that are used to prevent sin
6:17:11floods from actually being all that
6:17:14effective. another type of attack. There
6:17:17are actually a number of different names
6:17:20for different variations of it, but what
6:17:22it is is where we've actually got a
6:17:25number of fragments. And you can see
6:17:27here we've got fragment IP protocol. In
6:17:30this case, it's actually using UDP, but
6:17:33it's a fragment and it's where the
6:17:35fragment offsets actually overlap. So,
6:17:39we've got a number of different messages
6:17:43where we should be actually putting the
6:17:46messages back together because we can
6:17:48see that they're fragmented. But when we
6:17:50put them back together, we see like a
6:17:52puzzle where the pieces are out of
6:17:54order. It doesn't actually fit quite
6:17:56right. And the reason for that is
6:17:58because our offsets are such that the
6:18:02fragments actually end up overlapping.
6:18:05And what we used to get from this sort
6:18:08of attack is operating systems could
6:18:11actually crash because they'd be trying
6:18:14to fit a packet back together in a
6:18:16particular way and it just wouldn't fit
6:18:19and they weren't really capable of
6:18:20handling that. Of course, since then,
6:18:23we've gotten a lot more robust with our
6:18:26handling of these sorts of things. And
6:18:29when we run into errors like this, we
6:18:32will typically just get messages that
6:18:34get discarded. That's actually another
6:18:37type of malicious traffic. Now, as I
6:18:39said, there are really a number of
6:18:41others. For example, another one is the
6:18:43LAN attack where if you set the source
6:18:47IP and the destination IP and the source
6:18:49port and the destination port the same,
6:18:51you end up causing a problem. This one
6:18:54that we were looking at here is actually
6:18:57what's called a teardrop attack. There
6:18:59are things like smurf attacks which go
6:19:02after broadcast addresses with ICMP echo
6:19:07requests and there's a fraggle attack
6:19:10which is a similar sort of thing to a
6:19:13smurf attack other than it uses UDP
6:19:16messages. So there's a lot of different
6:19:18types of malicious traffic and as we've
6:19:22gone through time we've actually fixed
6:19:24implementations. So a lot of the silly
6:19:27things about the way we handle error
6:19:30conditions in packets and flags, we
6:19:34don't actually crash anymore. We
6:19:36actually handle them a lot more
6:19:37gracefully. But I did want to show you
6:19:40some different types of malicious
6:19:42traffic so that you could see a little
6:19:44bit what it looks like and why it
6:19:47actually behaves maliciously and the
6:19:50type of things that it can actually do.
6:19:55In this lesson, we're going to be
6:19:56talking about building packets. We can
6:19:59use a couple of different tools to build
6:20:01packets. One of the ones I like is a
6:20:04tool called pack ETH, which is the
6:20:06Ethernet packet generator. I can have
6:20:09complete control over what my packet
6:20:12looks like. So I can set the link layer,
6:20:15for example, and I could do Ethernet
6:20:18version 2, 802.3,
6:20:21or I could do an 802.1Q
6:20:23and actually have it attached to a VLAN.
6:20:27I need addresses here for my MAC. I
6:20:30would have to put a MAC address in for a
6:20:33source and a destination. You can see
6:20:36I've actually got complete control over
6:20:38every piece of header. I could say the
6:20:41next layer is IPv4 or IPv6 or an ARP
6:20:46packet or I could just say I'm going to
6:20:48create my own. So in this case, let's
6:20:51just say it's IPv4.
6:20:53And I could actually change this. So
6:20:55it's not IPv4. I could say it's IPv3.
6:20:59And let's pretend the header is 832bit
6:21:04words long. We're not going to do
6:21:06anything with a type of service. So
6:21:08we're going to set the IP ID field
6:21:12and protocol is going to be TCP.
6:21:17Here is where I can actually do some
6:21:20address spoofing. My destination IP
6:21:23address, let's say it's 192.168.1.1.
6:21:28So, that's on my local network. But, of
6:21:30course, I could do this based on any IP
6:21:32address. Let's go back and I'm going to
6:21:36fill in the hardware address. I'm going
6:21:40to copy that and make that my source
6:21:41address. Let's see if we've got
6:21:43something in the ARP table.
6:21:46So, I do have an ARP entry there. So,
6:21:49let's go back to pack eth and say this
6:21:51is my source address.
6:21:56And I'm going to put this into my
6:21:59destination address here. And we're
6:22:02going to go back into pack and just
6:22:04paste this in as the destination
6:22:06address. So, I've got some information
6:22:08there in my layer 2 header with the MAC
6:22:12addresses. The next header we've set is
6:22:15TCP. So up here we've said TCP and right
6:22:18here we're going to say TCP.
6:22:20We're going to say a source port of so a
6:22:24source port of that and a destination
6:22:26port of let's say 80. And we can
6:22:30actually set a whole bunch of flags
6:22:32here. Sin infin
6:22:36and TCP payload we're going to say is
6:22:40this.
6:22:42I could actually say for example that a
6:22:46length of that and I could apply a
6:22:48pattern and actually fill the packet
6:22:52with a particular pattern. So like that
6:22:54for example now I've filled the payload
6:22:58with this pattern and now what I can do
6:23:02is I can just do a send. In this case
6:23:05let me just save this because I actually
6:23:07need to run this with administrative
6:23:10privileges.
6:23:19Now we can load this.
6:23:28And there it is right there.
6:23:31Now I could do the send except I need to
6:23:35specify an interface.
6:23:37So that's the interface I'm going to
6:23:39use. Now I can do a send and of course
6:23:42we're sending off the packet the way
6:23:45that we had created it. So that's pack
6:23:50and again you can do all sorts of
6:23:53interesting and crazy things with pack
6:23:56in order to create customized packets to
6:24:00send to systems. And you could do this
6:24:02for the purposes of testing to make sure
6:24:05things like applications can handle it
6:24:07or you want to make sure that a
6:24:10particular IP stack on an embedded
6:24:13device for example can handle odd
6:24:16packets and it doesn't do things like
6:24:19crash or do other crazy things. So
6:24:22packeth is pretty good for testing
6:24:24purposes and as I said you can set all
6:24:27sorts of different variables inside the
6:24:31different headers and create custom
6:24:33payloads and do all sorts of other
6:24:35interesting things.
6:24:38In this lesson we're going to be talking
6:24:39about creating packets using a utility
6:24:42called Hping. Now, Hping gives you the
6:24:45ability to build packets basically from
6:24:49scratch and it has a lot of useful
6:24:52functionality. So, for example, if I
6:24:55wanted to do a port scan, I could do
6:24:58something like hping 3 and I would need
6:25:01administrative privileges here since I'm
6:25:03running under Linux and we're going to
6:25:05be doing some interesting stuff with how
6:25:08we're creating the packets. So, I'm
6:25:10going to run hping 3. I'm going to do a
6:25:12scan and I'm going to say let's do ports
6:25:160 through 80 and I want to send a sin.
6:25:22So basically we're doing a sin scan
6:25:24here. You can see up top if I do a minus
6:25:27capital S I am setting the sin flag in
6:25:30the packet. And then I need to give the
6:25:34target address. Now I can do the scan
6:25:39and you can see we got two ports back.
6:25:41We got port 53 and port HTTP.
6:25:45So we scanned 81 ports. And if we wanted
6:25:49to see all of the responses, I could do
6:25:52something like this.
6:25:55So we're looking here at the IP ID in
6:26:00this field here and the TTL and the
6:26:04different flags. So we've got a reset,
6:26:06an acknowledge flag that was set, and of
6:26:09course the port and then the service
6:26:11name. So that's what we can do with
6:26:15doing a port scan. I can do several
6:26:18other things with hping as well,
6:26:21including just creating my own packet.
6:26:24If I want to do something like hping 3,
6:26:29I actually want to use TCP here. So, I'm
6:26:34going to create a TCP message. Let's say
6:26:39we're going to set the act and the fin
6:26:44and the urge pointer. And then I'm going
6:26:49to do a minus V. So now I can do the
6:26:52port that I actually want to connect to.
6:26:55Here the destination port actually gets
6:26:58set using minus P. And now I'm going to
6:27:03do my target 192.160.1.1.
6:27:08I'm doing hping using all of these flags
6:27:12on port 80 and to this target address.
6:27:15So I'm actually not getting anything in
6:27:19reply, which really isn't particularly
6:27:21surprising because I haven't done a
6:27:24connection establishment. So there's no
6:27:26sin message. What I'm probably getting
6:27:28back here are a bunch of resets. But you
6:27:31can see here just from the help we can
6:27:34do a number of different things in terms
6:27:37of just creating a message. I've got
6:27:41control of all of the different portions
6:27:43of the IP header. I can set specific
6:27:46things with ICMP. For example, I could
6:27:49do a timestamp request. I could get the
6:27:53timestamp back from any particular
6:27:55system. I can do specific ICMP types and
6:27:59codes. So where other tools don't give
6:28:02you the ability to directly check
6:28:05various ICMP types and codes, Hping 3 or
6:28:09just Hping will actually give you the
6:28:11ability to do that. I can set any piece
6:28:14of an IP, ICMP, TCP, UDP message that I
6:28:20want to and send it out to a particular
6:28:23target to see what sort of response I
6:28:25get. So that's another way we can do
6:28:28packet creation not only with the
6:28:31packath that I showed you previously but
6:28:34also here with hping and there are
6:28:37several different versions of hping
6:28:39available. Hping 3 happens to be the
6:28:41most recent one. But it's a good way of
6:28:44doing some testing and seeing how
6:28:47different systems respond when you hit
6:28:50them with messages that are formatted
6:28:53perhaps slightly differently than they
6:28:55are used to. And this also gives you the
6:28:57ability to actually see how systems work
6:29:02when you're setting different flags and
6:29:04fields inside the IP or TCP header. For
6:29:08example,
6:29:11in this lesson, we're going to be
6:29:12talking about wireless fundamentals.
6:29:15Wireless is actually a set of protocols
6:29:19that are referred to as 802.11. The ITLE
6:29:23E maintains this set of protocols that
6:29:26fall into the 802.11 category. And the
6:29:29reason I say fall into the 802.11
6:29:31category is E actually manages a lot of
6:29:34protocols and they give them numbers.
6:29:37802.11
6:29:39is the protocol number for Wi-Fi or
6:29:43wireless communications. There are
6:29:45actually a number of different types of
6:29:48Wi-Fi or wireless communications and
6:29:51we're given letters after the 802.11
6:29:55designation. For example, 802.11a
6:30:00came out shortly after 802.11
6:30:03was specified. Now here we've got a
6:30:06table of the differences between these
6:30:10various network standards. Here we've
6:30:12got 802.11a
6:30:14for example was released in 1999. The
6:30:18bandwidth is 20 megahertz because
6:30:20wireless is a radio protocol. It's based
6:30:24on radio waves or radio frequencies. So
6:30:28right here we've actually got two
6:30:30frequencies that 802.11a
6:30:33can use. that's in the 5 GHz range or in
6:30:36the 3.7 GHz range. So, we've got 20 MHz
6:30:40worth of bandwidth. That gives us data
6:30:43rates up to 54 megabits per second. So,
6:30:47in here, we've got ranges. So, we've got
6:30:49a range of 35 m or 115 ft for the 5 GHz
6:30:56version of 802.11a.
6:30:58Now we've got 802.11b
6:31:01and G and B gives us up to 11 megabits.
6:31:05With G, we get back up to 54 megabits.
6:31:09And the range changes a little bit. In
6:31:11the case of 802.11g, now we can go 125
6:31:15ft. And then we get 802.11n,
6:31:19which was released in October of 2009.
6:31:23And again, we've got a couple of
6:31:25different frequencies here. We could go
6:31:27in the 2.4 4 GHz range or again in the 5
6:31:30GHz range and there are two bandwidth
6:31:34capabilities and that gives us based on
6:31:36the bandwidth that's used either 72.2 as
6:31:40the maximum data rate or 150 as the
6:31:43maximum data rate but the range indoors
6:31:47is still roughly 230 ft. As I said,
6:31:51802.11 is a set of radio protocols that
6:31:55indicate how communication happens over
6:31:57those radio frequencies and how we do
6:32:01things like advertising networks and
6:32:05connecting to wireless access points and
6:32:08whether you can do something like an ad
6:32:10hoc network. So basically, two clients
6:32:13end up communicating with one another.
6:32:16Many devices these days actually have
6:32:18802.11 built into them. I'm using a
6:32:22laptop right here in this case and I'm
6:32:24actually connected to the network over a
6:32:27Wi-Fi connection. In the next handful of
6:32:31lessons here, we'll be talking a little
6:32:33bit more specifically about what the
6:32:35wireless protocols look like and how we
6:32:39can interface with wireless cards to be
6:32:42able to do things like look at them in a
6:32:45more interesting way.
6:32:49In this lesson, we're going to be
6:32:51talking about searching for wireless
6:32:53networks. Of course, there are multiple
6:32:55ways to search for wireless networks.
6:32:58You could do things like using the
6:33:00built-in system tools. So like here on
6:33:04the Macintosh
6:33:06right here, I could actually specify
6:33:08one. I could do show networks here and
6:33:12it will actually do a scan and show me
6:33:14all of the Wi-Fi networks that are
6:33:17available to me here in this particular
6:33:20location.
6:33:22Under Windows, I have similar
6:33:24capabilities where I can look for
6:33:26networks that are available. So, right
6:33:28here, I've got the little icon for
6:33:32Wi-Fi. I could look for Wi-Fi networks
6:33:36using the built-in Windows tools under
6:33:39Linux. There are certainly tools to do
6:33:41that sort of thing. Here's one actually
6:33:44that will run under a couple of
6:33:46different operating systems. It will run
6:33:48under the Mac OS. It will run under
6:33:50Windows. and it's called insider with
6:33:54two S's. And the reason for that is
6:33:57because an SSID is actually an
6:34:00identifier for a name of a wireless
6:34:03network. So this will show all of the
6:34:06SSIDs that are available or all of the
6:34:09Wi-Fi networks that are available. To
6:34:11put it another way, you can actually see
6:34:14some information here. This is an
6:34:16infrastructure, meaning that what I'm
6:34:18looking at is a wireless access point.
6:34:21I've got the MAC address of the access
6:34:24point and of course the MAC address
6:34:26gives me the vendor. We can see its net
6:34:28gear. I can take a look at the signal
6:34:32strength that has been available over
6:34:35time. So we've got a little graph of the
6:34:37signal strength and we can take a look
6:34:40at the channels that are available in
6:34:432.4 GHz. In this case, there are no 5
6:34:47GHz channels. So, I've got the graph of
6:34:50the 2.4 GHz channels that are available
6:34:54here. I can actually select my different
6:34:58channels. I can choose network types. I
6:35:02can look for security.
6:35:05So, I could narrow my search to just
6:35:09open Wi-Fi networks. And in this case,
6:35:12I'm going to go back to the 2.4 GHz
6:35:16range. So you can see that I have got a
6:35:19wireless access point that's identifying
6:35:22a particular SSID. It's got open
6:35:25security, meaning there's no encryption
6:35:28that is on this particular network. This
6:35:31is just one way of searching for
6:35:33wireless networks. Typically, if you
6:35:36have a wireless device like a laptop
6:35:38that has a wireless interface in it, it
6:35:42will actually go scanning for wireless
6:35:44networks and tell you all of the
6:35:46wireless networks that are available.
6:35:48You can do similar things on Wi-Fi
6:35:51enabled tablets or Wi-Fi enabled phones
6:35:54and where you've got a wireless card.
6:35:56Typically the operating system will do
6:35:58some level of scanning for you or as I
6:36:01said you could get a different type of
6:36:04application like insider here or you
6:36:08could get kismmet which runs under
6:36:10Linux. Kismac runs under the Macintosh.
6:36:14There are several different types of
6:36:17utilities that will show you different
6:36:19wireless networks that are available.
6:36:21So, I've got another one here that runs
6:36:24under Macintosh. Here's Wi-Fi Explorer.
6:36:28It's the same idea. It's going to go out
6:36:30and it's going to find all of the
6:36:32wireless networks that are available. In
6:36:34this case, we've actually turned up a
6:36:36different one. And this one's got WPA2.
6:36:40One of the reasons for that is because
6:36:43it's actually using a hidden SSID, which
6:36:47is one of the reasons why Insider didn't
6:36:50actually pick it up. So, I've got a
6:36:53couple of different network names here
6:36:55now. And I can look at graphs of signal
6:36:58strength similar to the way I can under
6:37:01insider. And I've got signal to noise
6:37:05ratio statistics and other signal
6:37:08strength statistics. Here you can see
6:37:10the different ways that we can go
6:37:13scanning for wireless networks. And if
6:37:16you don't actually have a wireless card
6:37:19in your portable device, you can
6:37:22actually go get one pretty easily. There
6:37:24are USB devices and then you can use
6:37:26those to scan and connect to networks.
6:37:32In this lesson, we're going to be
6:37:34talking about wireless or Wi-Fi or
6:37:37802.11.
6:37:38I really want to look at this again as
6:37:41we've done in previous circumstances.
6:37:43We've really looked at the lowest layer
6:37:46that we can possibly look at. So I
6:37:49actually want to do some packet captures
6:37:52where we are looking at the actual radio
6:37:55transmissions.
6:37:57There's a couple of things I actually
6:37:58have to do to make that possible. So I'm
6:38:02going to bring up my interfaces dialogue
6:38:05and we're going to take a look at
6:38:06options here. I actually need to pop
6:38:10this open. So, I double click it. And
6:38:13you'll see there's a checkbox here that
6:38:15says capture packets in monitor mode. If
6:38:19I'm using promiscuous mode, I can
6:38:21actually see all of the data that's out
6:38:24on the network, whether it's destined
6:38:26for my machine or not. If it actually
6:38:29hits my network interface card in
6:38:31promiscuous mode, I will actually see it
6:38:34in the packet capture. With monitor
6:38:36mode, I'll actually see the lower layer
6:38:40of transmissions as well, where I can
6:38:42actually see what's going on with the
6:38:46802.11 protocol and the communications
6:38:50that are going on between my network
6:38:51interface card and the access point. So,
6:38:55we're seeing a very low level here.
6:38:58We're actually seeing something between
6:39:00layer 1 and layer two here where we are
6:39:02seeing the communications that actually
6:39:05make the interface card in the access
6:39:07point actually communicate and function.
6:39:10So I'm going to do a start here.
6:39:13You'll see immediately there's an awful
6:39:15lot of communication that's going on.
6:39:18I'm going to do a stop on the capture
6:39:21here just so we can get a sense of
6:39:23what's actually happening because a lot
6:39:26of this is pretty repetitious. There are
6:39:29a handful of things that we are looking
6:39:31for here. We're really looking for
6:39:34beacon frames to begin with. A beacon
6:39:37frame is something that tells every
6:39:41wireless receiver in the area that there
6:39:44is an access point that's available. So
6:39:48we can see there's a beacon frame here
6:39:50and I can open that up and we can see
6:39:53the frame control header here. So the
6:39:56version is zero and it says this is a
6:39:59management frame because a beacon frame
6:40:02is one of the types of management frames
6:40:04that 802.11 uses that really underly the
6:40:09communication that is done to get your
6:40:12data back and forth from your system to
6:40:15the access point. So there's some
6:40:17management that goes on in addition to
6:40:19all of that. And this is a management
6:40:22frame. So we have a series of flags.
6:40:26And you can see in this case, none of
6:40:27the flags are set. But we've got a
6:40:30similar thing to where we had IP, which
6:40:34is more fragments and more data. There's
6:40:37actually a protected flag and an order
6:40:39flag. None of these are actually set in
6:40:42this particular case. you'll see the BSS
6:40:45ID, which is the station set ID for the
6:40:50access point. And you can see it's
6:40:52actually owned by Apple. Now, I'm going
6:40:55to close the frame control up, and we
6:40:58can actually take a look at the wireless
6:41:02management frame. So, there's a set of
6:41:04parameters here. We've got a timestamp
6:41:07and a beacon interval. And now we've got
6:41:09capabilities information. So you can see
6:41:12that the transmitter is actually an
6:41:14access point in this case and it will
6:41:17also support WE which is the wired
6:41:20equivalency protocol and we'll get into
6:41:22that in a subsequent lesson. Short
6:41:24preamble is allowed, short slot time is
6:41:27allowed here and there are a number of
6:41:30other flags that allow some other
6:41:33capabilities.
6:41:35And now we're going to look at the
6:41:36tagged parameters. And you'll see
6:41:37there's 216 bytes worth of tagged
6:41:40parameters. You'll see this is an SSID
6:41:44broadcast.
6:41:47You can see the different data rates
6:41:49that are supported here. We've got a
6:41:51current channel and we've got some
6:41:55capabilities which tells us that this
6:41:57will support 802.11n
6:42:01and we've also got some extended
6:42:03supported rates. There's a lot of
6:42:05information in here in this beacon frame
6:42:09that tells us that there is an access
6:42:12point that's available. In this case,
6:42:14actually, the SSID isn't being
6:42:17broadcast, and that's because the access
6:42:20point has been told not to provide the
6:42:23SSID.
6:42:25We should see whether there are other
6:42:28broadcast frames here. See if there's
6:42:30anything else that's out there. Let's
6:42:33take a look at this action frame here
6:42:35and we're going to look at the tag
6:42:37parameters. In this case, this is all
6:42:40about hopping patterns. The thing about
6:42:43wireless is you're actually doing a bit
6:42:46of frequency hopping during your
6:42:48transmission and that helps keep the
6:42:50transmission safe to a degree because
6:42:53you have to know which frequency you're
6:42:55going to hop on to next. In this
6:42:58particular set of frames that I've got
6:42:59here, I don't actually have anything
6:43:02with an SSID in it. But when we look at
6:43:05these beacon frames, typically if you
6:43:08had an access point that was set to
6:43:12provide you the SSID, in other words, it
6:43:15was broadcasting it so everybody would
6:43:17know that it was there and available to
6:43:19connect to. You would see the SSID here.
6:43:22Now again in this case I've actually got
6:43:24an access point here that's set to not
6:43:27broadcast the SSID. We do have the tag
6:43:31here inside the parameters but the SSID
6:43:34parameter is actually empty in this
6:43:36case. So again, what we're looking at
6:43:39here is all of the frames that go back
6:43:42and forth between the access point and
6:43:45the system itself that actually make the
6:43:49802.11
6:43:51protocols function. There is an awful
6:43:54lot of activity that's going on. Even
6:43:56though there may not be a lot of user
6:43:59data necessarily being communicated, a
6:44:02lot of it is just making sure that the
6:44:04client and the access point still have
6:44:07an open level of communication and that
6:44:10they're on the same channel and the same
6:44:12frequencies and the communication is
6:44:15actually continuing as we'd expect it
6:44:17to.
6:44:20In this lesson, we're going to be
6:44:22talking about wired equivalent privacy.
6:44:24Wired equivalent privacy is also known
6:44:27by the acronym WE. What WE is is a way
6:44:32of doing encryption over a wireless
6:44:35communication stream. So what it
6:44:38provides is something along the lines of
6:44:41a wired connection. So if you have a
6:44:44wired connection, you can be reasonably
6:44:46sure that at least from the moment that
6:44:50your communication leaves your system
6:44:53until it gets to the network device that
6:44:56your system is plugged into on the other
6:44:58end, for example, a switch or a hub, you
6:45:01can be sure that your communication
6:45:04stream is private and secure at least
6:45:07for that period of time. Now, with
6:45:11wireless, the moment your communication
6:45:14leaves your system, it's actually out in
6:45:16the air and anybody with any sort of
6:45:20radio receiver that can actually pick up
6:45:22that particular frequency can receive
6:45:25that transmission and actually see it,
6:45:27assuming that they can decode it. With
6:45:29WE, what we get is some encryption that
6:45:33gives us the same equivalent level of
6:45:36privacy that we get with a wired
6:45:40connection. We've got a couple of
6:45:42different kinds of WE. Initially, WE was
6:45:4564 bits and it used a 40bit key. With a
6:45:4940-bit key, what you did was put in 10
6:45:53hexadesimal characters. So hexadesimal
6:45:56is a base 16 number system where we
6:46:00actually count from zero to f before we
6:46:02roll over to 10. So those 10 hexadesimal
6:46:06digits actually provide us the key that
6:46:09we use to do the encryption. On top of
6:46:13the 40bit key, there is a 26 character
6:46:18password that can be used which gets us
6:46:21128 bits of keying material. When you
6:46:25actually join a web network, you'll be
6:46:28asked to give a password. And what it
6:46:32either is is typically 10 hexadesimal
6:46:35characters for 40bit web or 26 hexadimal
6:46:40characters for the stronger web. Now
6:46:43there's some authentication that goes on
6:46:46with web as well. You can see here the
6:46:48client is going to send an
6:46:50authentication request to the access
6:46:52point. We get a challenge response from
6:46:55the access point and then we encrypt the
6:46:58challenge text using the configured web
6:47:01key, send it back and we do that in an
6:47:05authentication request. So the access
6:47:08point then takes a look at the response
6:47:10figures out whether it matches based on
6:47:13doing the decryption and if it does
6:47:15you're authenticated.
6:47:17Now there are some problems with WE.
6:47:20It's actually been cracked for several
6:47:22years. There were some problems with the
6:47:26encryption mechanisms that were used.
6:47:28Not going to get into a lot of detail
6:47:31about how it was actually accomplished
6:47:33because we'd be digging deeper into
6:47:36encryption than we probably really want
6:47:38to go into in this particular space. But
6:47:41really, there's a problem with WE. And
6:47:44so there's a good reason why generally
6:47:47WE isn't used as much anymore as it used
6:47:50to be. Although you still get the
6:47:53capability of using WE with a lot of
6:47:57built-in wireless devices. So for
6:48:00example, this is a DSL modem router that
6:48:04is on my home network here. You can see
6:48:07here we've got the ability to change the
6:48:09channel. Underneath that it says turn WE
6:48:12on. It doesn't say turn WPA or WPA2
6:48:16which are more secure forms of
6:48:20authentication and encryption. It's WE.
6:48:23Part of the reason for that is because
6:48:25WE is simply a lowest common
6:48:27denominator. So we've got WE and we're
6:48:31going to select a key entry type. It's
6:48:34either going to be hex or ASI. We're
6:48:36going to do 64bit
6:48:39or 128 bit. And then we're going to set
6:48:41a key code. That's where we've got a
6:48:44pre-shared key, meaning the key is set
6:48:47ahead of time between the client and the
6:48:50server. And so it's pre-shared. So when
6:48:54we go around to connecting to a
6:48:57particular network that has web
6:49:00installed, we would give that pre-shared
6:49:02key in order to connect to the network.
6:49:05And that not only authenticates us, it
6:49:07provides us with a key so that we can
6:49:10actually do the encryption between our
6:49:13system and the wireless access point.
6:49:16Again, we've got the wired equivalent
6:49:19protocol which gives us the ability to
6:49:22encrypt wireless communication. But
6:49:24again, WE has actually been broken.
6:49:27There are utilities that are available
6:49:29that will crack web packets as long as
6:49:32they get some number of frames that they
6:49:36can look at to look at the encrypted
6:49:40messages and from that they can derive
6:49:43the key from all of that material. So we
6:49:47is good if you need some very basic
6:49:50level of encryption. If you need
6:49:53something stronger, you should be
6:49:54looking at something other than weap.
6:50:14In this lesson, we're going to be
6:50:15talking about securing your wireless
6:50:17network using WPA or WPA2. WPA is Wi-Fi
6:50:22protected access and it was actually
6:50:24developed in order to overcome some of
6:50:26the shortcomings with WE. So as I
6:50:30mentioned in a previous lesson, WE has
6:50:32actually been broken. WPA and WPA2
6:50:36actually don't offer perfect security
6:50:39either. There are cases where you can
6:50:41get the security to be bypassed and
6:50:44broken in some situations.
6:50:47However, it's better than WE and does
6:50:49provide some stronger security and
6:50:52stronger encryption mechanisms. WPA and
6:50:55WPA2 also use a pre-shared key mode and
6:51:00that's where you've got a password or a
6:51:03passphrase that the access point and
6:51:07your system use and they use that to
6:51:11actually generate the encryption keys.
6:51:14In the case of WPA or WPA2, we've got a
6:51:18case where we're using 64 hexadimal
6:51:21digits or a passphrase of 8 to 63
6:51:25printable ASKI characters. That's where
6:51:28we use the pre-shared key. Now, there's
6:51:30an enterprise mode as well where you can
6:51:33log in using a username and password in
6:51:37order to join a WPA network. In this
6:51:42case, I'm actually going to just walk
6:51:43through joining a network that doesn't
6:51:46exist just to walk you through the
6:51:48settings. And again, this is on Mac OS,
6:51:51but other operating systems are going to
6:51:53be pretty similar. So, I want to do a
6:51:56test wireless network. And this is the
6:51:59SSID that we've mentioned previously.
6:52:02And they're calling it the network name
6:52:04here. So you can see I've got a
6:52:07situation where I can select WPA
6:52:10personal or WPA2 personal. That would be
6:52:12where we have the pre-shared key. So I
6:52:16can also do WPA enterprise or WPA2
6:52:19enterprise. And if I were to do that, I
6:52:23could put in my username and my
6:52:25password. And then that would
6:52:27authenticate me to the network and the
6:52:30authentication would be my username and
6:52:33password rather than this pre-shared
6:52:35key. And then the keys for the
6:52:38encryption would actually be generated
6:52:40as needed. I've got WPA and WPA2
6:52:43enterprise. And the same thing here
6:52:45whether I'm using WPA or WPA2. I have
6:52:48the username and password. And if I go
6:52:51back to WPA or WPA2 personal, now this
6:52:55is where I just put in the pre-shared
6:52:56key. And I can just type in my
6:52:59passphrase here. And again, it can be
6:53:02several characters long. So I could go
6:53:04from 8 to 63 characters here and
6:53:07actually have a reasonably strong
6:53:09passphrase for my wireless network.
6:53:12Again, we've got a situation where we're
6:53:16doing encryption on wireless in order to
6:53:19have a situation that's reasonably
6:53:22similar to a wired network where without
6:53:26some physical intervention, you can't
6:53:28see what's on that wire. And wireless,
6:53:33given the fact that it's in the air,
6:53:35anybody can grab it without an awful lot
6:53:37of effort if they have the right tools,
6:53:39needs something to protect the
6:53:41transmission. And so we've got WE as
6:53:44mentioned in a previous lesson and as I
6:53:47said that's already been broken. And now
6:53:49we've got WPA and WPA2 which give us
6:53:54some better level of protection for our
6:53:57wireless communications.
6:54:01So up to this point when we've been
6:54:03talking about IP or the internet
6:54:05protocol, we've been talking about IP
6:54:08version 4. And IP version 4 has been
6:54:10around for over 30 years at this point.
6:54:14And we're trying to move to version 6,
6:54:17which has some differences with version
6:54:194. And right here, I've actually got a
6:54:22packet capture where I've captured some
6:54:25IP version 6 traffic. And I just want to
6:54:28walk through what the header of an IPv6
6:54:31packet looks like. So, we're going to
6:54:33look at the IP header. And you can see
6:54:36that the very first thing that we're
6:54:38looking at just as in IPv4 is the
6:54:42version number. What we've got here is a
6:54:44version number of six indicating that
6:54:46it's IPv6.
6:54:48Instead of some of the different
6:54:50features that we have with IP version 4,
6:54:54version 6 has a very different header
6:54:56structure. The next thing after the
6:54:59version number is the traffic class. And
6:55:03then we've got the flow label. And these
6:55:06two header fields are really about
6:55:09providing quality of service so we can
6:55:11differentiate traffic from one another.
6:55:14I've also got the payload length which
6:55:17is similar to the length field in
6:55:20version 4. And I've got a next header
6:55:23field here as well. And again, that's
6:55:25similar to what we had in IP version 4.
6:55:29So now we've got a hop limit which is
6:55:32similar to the time to live field and
6:55:35that indicates how many hops router hops
6:55:38or system hops we are going to allow
6:55:41this particular packet to take. Now
6:55:44we've got the source and destination IP
6:55:47address and you can see this actually
6:55:49looks very different. This is one of the
6:55:52big reasons why we're actually trying to
6:55:55go to version 6 because we're running
6:55:57out of address space in IP version 4.
6:56:00Although we've been running out of
6:56:01address space in IP version 4 for a
6:56:04number of years and we've actually
6:56:06implemented features like network
6:56:07address translation in order to stave
6:56:10off the point where we actually have to
6:56:13cut over to version six. Instead of four
6:56:17octets here, what we've got here is 128
6:56:20bits that's actually broken up into 16
6:56:23bytes. So if I select that, you'll see
6:56:26the 16 bytes that are down here. And
6:56:29actually, it's pretty easy to count.
6:56:31We've got eight fields here with two
6:56:34bytes in each field. So this AB is a
6:56:39hexadimal value representing one bite.
6:56:42Same with this AB here. So we've got two
6:56:46hexadesimal values representing two
6:56:48bytes in the first section here. And
6:56:51we've got a total of eight sections. So
6:56:53two bytes per section time 8 sections
6:56:56that's 16 bytes. And of course that
6:56:59gives us a value of 128 bits. So again
6:57:04that's one of the really big differences
6:57:06between version 4 and version six. Just
6:57:09simply the size of the address space
6:57:12that we have here. So, we have the
6:57:14source and destination. And that's
6:57:16really all there is to the IP version 6
6:57:20header. A couple of the big things in
6:57:22addition to the source and destination,
6:57:25we actually have this traffic class and
6:57:28flow label here. And that's something
6:57:30that was implemented in a slightly
6:57:32different way in version 4, but now it's
6:57:35pretty explicit. This is actually what
6:57:37we're going to be doing with it. And so,
6:57:39that's in IP version 6. Now, we'll get
6:57:42into some of the big differences between
6:57:45version 4 and version 6 coming up, but
6:57:48this right here very simply is the IP
6:57:52version 6 header.
6:57:55In this lesson, we'll be talking about
6:57:57some of the differences between IP
6:57:59version 6 and IP version 4. So, I wanted
6:58:02to start off with just configuration
6:58:05here. So using IPv4 I can do DHCP or I
6:58:10can do manually. So with version 6 I can
6:58:13do manually, I can do automatically or I
6:58:16can do link local. And you'll see here
6:58:19there's actually a router field. So in
6:58:21order to do it automatically, I would
6:58:24provide a router address and my system
6:58:27would actually communicate with the
6:58:29router and it would configure a network
6:58:33address based on what the router said
6:58:37this network address was and the number
6:58:40of bits in the network portion. And of
6:58:43course, it would figure out its own host
6:58:46portion from the hardware ID in the
6:58:50network interface card. So in this case,
6:58:52I've actually got it configured
6:58:54manually. And you can see here I've got
6:58:56a prefix length which is similar to
6:58:59cider that is used in IP version 4
6:59:02indicating the number of bits that are
6:59:04used in the network portion of the IP
6:59:07address. So it's the same sort of idea
6:59:09there. Now, some of the big things
6:59:12between version 4 and version 6 is we've
6:59:16got larger address space. And that's a
6:59:19pretty considerable difference here.
6:59:22Previously, we had 32 bits, which gave
6:59:25us 2 to the 32. And now we've got 28
6:59:30or approximately 3.4 * 10 38 addresses,
6:59:35which is a very large number of
6:59:36addresses. In addition to the larger
6:59:39address space, we actually have built in
6:59:42the capability of multiccasting. Now, if
6:59:45you've done different types of streaming
6:59:48video or other types of streaming media,
6:59:51you may have done multiccasting and you
6:59:53probably didn't even know you were doing
6:59:55it. Multiccasting is generally
6:59:58implemented using a specific set of
7:00:00addresses inside IP version 4. Now, IP
7:00:05version 6 actually allows the
7:00:07transmission of messages to multiple
7:00:10destinations inside version 6. That's
7:00:14just something that was built into the
7:00:16protocol. We get stateless address auto
7:00:19configuration. So if they are connected
7:00:22to an IP version 6 network, they can use
7:00:25the neighbor discovery protocol to
7:00:28figure out where they are and be able to
7:00:31configure themselves automatically. We
7:00:34also get network layer security. So IP
7:00:37sec which has been implemented in IP
7:00:40version 4 was actually developed for IP
7:00:43version 6. We've also simplified the
7:00:46processing by routers. There are a
7:00:50number of header fields that are
7:00:53different that make it easier for
7:00:55routers to actually process the packets.
7:00:58We get some ability with mobile IPv6,
7:01:03meaning we can have mobile devices like
7:01:06your smartphone or your tablet for
7:01:09example, devices that move around a lot.
7:01:12We actually get some capabilities there.
7:01:15We've got the ability to send very large
7:01:18packets. So, previously we had a limit
7:01:21on the packet size of 65,000 bytes or
7:01:2664k bytes basically. Now, we've actually
7:01:29got the ability to use jumbo grams which
7:01:32has something on the order of 4 billion
7:01:36bytes or octets. And so, we can send
7:01:39very very large chunks of data all at
7:01:42once. So if you have a case where you've
7:01:45got a network that allows you to send
7:01:48very large chunks of data, IPv6 will
7:01:51actually do pretty well for you because
7:01:53we can send those large chunks without
7:01:55actually fragmenting it up in IPv6 where
7:01:58we did have to in IPv4. That's just some
7:02:01of the differences in IPv4 versus IPv6.
7:02:06Again, the really big one and one of the
7:02:09reasons that we're really driving
7:02:11towards IPv6 is the larger address space
7:02:14as mentioned previously. But we do get a
7:02:17number of other features. One of the
7:02:19other features that actually works out
7:02:20pretty well is using IPSec and being
7:02:24able to have policies for actually
7:02:26setting up secure communication between
7:02:29multiple devices. And having that right
7:02:32at the network layer actually works
7:02:35pretty well. So we get network layer
7:02:38security and even though IPSSEAC was
7:02:40implemented in IP version 4, it wasn't
7:02:43actually at the network layer. It kind
7:02:45of sat at sort of an odd state because
7:02:48of the way it had to be implemented. So
7:02:50now we get network layer security using
7:02:53IPSec inside of IPv6.
7:02:58So, we've been talking a little bit
7:03:00about IPv6, and it's nice to be able to
7:03:03look at the network level details and
7:03:06actually see what's going on, but when
7:03:08it comes right down to it, what does it
7:03:10actually mean to us as users? And how
7:03:14are we actually going to interface with
7:03:16the network? Well, in reality, there
7:03:19aren't really a lot of differences from
7:03:21a user perspective. will have to get
7:03:25configured with a new IP address. But as
7:03:28mentioned previously, that's actually a
7:03:31reasonably easy process using IPv6.
7:03:34The nice thing is because of the way
7:03:36that the protocols are layered, we can
7:03:39actually just insert IPv6 into the
7:03:42middle here and not actually really
7:03:44worry about much of anything else. This
7:03:47is actually a packet capture where I
7:03:49have done some web communications
7:03:52between my browser and a web server
7:03:54that's been configured to use IPv6. So,
7:03:58I've got my TCP connection here, and you
7:04:02can see I'm doing just the standard
7:04:04three-way handshake that comes along
7:04:07with TCP. So, here's my SIN, my SINAC,
7:04:10and my ACT. And those look very similar
7:04:14to the way you would expect them to look
7:04:17with just IPv4 the way you're used to
7:04:19seeing it. The difference here is I've
7:04:21now got IPv6 sitting in the middle and
7:04:24of course I'm using a different address.
7:04:27So we can just flip through here. You'll
7:04:29see that I've done a get request using
7:04:32HTTP and we can see that there is some
7:04:36data that comes back and we get the web
7:04:40request that comes up. That's pretty
7:04:42straightforward here. Standard kind of
7:04:45communication here. We've got the source
7:04:46and destination. And you can see the
7:04:48communication going back and forth here.
7:04:51And again, we've got ports just as we
7:04:54always have in TCP. So basically, the
7:04:56short answer here is TCP hasn't actually
7:04:59changed to work with IPv6, which doesn't
7:05:02mean that there aren't some
7:05:04configuration things that have to happen
7:05:06here. So, for example, on the server
7:05:08side, I had to do a little bit of
7:05:10configuration to make sure that the web
7:05:12server was listening on the correct IP
7:05:15address to support IPv6.
7:05:18And because I don't actually have DNS
7:05:21set up to work with these addresses at
7:05:23this point, I had to actually type in
7:05:26the IP address. And when I type in the
7:05:29IP address, I actually have to use
7:05:31brackets around the IP address when I'm
7:05:33going to that address in my web browser.
7:05:36So beyond that though, just from a user
7:05:39perspective, let's say I did have DNS
7:05:41configured and the DNS was working with
7:05:44my IPv6 addresses, it would work exactly
7:05:47the same as I would expect it to work.
7:05:50It's just that we're now using IPv6
7:05:53instead of IPv4 at the network layer of
7:05:56our communication.
7:05:59In this lesson, I want to take a look at
7:06:01a couple of other features around IPv6.
7:06:04The first thing is using ICMP version 6.
7:06:09Since ICMP is very tightly related to
7:06:13IP, we actually get a slightly different
7:06:16version of ICMP.
7:06:18In this case, what I've got here is a
7:06:21packet capture where I did a just simple
7:06:23ping test. So, you can see I've got my
7:06:26IPv6 header here. Looks just like we've
7:06:29been looking at so far. And here's my MP
7:06:33message. And you can see the type is an
7:06:36echo reply and the code is zero. And
7:06:40we've got the check sum which we would
7:06:42typically expect and an identifier field
7:06:45and then a sequence field as well. So
7:06:48we've got some data which is really just
7:06:51a bunch of garbage to pad the packet
7:06:54out. So we're using ICMP just the same
7:06:57way as we did previously under IPv4.
7:07:01One of the differences here and one of
7:07:04the reasons for using ICMPv6 is it's a
7:07:07way of communicating with devices on the
7:07:11network. So what we've got here is a
7:07:14neighbor solicitation. What we're
7:07:17looking for is information about our
7:07:20neighbors on our IPv6 network. And what
7:07:24this gives us is the ability to do some
7:07:28auto configuration based on the network
7:07:31that we are actually on here. Right here
7:07:35we've got this neighbor solicitation and
7:07:37it comes in from this FE80
7:07:41address. And the FE80, you can see it's
7:07:46a really shortened address here. So
7:07:48there's really only four sections in
7:07:51addition to just the initial FE80.
7:07:55What that really is is a link local
7:07:58address, meaning it's only capable of
7:08:01communicating on the local network here.
7:08:04So that's the FE80
7:08:06and these two colons side by side here
7:08:10indicate that there are zeros filling in
7:08:12the space. Now we've got the portion
7:08:15here where the local network interface
7:08:18actually fills in the chunks here.
7:08:22That's the solicitation. And then we've
7:08:24got a neighbor advertisement. And we've
7:08:27got a reply in this case from my system
7:08:31here locally. We've replied saying,
7:08:33"Hey, guess what? I'm over here on your
7:08:36network and of course this is my IP
7:08:38address." And then an neighbor
7:08:41advertisement saying I'm here indicating
7:08:43that this is what my IP address is.
7:08:47And we've got a router not set flag and
7:08:51an override not set. But we do have a
7:08:54solicited field set. And that of course
7:08:57is because we got the neighbor
7:08:58solicitation here. So when we're
7:09:01replying, we set the solicited field
7:09:04indicating that this is a piece of
7:09:06information that was actually asked for.
7:09:09So this section here is actually new in
7:09:12IPv6 and the systems on your network
7:09:16will communicate indicating that they're
7:09:19around and these are the networks that
7:09:22are available or this is the network
7:09:24that you're sitting on. So, we're
7:09:26looking for neighbors and neighbors will
7:09:28reply saying, "Hey, I'm here." That's
7:09:31something new and a little bit different
7:09:33with IPv6 versus IPv4.
7:09:39In this lesson, we're going to be
7:09:40talking about next steps. Where can you
7:09:42go from here? This has been a starting
7:09:45point on learning TCP IP. We've covered
7:09:48a lot of data, but really the best way
7:09:51to take the knowledge that you've
7:09:53acquired here in terms of understanding
7:09:55how TCP and IP are put together and how
7:09:59they interreact is actually to go out
7:10:02and just start digging in with your own
7:10:05hands looking at different things. And
7:10:08you can either do that by just doing
7:10:11some packet captures on your own network
7:10:14and taking a look at how things
7:10:16interoperate with one another. You can
7:10:19certainly take a closer look at some
7:10:21different protocols that we didn't take
7:10:24a look at, for example, and dig a little
7:10:26bit more deeply into that. You can
7:10:29investigate more deeply the interaction
7:10:32of the sequence number and the
7:10:34acknowledgement number, how those two
7:10:37relate to one another, and the whole
7:10:40thing around initial sequence numbers,
7:10:42which we just touched on very briefly.
7:10:45And you really want to look at some
7:10:48different packet types and packet
7:10:50captures. Here, for example, is a packet
7:10:54capture from the SQL Slammer Worm that
7:10:58took place several years ago, was kind
7:11:00of a big deal. There are a number of
7:11:02other packet captures that you can
7:11:04download and take a look at without
7:11:07maybe having direct access to them
7:11:09yourself. Wiki.wireshark.org
7:11:12has sample captures available. It's not
7:11:16necessarily an extensive list, but there
7:11:19are certainly some packet captures here
7:11:21that you may not necessarily get to look
7:11:24at yourself. So, you could look at
7:11:27spanning tree protocol. You can look at
7:11:29airtunes. You can look at a wide variety
7:11:32of different packet types and see how
7:11:35they're put together. Then just get your
7:11:38hands on applications where you can and
7:11:41see how the applications interact over
7:11:44the network. As I said, this has been a
7:11:46pretty good starting point for learning
7:11:48TCP IP and you can get a good conceptual
7:11:51understanding of how it all works. But
7:11:54really start digging in yourself. Get a
7:11:57copy of Wireshark. Get some packet
7:11:59captures to look at and see how
7:12:01everything plays together and
7:12:04interoperates, and you'll be well on
7:12:06your way to understanding TCP IP more
7:12:09deeply and getting a much better handle
7:12:12on how networking works in the real
7:12:14world.
7:12:17In this lesson, I'm just going to tell
7:12:19you a little bit about me and my
7:12:20background, some of the things I've done
7:12:22and why I'm familiar with all of these
7:12:25technologies. So, I've been an IT
7:12:28professional since the early 1980s. My
7:12:30first global networking experience was
7:12:321983, 1984, and the network was the
7:12:36Bitnet, which was primarily an IBM
7:12:39mainframe network. My background has
7:12:41traditionally been in security and
7:12:43networking, although early on I did a
7:12:46lot of programming and I've done a lot
7:12:48of programming off and on throughout my
7:12:50career. Kind of a jack of all trades.
7:12:52I've done a lot of different things over
7:12:54time. I do networking, programming,
7:12:56security, forensics, voiceover, IP,
7:12:58penetration testing, security
7:13:00assessments, etc., etc. Like I said,
7:13:02I've done a lot of different things over
7:13:04the last 30ish years. I do have a
7:13:07background in teaching. I currently
7:13:09teach undergraduate classes primarily in
7:13:12networking and security at Champlain
7:13:14College. I also teach graduate classes
7:13:16in security and networking including
7:13:19computer forensics and cyber warfare at
7:13:22Brandeise University. I have a CISSP.
7:13:26It's a certified information system
7:13:28security professional. I am also a
7:13:30certified ethical hacker. I have
7:13:33previously held MCSE and CCNA
7:13:36certifications. I started working with
7:13:39TCP IP almost 20 years ago. I've been a
7:13:43network administrator and engineer. I've
7:13:45worked on some of the largest networks
7:13:46in the world, of course, as well as some
7:13:48of the smallest. I used to work at BBN
7:13:51Planet GT internet. It's a series of
7:13:54different names for the same company.
7:13:56It's really the company that built the
7:13:58internet. The company BBN that actually
7:14:00built the Arpanet spun out this
7:14:02organization called BBN Planet that got
7:14:05bought by GTE and became GTE Inter
7:14:08networking and then went public and
7:14:11became this company called Genuity. I
7:14:12used to work for them for several years.
7:14:15I've got a 30-year background in IT and
7:14:17computing. I have a networking and
7:14:20security background. I'm in the middle
7:14:22of writing a book on security. It's a
7:14:26certification guide for the SANS GSEC
7:14:30certification. I've worked with large
7:14:32and small ISPs as well as enterprises.
7:14:35And I've really been doing networking
7:14:37for a number of years now. And that's
7:14:40the basics of my background and my
7:14:43history in terms of networking and
7:14:45computing and security.