WEBVTT

00:00:00.000 --> 00:00:03.960
Welcome back to CSE 316 — Data Communication and Networking.

00:00:04.010 --> 00:00:06.470
This is the detailed video version of Session 9.

00:00:06.520 --> 00:00:13.150
For four sessions you have been moving packets. Today we start naming the places they go.

00:00:13.200 --> 00:00:21.200
This is the first of six straight sessions on addressing, and everything in the other five is built on today.

00:00:21.250 --> 00:00:30.200
There is a checkpoint at the end of each section, so you can tell whether to go on or go back.

00:00:31.433 --> 00:00:36.923
This session starts with an arithmetic problem that looks impossible.

00:00:36.973 --> 00:00:44.723
IPv4 has four point three billion addresses. That is the whole supply, and no more will ever be made.

00:00:44.773 --> 00:00:50.493
There are about eight point one billion people alive. Twice as many people as addresses.

00:00:50.543 --> 00:00:59.243
And yet your laptop, your phone and your watch all have an address right now — at the same time, in the same room.

00:00:59.293 --> 00:01:01.763
So write one guess down before we start.

00:01:01.813 --> 00:01:06.303
Three devices, one household. Where did the third address come from?

00:01:06.353 --> 00:01:11.853
And the harder version of the same question: is it really an address at all?

00:01:11.903 --> 00:01:20.333
Today is the space and the notation — what an address is, how to write it, and how it was sliced up in 1981.

00:01:20.383 --> 00:01:28.183
The rationing starts next session, and then it does not stop for six of them.

00:01:28.233 --> 00:01:29.433
Section one.

00:01:29.483 --> 00:01:31.963
Thirty-two bits, and one connection.

00:01:32.013 --> 00:01:40.963
The definition is one sentence long, and every word in it is doing work — including the one word most people get wrong.

00:01:42.767 --> 00:01:46.597
Here is the definition, in three pieces.

00:01:46.647 --> 00:01:48.997
Thirty-two bits. Four bytes.

00:01:49.047 --> 00:01:52.657
That is the whole object — a fixed-width binary number.

00:01:52.707 --> 00:01:59.327
And every notation you will see today is a costume worn by those same thirty-two bits.

00:01:59.377 --> 00:02:02.137
That uniquely and universally define.

00:02:02.187 --> 00:02:05.227
Uniquely: no two of them name the same thing.

00:02:05.277 --> 00:02:12.217
Universally: the name means the same thing everywhere on the Internet, not just on your network.

00:02:12.267 --> 00:02:14.117
One connection to the Internet.

00:02:14.167 --> 00:02:16.447
Not one machine. One connection.

00:02:16.497 --> 00:02:24.117
That word is the whole of the next slide, and it is the word the exam checks.

00:02:24.167 --> 00:02:29.867
One slide on that word, because it is the most common error on this definition.

00:02:29.917 --> 00:02:34.477
Take a laptop from the lab to a café, and it gets a different address.

00:02:34.527 --> 00:02:38.837
Now: what changed? Not the laptop. Nothing about it changed at all.

00:02:38.887 --> 00:02:43.667
Its connection changed, and the address names the connection.

00:02:43.717 --> 00:02:48.537
Which means a machine with wired and wireless both attached has two addresses.

00:02:48.587 --> 00:02:54.237
Not a main one and a spare. Two, and both are equally its own.

00:02:54.287 --> 00:02:59.527
And a router has one address per interface. Three interfaces, three addresses.

00:02:59.577 --> 00:03:05.557
If that feels familiar, it should — it is exactly what you learned about MAC addresses in Session 7.

00:03:05.607 --> 00:03:09.167
The pattern is the same, one floor up.

00:03:09.217 --> 00:03:14.497
So "what is the IP address of this router?" is not a question. It is half a question.

00:03:14.547 --> 00:03:20.302
The other half is: on which interface?

00:03:20.352 --> 00:03:25.392
One word needs care here, because section five qualifies it.

00:03:25.442 --> 00:03:28.672
Each address defines one, and only one, connection.

00:03:28.722 --> 00:03:34.782
Two machines with the same address on the same network is a fault. Not a configuration — a fault.

00:03:34.832 --> 00:03:42.252
Which leaves the question from minute one sitting there. How do three devices share one address?

00:03:42.302 --> 00:03:44.612
They do not. Not on the Internet.

00:03:44.662 --> 00:03:48.552
What is really happening is at the end of this session.

00:03:48.602 --> 00:03:54.382
So for the next forty minutes, take the rule at face value. Unique, and universal.

00:03:54.432 --> 00:04:03.382
When the exception arrives it will not break the rule. It moves who the address belongs to — and that is a different thing entirely.

00:04:04.782 --> 00:04:08.672
Now the supply. How many addresses are there?

00:04:08.722 --> 00:04:11.512
b bits address two to the b things.

00:04:11.562 --> 00:04:20.512
One bit is two. Eight bits is two hundred and fifty-six. Sixteen bits is sixty-five thousand five hundred and thirty-six.

00:04:21.062 --> 00:04:24.352
Each bit doubles the space. It does not add to it.

00:04:24.402 --> 00:04:31.112
That is why going from thirty-two bits to a hundred and twenty-eight in IPv6 is not four times bigger.

00:04:31.162 --> 00:04:35.112
It is two to the ninety-sixth times bigger.

00:04:35.162 --> 00:04:44.112
IPv4 is thirty-two bits. Two to the thirty-second. Four billion, two hundred and ninety-four million, nine hundred and sixty-seven thousand, two hundred and ninety-six.

00:04:46.522 --> 00:04:51.782
Write that number out once, with the commas. The commas are the point.

00:04:51.832 --> 00:04:55.242
And the world population is about eight point one billion.

00:04:55.292 --> 00:05:01.492
Twice as many people as addresses — before anybody counts a phone, a watch, a car or a fridge.

00:05:01.542 --> 00:05:10.492
In 1981 the network had a few hundred computers, so four billion looked permanent — and no reason at all to imagine a wristwatch would want one.

00:05:14.582 --> 00:05:15.752
Section two.

00:05:15.802 --> 00:05:18.872
Binary, dotted decimal, hexadecimal.

00:05:18.922 --> 00:05:27.872
Three notations, one number. The conversions are mechanical, they are quick, and they are examined.

00:05:28.344 --> 00:05:32.454
Three costumes, and only one of them is real.

00:05:32.504 --> 00:05:36.884
Binary is what actually travels. Thirty-two ones and zeros, in order.

00:05:36.934 --> 00:05:44.314
This is the only one of the three that exists on the wire. The other two are for humans.

00:05:44.364 --> 00:05:53.004
Dotted decimal is what humans write. Each octet as a decimal number from zero to two hundred and fifty-five, separated by dots.

00:05:53.054 --> 00:05:57.134
Four numbers, three dots, and nothing else.

00:05:57.184 --> 00:06:04.814
And hexadecimal is what tools print. Two hex digits per byte, because one hex digit is exactly four bits.

00:06:04.864 --> 00:06:09.854
You will meet that notation again in Session nineteen, for IPv6.

00:06:09.904 --> 00:06:12.174
One of the three is the awkward one.

00:06:12.224 --> 00:06:21.174
Binary and hexadecimal line up on bit boundaries. Decimal does not — and that mismatch is the source of every mid-octet mistake you will make this term.

00:06:25.365 --> 00:06:31.705
So let us do the conversion properly, by hand, the way you will do it in an exam.

00:06:31.755 --> 00:06:39.675
Write the weights first. One hundred and twenty-eight, sixty-four, thirty-two, sixteen, eight, four, two, one.

00:06:39.725 --> 00:06:48.675
Eight columns, biggest on the left. This row never changes, so write it once at the top of your answer and use it all the way down.

00:06:49.475 --> 00:06:54.305
Then: take the biggest weight that fits, subtract it, and repeat.

00:06:54.355 --> 00:07:03.305
One hundred and ninety-three. Take a hundred and twenty-eight — leaves sixty-five. Take sixty-four — leaves one. Take one — leaves zero.

00:07:03.785 --> 00:07:09.745
So one hundred and ninety-three is a hundred and twenty-eight plus sixty-four plus one.

00:07:09.795 --> 00:07:14.745
Put a one under every weight you took, and a zero under every one you skipped.

00:07:14.795 --> 00:07:21.225
The answer reads straight off the row: one one zero zero zero zero zero one.

00:07:21.275 --> 00:07:25.155
And now the rule that costs people marks. Pad on the left.

00:07:25.205 --> 00:07:34.155
Fourteen is eight plus four plus two, which is one one one zero. But an octet is eight bits, so it is zero zero zero zero one one one zero.

00:07:36.195 --> 00:07:43.522
Pad on the right instead and you have multiplied your number by sixteen.

00:07:43.572 --> 00:07:48.682
The other direction is easier, and it is the same row of weights.

00:07:48.732 --> 00:07:52.182
Add the weights under the ones. That is the entire method.

00:07:52.232 --> 00:07:59.452
Zero zero one one one zero zero zero: the ones sit under thirty-two, sixteen and eight. Add them. Fifty-six.

00:07:59.502 --> 00:08:01.532
There is no second step.

00:08:01.582 --> 00:08:06.002
Two checks that cost you nothing.

00:08:06.052 --> 00:08:11.172
An octet of all ones is two hundred and fifty-five. An octet of all zeros is zero.

00:08:11.222 --> 00:08:18.212
If your answer is outside that range, you have written more or fewer than eight bits.

00:08:18.262 --> 00:08:21.442
And one more, which is the most useful of the three.

00:08:21.492 --> 00:08:30.232
If the leftmost bit is a one, the value is at least a hundred and twenty-eight. If it is a zero, the value is at most a hundred and twenty-seven.

00:08:30.282 --> 00:08:39.232
Remember that check. Section three uses the same bit to read the class out of the first byte.

00:08:39.470 --> 00:08:45.910
There are exactly three ways to write a dotted decimal address that is not an address.

00:08:45.960 --> 00:08:53.120
A byte over two hundred and fifty-five. Seventy-five dot forty-five dot three hundred and one dot fourteen.

00:08:53.170 --> 00:09:00.060
Three hundred and one does not fit in eight bits, and there is no eight-bit number that means it.

00:09:00.110 --> 00:09:06.550
The wrong number of bytes. Two two one dot thirty-four dot seven dot eight dot twenty has five.

00:09:06.600 --> 00:09:12.500
An IPv4 address is exactly four, and four is not negotiable.

00:09:12.550 --> 00:09:19.340
And a leading zero. One one one dot fifty-six dot zero four five dot seventy-eight.

00:09:19.390 --> 00:09:28.340
Illegal as written — and worse than illegal. C, Java, Perl and most inet_aton implementations read zero four five as OCTAL, which is thirty-seven; Python three and Go reject it outright.

00:09:33.680 --> 00:09:39.260
So the address does not fail. It silently becomes a different address.

00:09:39.310 --> 00:09:48.260
And for contrast, one that is perfectly legal: one nine three dot one three one dot twenty-seven dot two five five.

00:09:48.920 --> 00:09:57.870
Four bytes, each between zero and two fifty-five, no leading zeros. Two fifty-five is an ordinary byte value.

00:09:59.505 --> 00:10:01.985
Ninety seconds.

00:10:02.035 --> 00:10:06.515
Four candidates. Which of them are legal dotted decimal?

00:10:06.565 --> 00:10:11.825
One: one one one dot fifty-six dot zero four five dot seventy-eight.

00:10:11.875 --> 00:10:16.645
Two: two two one dot thirty-four dot seven dot eight dot twenty.

00:10:16.695 --> 00:10:21.985
Three: seventy-five dot forty-five dot three zero one dot fourteen.

00:10:22.035 --> 00:10:28.885
Four: one nine three dot one three one dot twenty-seven dot two five five.

00:10:28.935 --> 00:10:37.885
Pause. Four verdicts, and a reason for each rejection. The reason is where the mark is.

00:10:39.135 --> 00:10:40.385
Only number four.

00:10:40.435 --> 00:10:46.535
One has a leading zero. Two has five bytes. Three has an octet above two fifty-five.

00:10:46.585 --> 00:10:52.815
And four is an ordinary legal address that merely looks alarming because it ends in two fifty-five.

00:10:52.865 --> 00:11:01.815
Ending in two fifty-five is not illegal. It is usually the last address of a block, and Session eleven says what that address is for.

00:11:05.546 --> 00:11:10.746
Here is all of that as something you can open and type into yourself.

00:11:10.796 --> 00:11:16.536
It opens on Forouzan's own example. One nine three dot fourteen dot fifty-six dot twenty-two.

00:11:16.586 --> 00:11:22.106
Under each octet: the weights, the ones and zeros, and the subtraction written out.

00:11:22.156 --> 00:11:31.106
A hundred and twenty-eight plus sixty-four plus one. Eight plus four plus two. Thirty-two plus sixteen plus eight. Sixteen plus four plus two.

00:11:31.836 --> 00:11:40.786
Every one of those you could have done on paper — and the point of the lab is to check yourself, not to replace yourself.

00:11:41.816 --> 00:11:48.256
Now the leading zero. The lab refuses it, and it tells you why in the words you will need in an exam.

00:11:48.306 --> 00:11:55.266
It does not just say "invalid". It says which byte, and what a careless parser would do with it.

00:11:55.316 --> 00:12:02.716
Three hundred and one. Refused, with the reason: one byte cannot exceed two fifty-five.

00:12:02.766 --> 00:12:06.106
And five bytes. Refused, and counted for you.

00:12:06.156 --> 00:12:12.266
Those are the only three ways to be wrong, and you have now seen all three.

00:12:12.316 --> 00:12:17.776
Now watch the right-hand tile, because we have not covered this yet and it is the next section.

00:12:17.826 --> 00:12:24.776
Two two seven. The lab calls it class D, and shows you the leading bits that decided it.

00:12:24.826 --> 00:12:31.236
Fourteen. Class A, and the bottom strip shows a single leading bit doing the work.

00:12:31.286 --> 00:12:36.036
And two five two, class E — the class nobody was ever given.

00:12:36.086 --> 00:12:45.036
Open it after the lecture, type your own address, and check an octet you did by hand. That is what it is for.

00:12:45.620 --> 00:12:51.260
Checkpoint one. Paper, pen, and stop the video.

00:12:51.310 --> 00:12:58.990
One. A laptop moves from the lab to a café and its address changes. What exactly changed?

00:12:59.040 --> 00:13:05.700
Two. Convert fifty-six to binary using the weights, and show the subtractions.

00:13:05.750 --> 00:13:14.700
Three. Why is one one one dot fifty-six dot zero four five dot seventy-eight rejected — and what does that byte mean to a careless parser?

00:13:15.780 --> 00:13:16.710
Answers.

00:13:16.760 --> 00:13:25.710
One. The connection. The address names an attachment to a network, not the machine. A new network means a new attachment, and a new address.

00:13:28.170 --> 00:13:37.120
Two. Fifty-six: take thirty-two, leaves twenty-four. Take sixteen, leaves eight. Take eight, leaves zero. Zero zero one one one zero zero zero.

00:13:39.300 --> 00:13:48.250
Three. A leading zero is illegal dotted decimal — and many parsers read zero four five as octal, which is thirty-seven. The address quietly becomes a different one.

00:13:53.320 --> 00:13:55.810
Section three. The classes.

00:13:55.860 --> 00:14:04.080
1981 cut the whole address space into five classes, and decided the size of your slice from the first bits of your address.

00:14:04.130 --> 00:14:11.336
It is an elegant idea, and it very nearly destroyed the Internet.

00:14:11.386 --> 00:14:15.536
Here is the idea, and it is genuinely clever.

00:14:15.586 --> 00:14:19.996
Reserve the leading bits of the address to say how big your block is.

00:14:20.046 --> 00:14:27.496
Read the first bits and you know two things at once: which class the address is in, and where its network part ends.

00:14:27.546 --> 00:14:30.976
The address describes its own shape.

00:14:31.026 --> 00:14:32.866
And the slices are not equal.

00:14:32.916 --> 00:14:40.086
A takes half of the entire space. B takes a quarter. C an eighth. D and E take a sixteenth each.

00:14:40.136 --> 00:14:47.306
Each class costs one more leading bit, and each is therefore half the size of the one before it.

00:14:47.356 --> 00:14:53.056
That was the whole design. No mask. No prefix length. Nothing to configure at all.

00:14:53.106 --> 00:14:57.576
It was elegant, it was fast — and it wasted most of the Internet.

00:14:57.626 --> 00:15:06.576
Everything that goes wrong from here is a consequence of that elegance: the shape was decided in 1981, and the customers arrived afterwards.

00:15:09.975 --> 00:15:18.925
A class does exactly one thing to an address: it decides where to cut it in two. Both pieces have a name, and both names are still in use long after the classes are gone.

00:15:25.715 --> 00:15:34.665
The first part is the prefix, and it defines the network. It is the leading n bits of the thirty-two. Every address on the same network carries the same prefix, and that is what lets a network be written as one line instead of a list of machines.

00:15:51.985 --> 00:16:00.935
The second part is the suffix, and it defines the node — the connection of one device to the Internet. It is the remaining thirty-two minus n bits. Inside one network the prefix never moves, and the suffix is the only thing that changes from one machine to the next.

00:16:13.355 --> 00:16:22.305
Take one thirty-four dot eleven dot seventy-eight dot fifty-six, from two slides ago. First byte one thirty-four, so class B, so n is sixteen. The first sixteen bits are the prefix: one thirty-four dot eleven. The last sixteen are the suffix: seventy-eight dot fifty-six. You did not choose that split — the leading one-zero did.

00:16:30.345 --> 00:16:39.295
Fixing n at eight, sixteen or twenty-four is the whole of what a class does. And the suffix length is the block size, directly: twenty-four suffix bits is sixteen million seven hundred and seventy-seven thousand two hundred and sixteen addresses, sixteen suffix bits is sixty-five thousand five hundred and thirty-six, eight is two hundred and fifty-six. Three sizes, because there were only three legal places to cut.

00:16:52.867 --> 00:16:59.137
This is the table. It is worth memorising, and it is worth being able to derive.

00:16:59.187 --> 00:17:04.867
Class A. Starts with a zero. So the first byte runs from nought to a hundred and twenty-seven.

00:17:04.917 --> 00:17:13.867
It is a slash eight — eight network bits — so sixteen million seven hundred and seventy-seven thousand two hundred and sixteen addresses per block, and only a hundred and twenty-eight blocks exist.

00:17:17.957 --> 00:17:24.037
Class B. Starts one zero. First byte from a hundred and twenty-eight to a hundred and ninety-one.

00:17:24.087 --> 00:17:33.037
A slash sixteen: sixty-five thousand five hundred and thirty-six addresses per block, sixteen thousand three hundred and eighty-four blocks.

00:17:34.027 --> 00:17:40.557
Class C. Starts one one zero. First byte from a hundred and ninety-two to two hundred and twenty-three.

00:17:40.607 --> 00:17:47.047
A slash twenty-four: two hundred and fifty-six addresses per block, and just over two million blocks.

00:17:47.097 --> 00:17:56.047
Read down the middle column. Each range is exactly half the length of the one above it, because each class spends one more leading bit.

00:17:58.430 --> 00:18:02.300
And the two classes nobody was ever granted.

00:18:02.350 --> 00:18:08.950
Class D. Starts one one one zero. First byte two hundred and twenty-four to two hundred and thirty-nine.

00:18:09.000 --> 00:18:13.010
Multicast. A group, never an organisation's block.

00:18:13.060 --> 00:18:21.630
That should feel familiar — multicast was the middle row of Session 7's three kinds of destination, one layer down.

00:18:21.680 --> 00:18:27.970
Class E. Starts one one one one. First byte two hundred and forty to two hundred and fifty-five.

00:18:28.020 --> 00:18:33.820
Reserved. Held for a future that arrived using something else entirely.

00:18:33.870 --> 00:18:42.820
And the boundaries. A hundred and twenty-seven and a hundred and twenty-eight. A hundred and ninety-one and a hundred and ninety-two. Two two three and two two four. Two three nine and two four zero.

00:18:46.200 --> 00:18:52.058
Those four pairs are where exam questions are set.

00:18:52.108 --> 00:18:56.988
So how do you call the class in an exam, in two seconds?

00:18:57.038 --> 00:19:00.398
You do not need the address. You need byte zero.

00:19:00.448 --> 00:19:07.488
The other three octets have nothing whatsoever to say about the class. Cover them up with your thumb.

00:19:07.538 --> 00:19:16.488
Then either read the range — nought to a hundred and twenty-seven, and so on — or write byte zero in binary and read the leading ones.

00:19:18.358 --> 00:19:22.808
And if you can only carry one of those into the exam, carry the bits.

00:19:22.858 --> 00:19:29.508
A misremembered range cannot be checked. A bit pattern can be derived on the spot.

00:19:29.558 --> 00:19:36.398
And watch the boundaries. A hundred and twenty-eight is not class A. A stops at a hundred and twenty-seven.

00:19:36.448 --> 00:19:45.398
"One nine two dot five dot five dot five feels big, so it is class B" is not a method. One nine two is in one ninety-two to two twenty-three, so it is class C. Read the first byte.

00:19:54.333 --> 00:20:02.023
Forty-two seconds, and one idea: the table is not a list to memorise. It is a consequence.

00:20:02.073 --> 00:20:07.613
Eight boxes, all question marks. That is byte zero before we have decided anything.

00:20:07.663 --> 00:20:13.143
The other three octets are not even on screen, because they never mattered.

00:20:13.193 --> 00:20:19.093
Decide one bit. A zero. That is class A — and look what it does to the strip underneath.

00:20:19.143 --> 00:20:26.933
One bit has claimed half the entire address space, and the first byte can now only run from nought to a hundred and twenty-seven.

00:20:26.983 --> 00:20:30.613
The range was not chosen. It fell out.

00:20:30.663 --> 00:20:36.593
Two bits. One zero. Class B, a hundred and twenty-eight to a hundred and ninety-one.

00:20:36.643 --> 00:20:40.893
Half the size of A, because it cost one more bit.

00:20:40.943 --> 00:20:47.033
Three bits. Class C, a hundred and ninety-two to two hundred and twenty-three. Half again.

00:20:47.083 --> 00:20:53.383
And watch the table on the bottom half building itself one row at a time as we go.

00:20:53.433 --> 00:21:01.663
Four bits, one one one zero. Class D. Multicast, two twenty-four to two thirty-nine.

00:21:01.713 --> 00:21:08.323
And one one one one. Class E, reserved, two forty to two fifty-five.

00:21:08.373 --> 00:21:10.773
And there is the whole table, complete.

00:21:10.823 --> 00:21:16.763
You were asked to memorise it. What you were actually being shown was the consequence of five bit patterns.

00:21:16.813 --> 00:21:24.135
Learn the bits, and the table reconstructs itself whenever you need it.

00:21:24.185 --> 00:21:27.865
Sixty seconds. Five addresses.

00:21:27.915 --> 00:21:31.585
Two two seven dot twelve dot fourteen dot eighty-seven.

00:21:31.635 --> 00:21:36.035
One nine three dot fourteen dot fifty-six dot twenty-two.

00:21:36.085 --> 00:21:39.245
Fourteen dot twenty-three dot one twenty dot eight.

00:21:39.295 --> 00:21:43.015
Two five two dot five dot fifteen dot one one one.

00:21:43.065 --> 00:21:48.435
One three four dot eleven dot seventy-eight dot fifty-six.

00:21:48.485 --> 00:21:57.435
Pause. Five letters. And if you are not certain, write the first byte in binary and read the leading bits.

00:22:01.305 --> 00:22:02.575
D, C, A, E, B.

00:22:02.625 --> 00:22:11.575
Two two seven is in two twenty-four to two thirty-nine. One ninety-three is in one ninety-two to two twenty-three. Fourteen is under a hundred and twenty-eight.

00:22:13.005 --> 00:22:20.895
Two fifty-two is two forty or above — class E, which is reserved and appears mainly in exam questions.

00:22:20.945 --> 00:22:27.774
And one thirty-four is in one twenty-eight to one ninety-one.

00:22:27.824 --> 00:22:30.024
Checkpoint two.

00:22:30.074 --> 00:22:38.334
One. Which class is one two eight dot eleven dot three dot thirty-one, and which single fact decided it?

00:22:38.384 --> 00:22:45.444
Two. How many addresses are in one class B block, and how many class B blocks exist?

00:22:45.494 --> 00:22:51.184
Three. Why is each class exactly half the size of the one before it?

00:22:51.234 --> 00:22:52.154
Answers.

00:22:52.204 --> 00:23:01.154
One. Class B. The first byte is a hundred and twenty-eight, which is in a hundred and twenty-eight to a hundred and ninety-one. In binary that is one zero zero zero zero zero zero zero, and the leading one zero is the class.

00:23:07.794 --> 00:23:16.744
Two. Sixty-five thousand five hundred and thirty-six addresses per block, and sixteen thousand three hundred and eighty-four blocks. A class B is a slash sixteen.

00:23:17.794 --> 00:23:26.744
Three. Because each class spends one more leading bit to name itself — and every bit spent halves what is left.

00:23:28.124 --> 00:23:30.454
Section four. Why it died.

00:23:30.504 --> 00:23:34.054
The classes did not fail because the arithmetic was wrong.

00:23:34.104 --> 00:23:41.541
They failed because a block that fits nobody is worse than no block at all.

00:23:41.591 --> 00:23:46.911
There were three sizes you could actually be given. Look at them as a customer.

00:23:46.961 --> 00:23:55.911
A class A is sixteen million seven hundred and seventy-seven thousand addresses. And only a hundred and twenty-eight of these blocks exist.

00:23:56.141 --> 00:23:59.491
So: how many organisations have sixteen million hosts?

00:23:59.541 --> 00:24:05.441
Almost every address in a granted A block sat unused for thirty years.

00:24:05.491 --> 00:24:12.311
A class C is two hundred and fifty-six. Two million of these blocks, and almost nobody wanted one.

00:24:12.361 --> 00:24:21.311
And it is not even two fifty-six machines — the first and last addresses are spoken for, so a class C seats two hundred and fifty-four.

00:24:22.121 --> 00:24:26.691
Which leaves the middle. Sixty-five thousand five hundred and thirty-six.

00:24:26.741 --> 00:24:32.361
The one everybody asked for, because it was the only one that fitted a real organisation.

00:24:32.411 --> 00:24:36.781
And sixteen thousand of them was never going to be enough.

00:24:36.831 --> 00:24:39.381
So here is the failure in one sentence.

00:24:39.431 --> 00:24:46.941
A company needing three hundred addresses could not use a C, so it took a B — and wasted sixty-five thousand.

00:24:46.991 --> 00:24:52.974
Multiply that by every organisation on Earth.

00:24:53.024 --> 00:24:55.874
Now a number on the damage.

00:24:55.924 --> 00:25:02.674
Class A held half the space. Two point one billion addresses, in at most a hundred and twenty-eight holders.

00:25:02.724 --> 00:25:09.924
Whatever those holders used, everything else in their blocks was unreachable by anyone else on Earth.

00:25:09.974 --> 00:25:15.624
And who were they? Universities. Early networks. A small number of corporations.

00:25:15.674 --> 00:25:23.104
The blocks were granted when addresses felt free, and once granted, nobody could take them back.

00:25:23.154 --> 00:25:26.024
So exhaustion arrived decades early.

00:25:26.074 --> 00:25:33.184
Not because four billion addresses were used — but because most of them could never be handed to anybody who needed one.

00:25:33.234 --> 00:25:42.184
Remember this the next time a design picks a fixed size for convenience. The convenience is paid for by everyone who arrives later.

00:25:45.354 --> 00:25:51.294
Forty-six seconds, and it puts the whole session's arithmetic in one place.

00:25:51.344 --> 00:25:56.224
It starts with the doubling. Watch the squares fill and the number underneath climb.

00:25:56.274 --> 00:26:01.454
Each square is one bit, and each one doubles what came before.

00:26:01.504 --> 00:26:09.684
Thirty-two of them. Four billion, two hundred and ninety-four million, nine hundred and sixty-seven thousand, two hundred and ninety-six.

00:26:09.734 --> 00:26:13.154
Every IPv4 address that will ever exist, on one line.

00:26:13.204 --> 00:26:18.704
And then the second bar. Eight point one billion people.

00:26:18.754 --> 00:26:24.514
Twice the length of the first one. That is the whole problem, drawn to scale.

00:26:24.564 --> 00:26:31.814
Now watch the space get cut. Five slices, and they are not the same size.

00:26:31.864 --> 00:26:36.414
Class A. Half of everything, to a hundred and twenty-eight organisations.

00:26:36.464 --> 00:26:44.684
Read the three cards underneath: the blocks that exist, the addresses in each, and how many of them were used.

00:26:44.734 --> 00:26:51.394
And class C at the other end. Plenty of blocks — and each one too small for almost anybody who asked.

00:26:51.444 --> 00:26:55.494
Three sizes, and all of them the wrong size.

00:26:55.544 --> 00:27:04.264
Which brings us to the fix, and the fix is one sentence: let the block fit the customer, instead of making the customer fit the block.

00:27:04.314 --> 00:27:10.723
That is classless addressing, and it is where we go next.

00:27:10.773 --> 00:27:19.723
The classes were not abandoned the moment they started failing. Two strategies were proposed first, and both were implemented to some extent. Knowing what they were is how the next slide stops looking like a magic trick.

00:27:24.963 --> 00:27:33.913
Subnetting divides a class A or class B block into several subnets. Each subnet gets a larger prefix length than the original network. Divide a class A four ways and each of the four subnets has a prefix length of ten — the eight bits the class gave you, plus two more to say which quarter.

00:27:42.343 --> 00:27:51.293
Subnetting also allowed the unused addresses in a network to be divided among several organisations. That is where it died. Most large organisations were not happy about dividing the block and giving some of the unused addresses to smaller ones, and nobody could compel them. The addresses stayed exactly where they were, and stayed unused.

00:28:05.383 --> 00:28:14.333
Supernetting ran the other way. Combine several class C blocks into one larger block, so it becomes attractive to an organisation that needs more than the two hundred and fifty-six addresses available in a single class C. That is the offer made to the company that wanted three hundred addresses and could not use a C.

00:28:25.283 --> 00:28:34.233
That one failed on routing: blocks stuck together make the routing of packets more difficult, and the routers paid the bill. So neither repair solved address depletion. What was left was to stop letting the leading bits of the address decide where the network part ends — and that is the next slide.

00:28:48.440 --> 00:28:51.340
So what replaced the classes?

00:28:51.390 --> 00:28:54.300
Classless addressing. Very little changes.

00:28:54.350 --> 00:28:59.330
Same thirty-two bits. Same idea of a network part and a host part.

00:28:59.380 --> 00:29:07.580
Exactly one thing changed: the boundary between them is no longer decided by the first bits of the address.

00:29:07.630 --> 00:29:14.780
Which means blocks come in any power-of-two size. Four, eight, sixteen, and so on upward.

00:29:14.830 --> 00:29:21.690
A customer needing three hundred addresses gets five hundred and twelve — not sixty-five thousand.

00:29:21.740 --> 00:29:25.230
But there is a price, and it is the whole of the next session.

00:29:25.280 --> 00:29:29.740
If the address no longer describes its own shape, something else has to.

00:29:29.790 --> 00:29:38.740
That something is the prefix length, and the mask. And your ISP will hand you one and call it two five five dot two five five dot two five five dot one nine two.

00:29:44.040 --> 00:29:46.320
Checkpoint three.

00:29:46.370 --> 00:29:55.320
One. An organisation needs three hundred addresses. What did classful addressing force it to take, and what was wasted?

00:29:55.900 --> 00:30:03.020
Two. Why did class A blocks make exhaustion arrive earlier than the raw arithmetic suggests?

00:30:03.070 --> 00:30:07.640
Three. In one sentence: what changed in 1993?

00:30:07.690 --> 00:30:08.620
Answers.

00:30:08.670 --> 00:30:17.620
One. A class B — sixty-five thousand five hundred and thirty-six addresses — because a class C holds only two fifty-six. Roughly sixty-five thousand two hundred addresses were consumed and never used.

00:30:21.580 --> 00:30:30.530
Two. Because half the space sat inside a hundred and twenty-eight blocks whose holders could not use it and would not return it. Unusable is as good as spent.

00:30:32.640 --> 00:30:41.590
Three. The boundary between network and host stopped being decided by the address itself, and started being stated separately.

00:30:43.412 --> 00:30:48.152
Section five, and the answer to the question we opened with.

00:30:48.202 --> 00:30:51.582
Three devices, one household, one address from the ISP.

00:30:51.632 --> 00:31:00.582
The rule about unique and universal is about to survive completely intact — by moving.

00:31:00.645 --> 00:31:06.895
Start with three blocks of addresses that behave differently from every other block.

00:31:06.945 --> 00:31:13.295
Ten dot nothing. One seventy-two dot sixteen. And one ninety-two dot one sixty-eight.

00:31:13.345 --> 00:31:22.235
Three blocks set aside for use inside private networks. Your home router almost certainly hands out addresses from the last one.

00:31:22.285 --> 00:31:24.915
They are neither unique nor universal.

00:31:24.965 --> 00:31:30.005
The same one ninety-two dot one sixty-eight dot nought dot eleven is in use in a million homes tonight.

00:31:30.055 --> 00:31:32.565
That is not a fault. That is the design.

00:31:32.615 --> 00:31:37.665
Because no router on the Internet will forward them. Ever.

00:31:37.715 --> 00:31:45.025
Which is exactly what makes the reuse safe — they cannot escape, so they cannot collide.

00:31:45.075 --> 00:31:52.405
So they are not really Internet addresses. They are names that mean something inside one building, and nothing at all outside it.

00:31:52.455 --> 00:32:01.405
If you have ever run ipconfig or ifconfig on a home network, you have already met one. Look at the first two octets.

00:32:03.879 --> 00:32:08.249
So how does anything inside the house reach the outside?

00:32:08.299 --> 00:32:16.099
The router has the real address. Your ISP gives your household exactly one public address, and it belongs to the router.

00:32:16.149 --> 00:32:20.799
Not to the laptop. Not to the watch. To the router.

00:32:20.849 --> 00:32:28.589
When the watch sends something, the router rewrites the source address — the private one goes out, the public one goes in.

00:32:28.639 --> 00:32:33.059
And it writes down which port number it used for that device.

00:32:33.109 --> 00:32:37.789
The server answers the public address. It has no idea a watch exists.

00:32:37.839 --> 00:32:45.649
The router reads the port number, looks up the row, puts the private address back, and delivers it to exactly one device.

00:32:45.699 --> 00:32:54.649
Which is why the answer to "what is my IP address?" from inside a home network is almost never the answer the Internet would give.

00:32:57.279 --> 00:33:02.549
Let us walk one packet out of the house and back, one step at a time.

00:33:02.599 --> 00:33:09.969
Four devices inside the dashed line — the watch, the phone, the laptop — each with a private address.

00:33:10.019 --> 00:33:15.699
One router. One public address. And an empty translation table.

00:33:15.749 --> 00:33:23.349
The watch sends. Look at the source address on that packet: one ninety-two dot one sixty-eight dot nought dot eleven.

00:33:23.399 --> 00:33:29.369
A private address, and the same one is in use in a million other homes right now.

00:33:29.419 --> 00:33:37.579
At the router, the rewrite. The private source is replaced by the one public address, and a port number is written down beside it.

00:33:37.629 --> 00:33:41.459
Watch the table on the right gain its first row.

00:33:41.509 --> 00:33:45.919
And now on the Internet. The packet carries only the public address.

00:33:45.969 --> 00:33:51.879
As far as the Internet is concerned, the watch does not exist. It never did.

00:33:51.929 --> 00:33:56.199
The reply comes back addressed to the public address, and that port number.

00:33:56.249 --> 00:34:00.949
The server never knew there was a watch. It answered a router.

00:34:00.999 --> 00:34:05.979
The router reads the port, finds the row, and puts the private address back.

00:34:06.029 --> 00:34:13.079
Delivered to exactly one device — and the port number is the only reason it knows which.

00:34:13.129 --> 00:34:21.479
And now all three together. Three private addresses inside, one public address outside, three port numbers keeping them apart.

00:34:21.529 --> 00:34:30.479
Open it yourself and step a packet from the laptop instead. The row changes; nothing else does.

00:34:30.731 --> 00:34:36.021
Now, what did that cost? Because it certainly was not free.

00:34:36.071 --> 00:34:39.991
First, the good news. The uniqueness rule is completely intact.

00:34:40.041 --> 00:34:48.991
On the Internet, that one public address still names exactly one connection. It is the router's connection, and it is unique.

00:34:49.151 --> 00:34:51.111
But the ends are no longer equal.

00:34:51.161 --> 00:34:56.421
A device behind a translator can start conversations, and cannot easily receive them.

00:34:56.471 --> 00:35:00.651
The Internet stopped being symmetric, in your house.

00:35:00.701 --> 00:35:05.101
And the router now holds state — a table of who is talking to whom.

00:35:05.151 --> 00:35:11.861
Session eight told you what state in the middle costs. This is that bill, arriving at your home.

00:35:11.911 --> 00:35:14.671
And in exchange, it bought thirty years.

00:35:14.721 --> 00:35:22.481
IPv4 should have run out in the nineteen-nineties. Translation, and the rationing you learn next, are the reason it did not.

00:35:22.531 --> 00:35:31.481
IPv6 exists to make all of this unnecessary — and by the time you meet it in Sessions nineteen and twenty, you will know exactly what it is fixing.

00:35:35.431 --> 00:35:39.051
So. The question from minute one.

00:35:39.101 --> 00:35:46.591
The count was never wrong. There really are only four point three billion addresses, and there really are twice as many people.

00:35:46.641 --> 00:35:51.811
Nothing in this session softened that arithmetic, and nothing tried to.

00:35:51.861 --> 00:35:55.701
Your watch does not have an Internet address. It has a private one.

00:35:55.751 --> 00:36:01.031
A name that means something inside your house, and nothing at all outside it.

00:36:01.081 --> 00:36:04.161
Your router has the real one, and it lends it out.

00:36:04.211 --> 00:36:10.981
One public address, a port number per conversation, and a table remembering which is which.

00:36:11.031 --> 00:36:14.341
So the rule held. One address, one connection.

00:36:14.391 --> 00:36:19.271
The connection simply belongs to the router rather than to the watch.

00:36:19.321 --> 00:36:24.341
And that is rationing — which is what every remaining session on addressing is about.

00:36:24.391 --> 00:36:32.376
Next: how to state where the boundary between network and host actually sits.

00:36:32.616 --> 00:36:36.176
Five ways to lose marks on this material.

00:36:36.226 --> 00:36:44.066
Wrong: fourteen is one one one zero, then pad on the right — one one one zero zero zero zero zero.

00:36:44.116 --> 00:36:53.066
Right: pad on the LEFT. Zero zero zero zero one one one zero. An octet is eight bits and the weights start at a hundred and twenty-eight on the left. Padding right multiplies your number by sixteen.

00:36:59.486 --> 00:37:04.376
Wrong: "one ninety-two dot five dot five dot five feels big, so class B."

00:37:04.426 --> 00:37:13.376
Right: read the first byte against the table. One ninety-two to two twenty-three is class C. Feelings are not in the table.

00:37:14.536 --> 00:37:18.016
Wrong: "zero four five is just forty-five."

00:37:18.066 --> 00:37:27.016
Right: leading zeros are illegal dotted decimal, and C, Java, Perl and most inet_aton implementations read zero four five as octal thirty-seven. The address silently becomes a different address.

00:37:33.556 --> 00:37:40.296
Wrong: "a hundred and twenty-eight is still class A — A covers nought to a hundred and twenty-eight."

00:37:40.346 --> 00:37:48.306
Right: A stops at a hundred and twenty-seven. Those four boundary pairs are precisely where questions get set.

00:37:48.356 --> 00:37:51.426
And wrong: "an IP address identifies a computer."

00:37:51.476 --> 00:38:00.426
Right: a connection. Move the machine and the address changes. Give it two interfaces and it has two addresses.

00:38:01.891 --> 00:38:05.041
Four things you should be able to do now.

00:38:05.091 --> 00:38:14.041
State what a thirty-two bit address names, using the right noun — a connection, uniquely and universally — and explain why a router has several.

00:38:15.841 --> 00:38:24.791
Convert an octet either way in under twenty seconds. Weights, greedy subtraction, pad on the left; and add the weights to come back.

00:38:25.831 --> 00:38:31.691
Reject an illegal dotted decimal and say which of the three rules it broke.

00:38:31.741 --> 00:38:40.691
And call the class from the first byte — ranges for speed, leading bits for certainty — and say why all three sizes were wrong.

00:38:43.220 --> 00:38:45.620
Five final checks.

00:38:45.670 --> 00:38:54.620
One. Convert one nine three dot fourteen dot fifty-six dot twenty-two to binary, showing the weights you used for the third octet.

00:38:55.900 --> 00:39:04.850
Two. Which of these are legal? Ten dot nought dot nought dot two fifty-six. One seventy-two dot zero one six dot five dot four. Eight dot eight dot eight dot eight. One dot two dot three.

00:39:10.450 --> 00:39:19.400
Three. Name the class of one three four dot eleven dot seventy-eight dot fifty-six, and of two forty dot one dot one dot one — with the deciding bits for each.

00:39:22.080 --> 00:39:30.140
Four. How many addresses are in a class C block, and how many machines can it actually seat?

00:39:30.190 --> 00:39:39.140
Five. Your phone reports one ninety-two dot one sixty-eight dot nought dot twelve. Is that address unique on the Internet? One sentence.

00:39:39.520 --> 00:39:48.470
The answers are along the bottom of the slide. Number five is the whole of the last section in a sentence.

00:39:48.959 --> 00:39:50.579
That is Session nine.

00:39:50.629 --> 00:39:55.179
Thirty-two bits naming a connection — not a device, and not a box.

00:39:55.229 --> 00:40:02.049
Weights, greedy subtraction, pad on the left. Both directions, under twenty seconds an octet.

00:40:02.099 --> 00:40:06.759
The class was always in the first byte, and all three sizes were wrong.

00:40:06.809 --> 00:40:12.009
And your watch has a private address; your router has the real one.

00:40:12.059 --> 00:40:19.059
Before the next session, read the classless part of eighteen point four — slash notation and masks.

00:40:19.109 --> 00:40:25.099
Memorise the class table, and drill five conversions until one octet takes you under twenty seconds.

00:40:25.149 --> 00:40:31.909
Next class: two five five dot two five five dot two five five dot one nine two. Your ISP calls that a mask.

00:40:31.959 --> 00:40:34.979
A mask of what, exactly? What is it hiding?

00:40:35.029 --> 00:40:39.109
I will see you there.
