WEBVTT

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

00:00:03.740 --> 00:00:06.950
This is the detailed video version of Session eleven.

00:00:07.000 --> 00:00:11.970
Last session you learned what a mask is. This session you get paid for it.

00:00:12.020 --> 00:00:20.970
Fair warning about the shape of this hour: it is deliberately the least conceptual lecture of the whole arc. One recipe, three timed drills, and one trap hammered until it cannot surprise you.

00:00:26.080 --> 00:00:35.030
Calculator away before you start. The exam will not let you have one, so your head has to be the table.

00:00:35.700 --> 00:00:39.720
Here is the situation, and it is a real one.

00:00:39.770 --> 00:00:46.760
Your ISP sends you exactly one line. Two zero five dot sixteen dot thirty-seven dot thirty-nine, slash twenty-eight.

00:00:46.810 --> 00:00:52.510
That is the whole message. There is no attachment, no second email, no phone call.

00:00:52.560 --> 00:01:01.510
And inside that one line, four separate facts are hiding — facts you need before you can configure a single thing.

00:01:01.770 --> 00:01:08.000
An engineer pulls all four of them out in under a minute, on paper, without a calculator.

00:01:08.050 --> 00:01:17.000
They are N, the mask, the first address and the last address. Write down which of the four you could already compute from that one line.

00:01:17.630 --> 00:01:20.570
And by the end of this hour, you will do it timed.

00:01:20.620 --> 00:01:28.717
That is the contract for the session, and I will hold up my end of it in the last five minutes.

00:01:28.767 --> 00:01:31.927
Section one. The four facts.

00:01:31.977 --> 00:01:34.117
Everything is in there already.

00:01:34.167 --> 00:01:43.117
The ISP did not tell you where your block starts. They handed you an address from the middle of it, and a number. That turns out to be enough — and why it is enough is the first real idea of the hour.

00:01:51.725 --> 00:01:54.705
So here they are, named.

00:01:54.755 --> 00:01:59.585
Fact one: how many addresses. We call it N. The size of the block.

00:01:59.635 --> 00:02:04.975
Everything else gets easier once you know it, which is why it goes first.

00:02:05.025 --> 00:02:13.405
Fact two: the mask. Which you can already build in your sleep — divide by eight, look up the remainder on the ladder.

00:02:13.455 --> 00:02:17.705
Fact three, and this is the crown jewel: the first address.

00:02:17.755 --> 00:02:26.705
It has another name you must know: the network address. It is the block's official name, and it is the thing routers actually forward on.

00:02:27.055 --> 00:02:31.365
And fact four: the last address. The far wall of the block.

00:02:31.415 --> 00:02:36.185
This is the one people get wrong by exactly one, and slide twelve is why.

00:02:36.235 --> 00:02:45.185
Four facts, four steps, always in this order. The order is not a preference — each step needs the one before it.

00:02:47.125 --> 00:02:52.525
Before the arithmetic, look at what the ISP did not give you.

00:02:52.575 --> 00:02:59.735
The ISP did not give you the first address of your block. They gave you dot thirty-nine, which is somewhere in the middle.

00:02:59.785 --> 00:03:03.845
Nothing in that line says where the block begins.

00:03:03.895 --> 00:03:09.455
And you do not need them to. Any address in the block, plus n, is enough.

00:03:09.505 --> 00:03:16.905
The AND throws away exactly the part that varies inside the block, and leaves the part that does not.

00:03:16.955 --> 00:03:25.905
Which is what the AND is for. That is not a side effect of masking — it is the entire reason masks are stored as thirty-two bits.

00:03:26.165 --> 00:03:30.675
One instruction recovers the whole block from any member of it.

00:03:30.725 --> 00:03:39.675
So if someone hands you an address and a slash, you are never short of information. You are one AND away from all four facts.

00:03:42.762 --> 00:03:46.422
Fact one costs you one subtraction.

00:03:46.472 --> 00:03:52.242
Thirty-two minus n is how many host bits you own — the bits the mask does not claim.

00:03:52.292 --> 00:03:58.832
Those bits are free to vary, and every combination of them is one address in your block.

00:03:58.882 --> 00:04:03.072
Each host bit doubles the block. It does not add — it doubles.

00:04:03.122 --> 00:04:08.852
One bit is two addresses. Two bits is four. Ten bits is a thousand and twenty-four.

00:04:08.902 --> 00:04:14.412
Which is why a block size is never a round decimal number, and never will be.

00:04:14.462 --> 00:04:21.222
Slash twenty-eight. Thirty-two minus twenty-eight is four host bits. Two to the fourth is sixteen.

00:04:21.272 --> 00:04:25.662
Sixteen addresses. That is fact one, done.

00:04:25.712 --> 00:04:32.632
And say the inverse rule out loud once. Getting it backwards is a common error in this arc.

00:04:32.682 --> 00:04:38.872
Big n, small block. A slash thirty is four addresses. A slash eight is sixteen million.

00:04:38.922 --> 00:04:44.945
The n is a dial, and it turns backwards.

00:04:44.995 --> 00:04:52.275
Now the table. Your head has to be the table — no exam on this topic gives you one.

00:04:52.325 --> 00:05:01.275
Two, four, eight, sixteen. The small end. These are your slash thirty-one down to slash twenty-eight — point-to-point links and tiny subnets.

00:05:04.375 --> 00:05:09.805
Thirty-two, sixty-four, a hundred and twenty-eight, two hundred and fifty-six.

00:05:09.855 --> 00:05:18.805
The working range: a slash twenty-seven, a slash twenty-six, a slash twenty-five, a slash twenty-four. You will see these nearly every week for the rest of term.

00:05:22.175 --> 00:05:30.955
Five hundred and twelve. A thousand and twenty-four. Two thousand and forty-eight. Four thousand and ninety-six.

00:05:31.005 --> 00:05:39.955
This is the crossover — above two fifty-six, a block no longer fits inside one octet, and it spills into the octet to the left. That spill is the second half of this lecture.

00:05:42.685 --> 00:05:51.635
Eight thousand one hundred and ninety-two. Sixty-five thousand five hundred and thirty-six. Sixteen million seven hundred and seventy-seven thousand two hundred and sixteen.

00:05:53.485 --> 00:05:59.575
The last two should already be familiar — those are the old class B and class A.

00:05:59.625 --> 00:06:03.785
And two to the zero is one. A slash thirty-two is a single address.

00:06:03.835 --> 00:06:11.835
It looks like a joke, but it is a legal block: one address, mask two fifty-five dot two fifty-five dot two fifty-five dot two fifty-five.

00:06:11.885 --> 00:06:20.835
Drill all of these until nobody hesitates. Not "I can work it out" — recognise them, the way you recognise seven times eight.

00:06:23.375 --> 00:06:29.335
Fact two is last session's skill, arriving as step two of a recipe.

00:06:29.385 --> 00:06:36.395
n divided by eight gives the full octets. Twenty-eight divided by eight is three, remainder four.

00:06:36.445 --> 00:06:42.135
Three octets of two fifty-five, then the fourth octet from the ladder.

00:06:42.185 --> 00:06:45.855
The ladder gives the remainder. Four ones is two forty.

00:06:45.905 --> 00:06:54.485
So the mask is two five five dot two five five dot two five five dot two forty. Nothing was written in binary.

00:06:54.535 --> 00:07:02.835
And every octet entirely right of the boundary is zero. If you find yourself thinking about them, stop — there is nothing there.

00:07:02.885 --> 00:07:11.835
If that is not automatic yet, the drill demo at the end of this session is exactly what it is for.

00:07:11.978 --> 00:07:17.598
Fact three. This is the expensive step, and it is where the marks are.

00:07:17.648 --> 00:07:25.948
Copy every octet under a two fifty-five. Two zero five stays two zero five. Sixteen stays sixteen. Thirty-seven stays thirty-seven.

00:07:25.998 --> 00:07:30.088
Three quarters of the answer, written without thinking.

00:07:30.138 --> 00:07:39.088
Zero every octet under a zero. There are none in a slash twenty-eight — but when there are, they cost you nothing at all.

00:07:41.468 --> 00:07:44.748
And then AND the single octet the boundary cuts.

00:07:44.798 --> 00:07:52.328
Thirty-nine is zero zero one zero zero one one one. The mask octet is two forty — one one one one zero zero zero zero.

00:07:52.378 --> 00:08:00.188
Keep the top four bits: zero zero one zero zero zero zero zero. That is thirty-two.

00:08:00.238 --> 00:08:06.318
So the first address is two zero five dot sixteen dot thirty-seven dot thirty-two.

00:08:06.368 --> 00:08:15.318
And it is not a machine. It is the name of the block — the street, not the house.

00:08:16.470 --> 00:08:22.120
Checkpoint one. Paper, pen, and stop the video.

00:08:22.170 --> 00:08:31.120
One. How many addresses are in a slash twenty-seven, a slash twenty-five and a slash twenty? Give the powers of two you used.

00:08:31.300 --> 00:08:37.600
Two. Why is any address in the block enough to recover the first address?

00:08:37.650 --> 00:08:45.430
Three. Write the mask for slash twenty-one without writing any binary, and say which two moves you used.

00:08:45.480 --> 00:08:46.410
Answers.

00:08:46.460 --> 00:08:55.410
One. Slash twenty-seven is two to the fifth, thirty-two. Slash twenty-five is two to the seventh, a hundred and twenty-eight. Slash twenty is two to the twelfth, four thousand and ninety-six.

00:09:00.440 --> 00:09:09.390
Two. Because ANDing with the mask erases exactly the bits that vary inside the block. Every member has the same network bits, so every member gives the same answer.

00:09:10.790 --> 00:09:19.740
Three. Twenty-one divided by eight is two remainder five. Two full octets of ones, and five ones on the ladder is two forty-eight. Two five five dot two five five dot two forty-eight dot zero.

00:09:27.101 --> 00:09:29.331
Section two. The ritual.

00:09:29.381 --> 00:09:32.161
Four steps, in this order, every time.

00:09:32.211 --> 00:09:41.161
N, then the mask, then the AND, then plus N minus one. The order is the method — each step needs the answer above it.

00:09:44.201 --> 00:09:48.711
Fact four, and the minus one is the whole slide.

00:09:48.761 --> 00:09:55.321
Thirty-two plus fifteen is forty-seven. So the block runs from dot thirty-two to dot forty-seven,

00:09:55.371 --> 00:10:00.821
and every address between them shares the same first twenty-eight bits.

00:10:00.871 --> 00:10:05.511
Why minus one? Because the first address is itself a member of the block.

00:10:05.561 --> 00:10:14.511
Count on your fingers if it ever wobbles: thirty-two, thirty-three, thirty-four, all the way to forty-seven. That is sixteen numbers, because thirty-two is one of them.

00:10:17.831 --> 00:10:24.901
Add the full sixteen and you land on forty-eight, which is the neighbour's doormat — the first address of the next block.

00:10:24.951 --> 00:10:30.041
This is the single most common wrong answer on this entire topic.

00:10:30.091 --> 00:10:34.221
The error has a name: plus-N. And it has a free test.

00:10:34.271 --> 00:10:40.761
If your last address divides exactly by the block size, you have caught it. Subtract one and try again.

00:10:40.811 --> 00:10:49.761
A slash twenty-six starting at dot sixty-four ends at dot one twenty-seven, not one twenty-eight.

00:10:49.895 --> 00:10:53.885
This is the card. Copy it into your notes.

00:10:53.935 --> 00:11:02.885
Step one, N equals two to the thirty-two minus n. Step two, the mask: n divided by eight, then the ladder.

00:11:03.045 --> 00:11:10.785
About five seconds each once they are automatic — and neither of them looks at the address at all.

00:11:10.835 --> 00:11:15.185
Step three, first address equals address AND mask, one octet only.

00:11:15.235 --> 00:11:22.205
The expensive step. About thirty seconds. This is where the marks are won.

00:11:22.255 --> 00:11:27.995
Step four, last address equals first plus N minus one, counted in two-fifty-sixes.

00:11:28.045 --> 00:11:36.995
Ten seconds. And if N is two fifty-six or more you do not add at all — you count runs of the last octet, which is the second half of this hour.

00:11:37.885 --> 00:11:46.835
Five, ten, thirty, ten. That is fifty-five seconds, which is why the promise in minute one was sixty and not ninety.

00:11:49.555 --> 00:11:54.505
And a word on why the order matters, because people try to skip.

00:11:54.555 --> 00:12:03.185
Step four needs N, so step one comes first. You cannot write the last address until you know how wide the block is.

00:12:03.235 --> 00:12:11.895
Step three needs the mask, so step two comes before it. The AND is meaningless without something to AND against.

00:12:11.945 --> 00:12:16.825
Steps one and two never look at the address at all. They depend only on n.

00:12:16.875 --> 00:12:22.885
In a drill you can do both before you have even read the address — and you should.

00:12:22.935 --> 00:12:30.705
Which means the address only matters at step three. That is exactly where the trap lives, and exactly where you should slow down.

00:12:30.755 --> 00:12:39.705
Jumping straight to "the first address is…" is where the answers go wrong under time pressure. The ritual exists to stop you guessing.

00:12:43.408 --> 00:12:49.568
Forty-two seconds. The ritual, run once, on the line from minute one.

00:12:49.618 --> 00:12:53.518
There is the line, and four empty tiles waiting to be filled.

00:12:53.568 --> 00:12:59.818
Nothing has been calculated. This is exactly what you have at the start of an exam question.

00:12:59.868 --> 00:13:06.088
Fact one. Thirty-two minus twenty-eight is four host bits. Two to the fourth is sixteen.

00:13:06.138 --> 00:13:11.248
Notice how little it needed: the address was not consulted at all.

00:13:11.298 --> 00:13:18.388
Fact two. Twenty-eight divided by eight is three remainder four, and four ones on the ladder is two forty.

00:13:18.438 --> 00:13:26.098
Two five five dot two five five dot two five five dot two forty. Still nothing from the address.

00:13:26.148 --> 00:13:32.578
Fact three, and now the address finally matters. One octet, eight bits, one AND.

00:13:32.628 --> 00:13:39.228
Thirty-nine meets two forty and the bottom four bits are erased. Thirty-two.

00:13:39.278 --> 00:13:43.188
Fact four. Thirty-two plus fifteen is forty-seven.

00:13:43.238 --> 00:13:52.188
And look at the red line: thirty-two plus sixteen is forty-eight, which is next door. That single line is the most valuable thing on the screen.

00:13:53.368 --> 00:14:02.318
Now the picture that changes how you think about all of this. Slash twenty-eight blocks tile the whole space in strides of sixteen — zero, sixteen, thirty-two, forty-eight.

00:14:04.238 --> 00:14:13.188
Our address, thirty-nine, fell inside the thirty-two block. It did not create a block. It landed in one that was already there.

00:14:14.658 --> 00:14:23.608
And the rule the tiling forces. Every first address divides by its block size. Thirty-two divides by sixteen. Thirty-nine does not.

00:14:24.168 --> 00:14:33.118
So a block "starting at thirty-nine" cannot exist — not by configuration, not by argument. File that as the alignment rule; in Session fifteen it decides an entire exam question.

00:14:39.648 --> 00:14:45.978
Now the same thing standing still, so you can copy it into your notes.

00:14:46.028 --> 00:14:53.688
Step one. Thirty-two minus twenty-eight is four host bits, so two to the fourth. Sixteen.

00:14:53.738 --> 00:14:59.678
Step two. Twenty-eight divided by eight is three remainder four; four ones on the ladder is two forty.

00:14:59.728 --> 00:15:05.368
Two five five dot two five five dot two five five dot two forty.

00:15:05.418 --> 00:15:14.368
Step three. Three octets copy straight through. Thirty-nine is zero zero one zero zero one one one, ANDed with one one one one zero zero zero zero, keeps zero zero one zero zero zero zero zero.

00:15:20.288 --> 00:15:25.688
Two zero five dot sixteen dot thirty-seven dot thirty-two.

00:15:25.738 --> 00:15:34.688
Step four. First plus N minus one: thirty-two plus fifteen is forty-seven. Not thirty-two plus sixteen, which is the next block's first house.

00:15:37.398 --> 00:15:45.908
And there is the answer row. Sixteen. Two five five dot two five five dot two five five dot two forty. Dot thirty-two. Dot forty-seven.

00:15:45.958 --> 00:15:54.908
Box it in your notes. Every drill for the next three sessions is this shape with different numbers.

00:15:56.282 --> 00:16:02.012
One word matters here, because it changes how the rest of the arc reads.

00:16:02.062 --> 00:16:11.012
Slash twenty-eight blocks tile the whole space in strides of sixteen. Zero, sixteen, thirty-two, forty-eight, sixty-four, and on up.

00:16:11.612 --> 00:16:16.302
They are already there. Nobody creates them.

00:16:16.352 --> 00:16:24.402
The address dot thirty-nine fell inside the dot thirty-two block. It did not create a block starting at thirty-nine.

00:16:24.452 --> 00:16:28.842
So "the block starting at dot thirty-nine" is not a thing that exists.

00:16:28.892 --> 00:16:35.312
And if an exam answer of yours ever says that, you have skipped step three.

00:16:35.362 --> 00:16:42.102
Here is the test that makes this concrete. Is two zero five dot sixteen dot thirty-seven dot forty-eight in our block?

00:16:42.152 --> 00:16:49.602
No. It is the first house of the next one. Forty-eight AND two forty is forty-eight, which is not thirty-two.

00:16:49.652 --> 00:16:58.602
And that AND-and-compare is literally what a router does to every packet it forwards. Practise it on its own — it is one AND and one comparison, and it is the whole of forwarding.

00:17:05.355 --> 00:17:11.695
Thirty-two divides by sixteen. Sixty-four divides by sixteen. Thirty-nine does not.

00:17:11.745 --> 00:17:20.695
So a slash twenty-eight starting at thirty-nine cannot exist. The tiling forces it, and no configuration can talk its way around it.

00:17:20.755 --> 00:17:27.715
Which gives you something valuable under time pressure: finish a question, then divide your first address by N.

00:17:27.765 --> 00:17:35.645
If it does not come out whole, step three went wrong. That check takes two seconds.

00:17:35.695 --> 00:17:41.285
And it is not only a check. In two sessions an ISP hands you one block and six customers to fit inside it.

00:17:41.335 --> 00:17:48.865
Alignment is what decides who gets which addresses, and it is the constraint that makes the problem hard rather than tedious.

00:17:48.915 --> 00:17:57.798
File this under rules that look pedantic today and decide entire questions in Session fifteen.

00:17:58.858 --> 00:18:07.088
First drill. One nine two dot one six eight dot five dot one hundred, slash twenty-six. All four facts.

00:18:07.138 --> 00:18:16.088
N, then the mask, then the AND, then plus N minus one. On paper, alone, no calculator.

00:18:16.248 --> 00:18:25.198
Ninety seconds on the clock. Write all four down, even the ones you are sure of — the ritual only works if you run all of it.

00:18:26.458 --> 00:18:31.858
Answers. Thirty-two minus twenty-six is six host bits, so sixty-four addresses.

00:18:31.908 --> 00:18:37.818
Twenty-six is three octets plus two ones, and two ones is one ninety-two.

00:18:37.868 --> 00:18:42.548
One hundred AND one ninety-two keeps the top two bits: sixty-four.

00:18:42.598 --> 00:18:46.118
And sixty-four plus sixty-three is one twenty-seven.

00:18:46.168 --> 00:18:52.632
That was a real exam question at real exam difficulty.

00:18:52.682 --> 00:18:57.712
Two wrong answers turn up on that drill, and they are worth naming.

00:18:57.762 --> 00:19:00.972
Wreck one: "the first address is one hundred."

00:19:01.022 --> 00:19:09.972
No. One hundred is just where the ISP happened to point. It is an address in the block, not the block's name.

00:19:10.182 --> 00:19:14.362
Wreck two: "the last address is one twenty-eight."

00:19:14.412 --> 00:19:23.362
That is the plus-N error. Sixty-four plus sixty-four is one twenty-eight, which is the next block's first house. Sixty-four plus sixty-three is one twenty-seven.

00:19:25.652 --> 00:19:34.602
And the free check catches both of them. One twenty-eight divides by sixty-four, so it cannot be a last address — last addresses are always one below a multiple.

00:19:36.692 --> 00:19:44.082
If you got both right inside ninety seconds, do four more tonight and it stops being a skill and starts being a reflex.

00:19:44.132 --> 00:19:53.082
Neither wreck is a misunderstanding of masks. Both are skipped steps. The ritual is the fix.

00:19:53.748 --> 00:19:57.868
Checkpoint two. Stop the video.

00:19:57.918 --> 00:20:06.868
One. A slash twenty-seven block has first address two hundred dot ten dot five dot sixty-four. What is its last address, and what is the free check?

00:20:08.918 --> 00:20:17.868
Two. Is two zero five dot sixteen dot thirty-seven dot forty-eight in the block two zero five dot sixteen dot thirty-seven dot thirty-two slash twenty-eight? Show the computation a router would do.

00:20:22.768 --> 00:20:31.718
Three. Why can no slash twenty-eight block have two zero five dot sixteen dot thirty-seven dot thirty-nine as its first address?

00:20:32.278 --> 00:20:33.208
Answers.

00:20:33.258 --> 00:20:42.208
One. Sixty-four plus thirty-two minus one is ninety-five. And the check: ninety-five is one below ninety-six, and ninety-six divides by thirty-two.

00:20:44.258 --> 00:20:53.208
Two. No. Forty-eight ANDed with the mask gives dot forty-eight, which is not dot thirty-two. Different first address, different block — and that comparison is exactly what forwarding is.

00:20:57.128 --> 00:21:06.078
Three. Because thirty-nine does not divide by sixteen. Blocks of sixteen tile the space at zero, sixteen, thirty-two, forty-eight — a block cannot begin between two tiles.

00:21:12.843 --> 00:21:15.213
Section three. Mid-octet.

00:21:15.263 --> 00:21:16.623
Decimal lies to you.

00:21:16.673 --> 00:21:25.623
Everything so far kept the fight in the last octet, where you are comfortable. The exam knows you are comfortable there — so it moves the boundary into the third.

00:21:29.505 --> 00:21:34.165
One eighty dot eight dot seventeen dot nine, slash twenty-two.

00:21:34.215 --> 00:21:39.675
Before I show you anything: predict the first address, out loud.

00:21:39.725 --> 00:21:46.555
Almost everyone says one eighty dot eight dot seventeen dot zero. And it is wrong.

00:21:46.605 --> 00:21:55.555
Run the ritual instead. N: thirty-two minus twenty-two is ten host bits, so two to the tenth — a thousand and twenty-four.

00:21:56.345 --> 00:22:05.295
Mask: twenty-two is eight plus eight plus six, and six ones is two fifty-two. Two five five dot two five five dot two fifty-two dot zero.

00:22:06.285 --> 00:22:11.165
And that puts the boundary six bits into the THIRD octet.

00:22:11.215 --> 00:22:20.165
So the fight has moved. Seventeen is zero zero zero one zero zero zero one. The mask octet is one one one one one one zero zero.

00:22:22.005 --> 00:22:26.925
Keep six bits: zero zero zero one zero zero zero zero. That is sixteen.

00:22:26.975 --> 00:22:33.665
The first address is one eighty dot eight dot sixteen dot zero. Not seventeen.

00:22:33.715 --> 00:22:41.965
The seventeen was never all yours. Only its top six bits were; the bottom two belong to the host part.

00:22:42.015 --> 00:22:50.655
When the boundary is mid-octet, decimal reasoning is not risky. It is wrong.

00:22:51.745 --> 00:22:58.285
Forty-two seconds, and it does the last address in a way you may not have seen before.

00:22:58.335 --> 00:23:02.685
There is the gut answer, in pink, side by side with the real one.

00:23:02.735 --> 00:23:09.045
Look at how similar they are. One octet, one digit, and about four marks.

00:23:09.095 --> 00:23:18.045
N first: two to the tenth, a thousand and twenty-four. Then the mask: twenty-two over eight is two remainder six, and six ones is two fifty-two.

00:23:19.465 --> 00:23:24.095
Both of those were computed without looking at the address once.

00:23:24.145 --> 00:23:31.615
And there is the reason for the whole section. The ones stop inside octet three, so octet three is where the AND happens.

00:23:31.665 --> 00:23:37.415
Two bits of that octet — the last two — are host bits. Watch them.

00:23:37.465 --> 00:23:42.645
Seventeen meets two fifty-two, and the bottom two bits are erased. Sixteen.

00:23:42.695 --> 00:23:50.965
The seventeen was never all network. Nobody looked at those two bits, and that is where the mark went.

00:23:51.015 --> 00:23:56.015
Now the last address. Do not add a thousand and twenty-three to a dotted address.

00:23:56.065 --> 00:24:02.245
There is no honest arithmetic that does that — the dots are not decimal places.

00:24:02.295 --> 00:24:08.965
Instead, count two-fifty-sixes. A thousand and twenty-four divided by two fifty-six is four.

00:24:09.015 --> 00:24:17.965
Four clicks of octet three: sixteen, seventeen, eighteen, nineteen — each carrying a full zero-to-two-fifty-five run of the last octet.

00:24:20.425 --> 00:24:28.595
And the last address reads itself off the end of the last run: one eighty dot eight dot nineteen dot two fifty-five.

00:24:28.645 --> 00:24:37.595
One check before we move on: a slash twenty-three starting at ten dot one dot four dot zero. Last address? Two clicks of two fifty-six — ten dot one dot five dot two fifty-five.

00:24:44.464 --> 00:24:53.414
The rule: never add N minus one to a dotted address digit by digit. Count runs of two fifty-six instead.

00:24:53.554 --> 00:25:02.504
A dotted address is not a number you can add to. There is no honest way to "add a thousand and twenty-three" to one eighty dot eight dot sixteen dot zero by treating the dots as decimal places.

00:25:05.684 --> 00:25:12.134
Do not invent arithmetic. People do, and it is always wrong in the same direction.

00:25:12.184 --> 00:25:17.154
Every two hundred and fifty-six addresses is one click of the octet to the left.

00:25:17.204 --> 00:25:26.154
A thousand and twenty-four divided by two fifty-six is four. So four clicks of the third octet, each carrying a full run of the fourth.

00:25:27.324 --> 00:25:32.464
So the third octet walks sixteen, seventeen, eighteen, nineteen.

00:25:32.514 --> 00:25:41.464
And the last address reads itself off the end of the last run: one eighty dot eight dot nineteen dot two fifty-five. No carrying, no thirty-two-bit addition, no calculator.

00:25:47.859 --> 00:25:48.349
Step four of the ritual says last equals first plus N minus one. The book reaches the same wall a different way, using the mask, and an exam can ask for it in exactly those words. So here it is on a worked address.

00:25:48.399 --> 00:25:51.599
The rule as Forouzan writes it: the last address in the block equals any address in the block, OR the NOT of the mask. Two bit-wise operations and nothing else. The AND with the mask gives you the first address; the OR with the inverted mask gives you the last.

00:25:51.649 --> 00:25:52.889
The book's own example: one six seven dot one ninety-nine dot one seventy dot eighty-two, slash twenty-seven. Twenty-seven is three full octets plus three ones, so the mask is two fifty-five dot two fifty-five dot two fifty-five dot two hundred and twenty-four. The whole fight is in the last octet, where eighty-two is zero one zero one zero zero one zero and two twenty-four is one one one zero zero zero zero zero.

00:25:52.939 --> 00:25:55.959
NOT the mask flips every bit. The three octets of two fifty-five become zero, and one one one zero zero zero zero zero becomes zero zero zero one one one one one, which is thirty-one. So NOT mask is zero dot zero dot zero dot thirty-one. And fact one arrives free: NOT mask plus one is thirty-two addresses.

00:25:56.009 --> 00:25:57.209
Now OR the address with that. Zero one zero one zero zero one zero, OR zero zero zero one one one one one, is zero one zero one one one one one — ninety-five. The OR drives every host bit to one and leaves the prefix untouched, which is the definition of the last address. So the last address is one six seven dot one ninety-nine dot one seventy dot ninety-five.

00:25:57.259 --> 00:26:00.659
Check it against the ritual. Eighty-two AND two twenty-four is sixty-four, so the first address is one six seven dot one ninety-nine dot one seventy dot sixty-four. Sixty-four plus thirty-two minus one is ninety-five. Identical. Use plus N minus one for speed under the clock, and use the OR when a question names the mask operations — they are the same wall, reached two ways.

00:26:00.709 --> 00:26:09.659
One warning about the printed page. Example eighteen point two in your book prints the mask as two five six dot two five six dot two five six dot two twenty-four, which is impossible — no octet reaches two fifty-six. It then prints the first address as dot eighty-two and the last as dot two five five. Both are wrong, and Example eighteen point one on the facing page derives the correct dot sixty-four and dot ninety-five in binary. Trust the binary, and trust the mask operations. Do not trust that one boxed answer.

00:28:48.675 --> 00:28:55.045
Here they are written out, once, so the picture is in your head for good.

00:28:55.095 --> 00:29:04.045
Click one. Sixteen dot zero through sixteen dot two fifty-five. Two hundred and fifty-six addresses, and the first of them is the block's network address.

00:29:06.145 --> 00:29:10.215
Click two. Seventeen dot zero through seventeen dot two fifty-five.

00:29:10.265 --> 00:29:17.125
This is the octet the gut wanted to call the network. It is only the second run.

00:29:17.175 --> 00:29:25.925
Click three. Eighteen. Nothing special happens here — which is itself the point. The runs are uniform.

00:29:25.975 --> 00:29:32.135
Click four. Nineteen, and the very last address of that run is the block's last address.

00:29:32.185 --> 00:29:41.135
The answer row: a thousand and twenty-four, two five five dot two five five dot two fifty-two dot zero, one eighty dot eight dot sixteen dot zero, one eighty dot eight dot nineteen dot two fifty-five.

00:29:44.725 --> 00:29:52.235
And the check: one eighty dot eight dot twenty dot zero would be the next block, so nineteen dot two fifty-five is one below it.

00:29:52.285 --> 00:30:01.235
Write the runs out the first few times. After that you will see "one thousand and twenty-four" and think "four clicks" without drawing anything.

00:30:04.711 --> 00:30:10.121
Here is all of it as something you can type into, including the street picture.

00:30:10.171 --> 00:30:19.121
It opens on the flagship. Four tiles, numbered by step, and they match the board exactly: sixteen, two forty, dot thirty-two, dot forty-seven.

00:30:19.931 --> 00:30:28.881
Underneath, the street — and our block, highlighted, with the address that fell into it marked below.

00:30:28.991 --> 00:30:33.561
Now the membership test. Type dot forty-eight into the second box.

00:30:33.611 --> 00:30:41.091
Forty-eight ANDed with the mask is forty-eight, and forty-eight is not thirty-two. So: no. One door down.

00:30:41.141 --> 00:30:46.511
This AND-and-compare is literally what a router does to every packet.

00:30:46.561 --> 00:30:52.761
Change one digit. Dot forty. Forty AND two forty is thirty-two, which matches. Yes.

00:30:52.811 --> 00:30:58.481
Same test, different answer, and the difference is one bit.

00:30:58.531 --> 00:31:06.571
Here is drill one, so you can check yourself. Sixty-four, one ninety-two, dot sixty-four, dot one twenty-seven.

00:31:06.621 --> 00:31:13.481
And look at the binary table: three octets greyed out, one octet doing all the work.

00:31:13.531 --> 00:31:22.481
Now the mid-octet one. Watch the street change shape: the tiles are now steps of four in the THIRD octet, each one a thousand and twenty-four addresses wide.

00:31:24.691 --> 00:31:33.641
And the summit. Eight thousand one hundred and ninety-two, two five five dot two five five dot two twenty-four dot zero, dot one ninety-two dot zero, dot two twenty-three dot two fifty-five.

00:31:37.041 --> 00:31:43.001
That is the hardest shape the exam sets, and the explorer will not flinch at it.

00:31:43.051 --> 00:31:47.461
Last one, and this one goes in your actual notes, not your memory.

00:31:47.511 --> 00:31:53.991
Eleven dot ten dot zero dot zero, slash twenty-two. One thousand and twenty-four addresses.

00:31:54.041 --> 00:32:02.991
Next week an ISP hands you that block with six customers attached and twelve marks riding on it.

00:32:03.321 --> 00:32:07.621
Checkpoint three. Stop the video.

00:32:07.671 --> 00:32:16.011
One. Find all four facts for one thirty dot forty dot one ninety-eight dot sixteen, slash twenty-two.

00:32:16.061 --> 00:32:25.011
Two. A slash twenty-three block starts at ten dot one dot four dot zero. What is its last address, and how many clicks of two fifty-six did you count?

00:32:27.271 --> 00:32:36.221
Three. Why does decimal intuition fail on one eighty dot eight dot seventeen dot nine slash twenty-two, but not on one nine two dot one six eight dot five dot one hundred slash twenty-six?

00:32:41.051 --> 00:32:41.971
Answers.

00:32:42.021 --> 00:32:50.971
One. N is two to the tenth, a thousand and twenty-four. Mask two five five dot two five five dot two fifty-two dot zero. One ninety-eight AND two fifty-two is one ninety-six, so the first address is one thirty dot forty dot one ninety-six dot zero. Four runs, so the last is one thirty dot forty dot one ninety-nine dot two fifty-five.

00:33:06.201 --> 00:33:15.151
Two. Ten dot one dot five dot two fifty-five. Two clicks — four dot zero through four dot two fifty-five, and five dot zero through five dot two fifty-five. Five hundred and twelve addresses.

00:33:20.341 --> 00:33:29.291
Three. Because twenty-two is not a multiple of eight, so the boundary cuts a digit you cannot see in decimal. Twenty-six also cuts an octet — but the block still fits inside a single octet, so nothing spills.

00:33:37.018 --> 00:33:40.238
Section four. Drilled, and examinable.

00:33:40.288 --> 00:33:49.238
One more drill at full exam difficulty, a short table of addresses that are already spoken for, and one word that quietly changes the answer.

00:33:52.740 --> 00:34:01.480
Drill two. One thirty dot forty dot one ninety-eight dot sixteen, slash twenty-two. Two minutes, timed.

00:34:01.530 --> 00:34:10.480
It is deliberately the same shape as the worked slash twenty-two. That is not a kindness — it is how a reflex is built.

00:34:12.460 --> 00:34:21.410
N is a thousand and twenty-four. Twenty-two over eight is two remainder six, and six ones is two fifty-two. Two steps, ten seconds.

00:34:22.200 --> 00:34:31.150
One ninety-eight is one one zero zero zero one one zero. It loses its bottom two bits: one one zero zero zero one zero zero, which is one ninety-six.

00:34:33.370 --> 00:34:39.230
First address one thirty dot forty dot one ninety-six dot zero.

00:34:39.280 --> 00:34:48.230
And four runs: one ninety-six, one ninety-seven, one ninety-eight, one ninety-nine. Last address one thirty dot forty dot one ninety-nine dot two fifty-five.

00:34:51.280 --> 00:35:00.230
If you wrote one ninety-eight dot zero as the first address, you paid the decimal tax one last time. From here on, mid-octet means binary — the reflex, not the exception.

00:35:07.090 --> 00:35:14.930
Drill three, and this is the summit. One hundred dot seventy-two dot two zero three dot nine, slash nineteen.

00:35:14.980 --> 00:35:21.880
Full difficulty, nothing softened. Paper, no calculator, three minutes on the clock.

00:35:21.930 --> 00:35:30.300
Run all four steps in order. Do not skip step one because the number looks big — step four needs it.

00:35:30.350 --> 00:35:37.100
Answers. Thirty-two minus nineteen is thirteen host bits, so eight thousand one hundred and ninety-two.

00:35:37.150 --> 00:35:42.110
Nineteen is eight plus eight plus three, and three ones is two twenty-four.

00:35:42.160 --> 00:35:50.830
Two zero three AND two twenty-four is one ninety-two, so the first address is one hundred dot seventy-two dot one ninety-two dot zero.

00:35:50.880 --> 00:35:59.830
And eight thousand one hundred and ninety-two is thirty-two runs of two fifty-six, so the third octet spans one ninety-two to two twenty-three. Last address dot two twenty-three dot two fifty-five.

00:36:03.730 --> 00:36:12.680
Four correct answers inside three minutes is exam pace for this item. If you are slower, the gap is drill, not understanding — and drill is homework.

00:36:16.719 --> 00:36:22.679
Three checks, five seconds, and they will tell you when you are wrong.

00:36:22.729 --> 00:36:31.679
One. Does the first address divide by N? One hundred dot seventy-two dot one ninety-two dot zero — and one ninety-two divides by thirty-two, which is the stride of a slash nineteen in the third octet. It checks out.

00:36:38.219 --> 00:36:47.169
Two. Is the last address one below a multiple? Two twenty-three is one below two twenty-four, and two twenty-four divides by thirty-two. It checks out.

00:36:49.059 --> 00:36:55.489
Three. Is N a power of two? Eight thousand one hundred and ninety-two is two to the thirteenth.

00:36:55.539 --> 00:37:04.079
If your N is not a power of two, you have made an arithmetic slip, not a conceptual one — and those are quick to fix.

00:37:04.129 --> 00:37:13.079
They will not tell you the right answer. They will tell you that yours is wrong, which under exam conditions is worth nearly as much.

00:37:13.949 --> 00:37:22.899
Build them into the ritual as a fifth beat. Five, ten, thirty, ten, five — still inside the minute.

00:37:23.153 --> 00:37:30.273
A quick preview, ten seconds a row. This is not today's lesson — Session sixteen owns it.

00:37:30.323 --> 00:37:39.273
Zero dot zero dot zero dot zero: this host, on this network. It is what a machine puts in the source field before DHCP has told it who it is.

00:37:41.393 --> 00:37:50.343
Two five five dot two five five dot two five five dot two five five: the limited broadcast. Everyone on this network — and routers slam the door on it rather than forward it.

00:37:54.183 --> 00:38:03.133
One twenty-seven slash eight: loopback. It never leaves your machine. Ping one twenty-seven dot zero dot zero dot one and you are talking to yourself, which is why it always works even when nothing else does.

00:38:08.743 --> 00:38:17.693
One sixty-nine dot two five four slash sixteen: link-local. This is what a host gives itself when DHCP never answers. It works on that one wire and nowhere else — so if you ever see one of these on your own machine, DHCP is what failed.

00:38:25.533 --> 00:38:34.483
Two twenty-four slash four: multicast. One packet, many listeners — the same idea you met one layer down in Session seven.

00:38:37.063 --> 00:38:46.013
And the private blocks: ten slash eight, one seventy-two dot sixteen slash twelve, and one ninety-two dot one sixty-eight slash sixteen. Reusable in every home and every campus, which is why NAT has to rewrite them on the way out.

00:38:54.273 --> 00:39:03.223
If block arithmetic ever lands you inside one of these on an exam, stop and re-read the question.

00:39:04.025 --> 00:39:10.915
Next, the difference between how many addresses a block has and how many hosts it can seat.

00:39:10.965 --> 00:39:17.625
A block has N addresses. Full stop. Forouzan counts all sixteen in a slash twenty-eight.

00:39:17.675 --> 00:39:22.555
The block is a range, and the range includes both ends.

00:39:22.605 --> 00:39:30.315
But used as a subnet, two of them are spoken for. The first is the network's name, and the last is the broadcast address.

00:39:30.365 --> 00:39:33.585
Neither can be handed to a machine.

00:39:33.635 --> 00:39:38.375
So a slash twenty-eight seats fourteen computers. Sixteen minus two.

00:39:38.425 --> 00:39:47.375
A slash twenty-six seats sixty-two. A slash twenty-four seats two hundred and fifty-four — and that number you have seen on every home router you have ever opened.

00:39:50.725 --> 00:39:59.375
The signal word is "usable". "How many addresses" means N. "How many hosts", or "how many usable", means N minus two.

00:39:59.425 --> 00:40:08.375
Exams ask both ways, deliberately, in the same question. Read it twice and underline the word.

00:40:10.339 --> 00:40:17.539
And here is where the ritual becomes a reflex. Four steps, one at a time, with a clock running.

00:40:17.589 --> 00:40:26.199
It opens with the flagship and nothing answered. Step one is highlighted, and the other three are greyed out — because you do not get to skip.

00:40:26.249 --> 00:40:35.199
The ladder and the powers of two sit across the top the whole time. That is not cheating; they are meant to be in front of you until they are inside you.

00:40:36.019 --> 00:40:43.779
Step one answered. Sixteen, marked green, with the reason underneath — two to the four, four host bits.

00:40:43.829 --> 00:40:48.129
Five seconds on the clock, and the tool moves you on.

00:40:48.179 --> 00:40:57.129
Step two. Two five five dot two five five dot two five five dot two forty, and the reason: twenty-eight over eight is three remainder four, and four ones is two forty.

00:40:59.899 --> 00:41:06.659
Notice the clock. Ten seconds for that step, and neither of the first two looked at the address.

00:41:06.709 --> 00:41:13.209
And here is the wrong turn everybody takes at least once: answering dot thirty-nine for the first address.

00:41:13.259 --> 00:41:21.179
Marked red, and labelled — that is the trap. The reason line names the mistake instead of just failing you.

00:41:21.229 --> 00:41:30.179
Step three, done properly. Dot thirty-two, with the AND written out. Thirty seconds — the expensive step, exactly as the recipe card said.

00:41:32.529 --> 00:41:40.609
Four facts, clean, in forty-one point four seconds. Under the minute, comfortably, and that is with the tool narrating.

00:41:40.659 --> 00:41:45.559
The best time and the clean-run counter are the numbers to chase.

00:41:45.609 --> 00:41:51.259
And a second run, on the mid-octet slash twenty-two, in fifty-two point nine.

00:41:51.309 --> 00:42:00.259
Do five of these tonight, timed, and report your times to yourself honestly. That is the homework, and it is the whole homework.

00:42:02.407 --> 00:42:09.007
Checkpoint four, and this one is the exam rehearsal. Stop the video.

00:42:09.057 --> 00:42:16.817
One. How many usable host addresses are in a slash twenty-seven, and how many addresses does the block contain?

00:42:16.867 --> 00:42:23.327
Two. Find all four facts for one seventy-two dot sixteen dot thirty-five dot two hundred, slash twenty.

00:42:23.377 --> 00:42:32.327
Three. Your answer for a slash twenty-six gives a first address of two hundred dot one dot one dot one hundred. What is wrong, and how do you know before checking the arithmetic?

00:42:37.657 --> 00:42:38.587
Answers.

00:42:38.637 --> 00:42:47.587
One. The block contains thirty-two addresses. Thirty are usable, because the first is the network address and the last is the broadcast address.

00:42:49.637 --> 00:42:58.587
Two. N is two to the twelfth, four thousand and ninety-six. Mask two five five dot two five five dot two forty dot zero. Thirty-five AND two forty is thirty-two, so the first address is one seventy-two dot sixteen dot thirty-two dot zero. Four thousand and ninety-six is sixteen runs of two fifty-six, so the last is one seventy-two dot sixteen dot forty-seven dot two fifty-five.

00:43:15.007 --> 00:43:23.957
Three. One hundred does not divide by sixty-four, and every first address is a multiple of its block size. The alignment check catches it in two seconds, without redoing anything.

00:43:32.297 --> 00:43:35.667
Five ways to lose marks on this topic.

00:43:35.717 --> 00:43:44.457
Wrong: one eighty dot eight dot seventeen dot nine slash twenty-two is on network one eighty dot eight dot seventeen dot zero.

00:43:44.507 --> 00:43:53.457
Right: one eighty dot eight dot sixteen dot zero. Twenty-two cuts the third octet, and seventeen AND two fifty-two is sixteen. Mid-octet means binary, always.

00:43:57.597 --> 00:44:04.537
Wrong: the last address of a slash twenty-six starting at dot sixty-four is dot one twenty-eight.

00:44:04.587 --> 00:44:13.537
Right: dot one twenty-seven. Last equals first plus N minus one, because the first address is itself a member of the block.

00:44:14.087 --> 00:44:19.747
Wrong: the ISP gave me dot thirty-nine, so the block starts at dot thirty-nine.

00:44:19.797 --> 00:44:28.657
Right: the block starts at dot thirty-two. They gave you an address from the middle, and step three finds the block that contains it.

00:44:28.707 --> 00:44:33.107
Wrong: a slash twenty-eight gives me sixteen machines.

00:44:33.157 --> 00:44:42.107
Right: fourteen. The block holds sixteen addresses, but the first is the network name and the last is broadcast. Watch for the word "usable".

00:44:43.357 --> 00:44:46.667
And wrong: big slash number, big block.

00:44:46.717 --> 00:44:55.667
Right: backwards. A slash thirty is four addresses and a slash eight is sixteen million. Every extra network bit halves what is left.

00:44:59.247 --> 00:45:04.817
Back to minute one. And this time, with a clock.

00:45:04.867 --> 00:45:11.647
N sixteen. Mask two forty. Thirty-nine AND two forty is thirty-two. Plus fifteen, forty-seven.

00:45:11.697 --> 00:45:19.167
Five seconds, ten, thirty, ten. Fifty-five in total, and that is without hurrying.

00:45:19.217 --> 00:45:24.697
So the answer to minute one is yes. Four facts, one line, under a minute, no calculator.

00:45:24.747 --> 00:45:32.297
And now you have the ritual that does it — which is a different thing from having watched me do it.

00:45:32.347 --> 00:45:35.137
And here is the promise for the rest of the arc.

00:45:35.187 --> 00:45:42.307
Subnetting will feel new for about four minutes, until you notice it is this exact ritual, run once per subnet.

00:45:42.357 --> 00:45:46.527
The ISP allocation problem is this ritual six times, with a seating plan.

00:45:46.577 --> 00:45:55.527
You have already learned the hard part of the next three lectures. What remains is deciding where to cut.

00:45:56.660 --> 00:45:59.790
Four things you should be able to do now.

00:45:59.840 --> 00:46:08.790
Recover all four facts from an address and a slash, in under a minute. N, the mask, the AND, plus N minus one — in that order, without a calculator.

00:46:12.660 --> 00:46:21.610
Survive a mid-octet boundary. Find the octet the fence cuts, AND that one in binary, and treat the rest as copying.

00:46:21.940 --> 00:46:30.780
Find a last address by counting two-fifty-sixes — never by adding N minus one to a dotted address digit by digit.

00:46:30.830 --> 00:46:39.290
And check your own answer in five seconds. First divides by N, last is one below a multiple, N is a power of two.

00:46:39.340 --> 00:46:48.290
Homework: five blocks tonight, timed. And keep eleven dot ten dot zero dot zero slash twenty-two in your notes.

00:46:50.093 --> 00:46:51.733
That is Session eleven.

00:46:51.783 --> 00:46:54.933
Every address slash n carries four facts.

00:46:54.983 --> 00:47:01.473
N, the mask, the AND, plus N minus one. Sixty seconds, no calculator, every time.

00:47:01.523 --> 00:47:08.153
Blocks are already there — you do not build one, you find the one that contains the address.

00:47:08.203 --> 00:47:16.343
And when the boundary is mid-octet, decimal stops telling the truth, so you drop to binary and count in two-fifty-sixes.

00:47:16.393 --> 00:47:24.263
Before the next session: five timed runs, and read the subnetting part of eighteen point four, Example eighteen point five.

00:47:24.313 --> 00:47:29.033
Next class: one block, four labs, and the only real question — where do you cut?

00:47:29.083 --> 00:47:34.264
I will see you there.
