\documentclass{beamer}
\usepackage{beamerthemesplit}
\usepackage[utf8]{inputenc}
\usepackage{verbatim}
\usepackage{epsfig}
\usepackage{graphicx}
\usenavigationsymbolstemplate{}
%\usetheme{Boadilla}

\title{IMT2521 Network administration,\\
Binary numbers and arithmetic\\
IP addressing and\\
subnet calculations}

\date{}
\begin{document}

\frame {\titlepage}
%---------------------------------------------------------------
\begin{frame}
\frametitle{The binary system}

The number system we use on a daily basis, the decimal system, uses
ten numeric symbols (*), the numbers 0 through 9. The binary system
on the other hand, only has two symbols: 0 and 1.

These two numeric symbols are used to build larger numbers, just the same
way we use the symbols 0 to 9 to build large numbers, such as 1337.

\vspace{10pt}

Numeric values in the binary system are determined by position, building
from a base value of \[ 2^{n} \]

\begin{scriptsize}
* Number, Value, Numeric value and numeric symbol are fundamentally
different things. A numeric value is the base magnitude a given 
numeric symbol represents. A number is simply a composition of 
numeric symbols, while a value is the magnitude represented by the number.

\end{scriptsize}


\end{frame}
%---------------------------------------------------------------
\begin{frame}[fragile]

\frametitle{The decimal system, quickly}

\begin{centering}
\begin{tabular}{cccc}
$10^{3}$ & $10^{2}$ & $10^{1}$ & $10^{0}$ \\
\hline
1 & 3 & 3 & 7
\end{tabular}

\[ 10^{3} \cdot 1 = 1000 \]
\[ 10^{2} \cdot 3 = 300 \]
\[ 10^{1} \cdot 3 = 30 \]
\[ 10^{0} \cdot 7 = 7 \]
\vspace{10pt}
\[ 1000 + 300 + 30 + 7 = 1337 \]

\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{The binary positions}

\begin{centering}
\begin{tabular}{cccccccc}
$2^{7}$ & $2^{6}$ & $2^{5}$ & $2^{4}$ & $2^{3}$ & $2^{2}$ & $2^{1}$ & $2^{0}$ \\
\hline
128 & 64 & 32 & 16 & 8 & 4 & 2 & 1
\end{tabular}

\end{centering}
\vspace{40pt}

As we commonly operate on values in the range 0 to 255 (decimal),
we should be able to learn the representation and position of
these common positions


\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{Examples}

\begin{centering}
\begin{tabular}{cccccccc||r}
$2^{7}$ & $2^{6}$ & $2^{5}$ & $2^{4}$ & $2^{3}$ & $2^{2}$ & $2^{1}$ & $2^{0}$ & \\
\hline
\hline
128 & 64 & 32 & 16 & 8 & 4 & 2 & 1  \\
\hline
  0  &  1  &  0  & 0  &  0  &  1  &  1  &  0  & 70 \\
  1  &  0  &  0  & 1  &  0  &  0  &  1  &  1  & 147 \\
  0  &  0  &  0  & 0  &  0  &  0  &  1  &  1  & 3 \\
  1  &  1  &  1  & 1  &  1  &  1  &  0  &  0  & 252 (255 - 3)
\end{tabular}

\vspace{10pt}
\[ 64 + 4 + 2 = 70 \]
\[ 128 + 16 + 2 + 1 = 147 \]
\[ 2 + 1 = 3 \]
\[ 128 + 64 + 32 + 16 + 8 + 4 = 252 \]

\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{From decimal to binary}

\begin{scriptsize}
\begin{itemize}
  \item Is the number greater than, or equal to 128?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{7}$, and subtract 128 / \textbf{No}: put 0 at position $2^{7}$.
  \end{scriptsize}
  \end{itemize}

  \item Is the number greater than, or equal to 64?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{6}$, and subtract 64 / \textbf{No}: put 0 at position $2^{6}$.
  \end{scriptsize}
  \end{itemize}


  \item Is the number greater than, or equal to 32?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{5}$, and subtract 32 / \textbf{No}: put 0 at position $2^{5}$.
  \end{scriptsize}
  \end{itemize}

  \item Is the number greater than, or equal to 16?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{4}$, and subtract 16 / \textbf{No}: put 0 at position $2^{4}$.
  \end{scriptsize}
  \end{itemize}

  \item Is the number greater than, or equal to 8?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{3}$, and subtract 8 / \textbf{No}: put 0 at position $2^{3}$.
  \end{scriptsize}
  \end{itemize}

  \item Is the number greater than, or equal to 4?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{2}$, and subtract 4 / \textbf{No}: put 0 at position $2^{2}$.
  \end{scriptsize}
  \end{itemize}
  \item Is the number greater than, or equal to 2?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{1}$, and subtract 2 / \textbf{No}: put 0 at position $2^{1}$.
  \end{scriptsize}
  \end{itemize}

  \item Is the number equal to 1?
  \begin{itemize}
  \begin{scriptsize}
    \item \textbf{Yes}: put 1 at position $2^{0}$ / \textbf{No}: put 0 at position $2^{0}$.
  \end{scriptsize}
  \end{itemize}

\end{itemize}
\end{scriptsize}

\end{frame}
\begin{frame}
\frametitle{From decimal to binary, 193}

\begin{centering}

\begin{tabular}{r||r|c|r||r|}
Pos. & Value & Binary & Subtract & Remain \\
\hline
128 &  193   &    1  &   128    &  65  \\
 64 &   65   &    1  &    64    &   1  \\
 32 &    1   &    0  &          &      \\
 16 &    .   &    0  &          &      \\
  8 &    .   &    0  &          &      \\
  4 &    .   &    0  &          &      \\
  2 &    .   &    0  &          &      \\
  1 &    1   &    1  &     1    &   0  \\
\hline
\end{tabular}

\vspace{30pt}
\begin{Large}
Result: 1 1 0 0 0 0 0 1
\end{Large}

\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{From decimal to binary, 75}

\begin{centering}

\begin{tabular}{r||r|c|r||r|}
Pos. & Value & Binary & Subtract & Remain \\
\hline
128 &   75   &    0  &          &  75  \\
 64 &   75   &    1  &    64    &  11  \\
 32 &   11   &    0  &          &      \\
 16 &    .   &    0  &          &      \\
  8 &   11   &    1  &     8    &   3  \\
  4 &    3   &    0  &          &      \\
  2 &    3   &    1  &     2    &   1  \\
  1 &    1   &    1  &     1    &   0  \\
\hline
\end{tabular}

\vspace{30pt}
\begin{Large}
Resultat: 0 1 0 0 1 0 1 1
\end{Large}

\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{From decimal to binary, 10}

\begin{centering}

\begin{tabular}{r||r|c|r||r|}
Pos. & Value & Binary & Subtract & Remain \\
\hline
128 &   10   &    0  &          &      \\
 64 &    .   &    0  &          &      \\
 32 &    .   &    0  &          &      \\
 16 &    .   &    0  &          &      \\
  8 &   10   &    1  &     8    &   2  \\
  4 &    2   &    0  &          &      \\
  2 &    2   &    1  &     2    &   0  \\
  1 &    0   &    0  &          &      \\
\hline
\end{tabular}

\vspace{30pt}
\begin{Large}
Resultat: 0 0 0 0 1 0 1 0
\end{Large}


\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{From decimal to binary, 235}

\begin{centering}

\begin{tabular}{r||r|c|r||r|}
Pos. & Value & Binary & Subtract & Remain \\
\hline
128 &  235   &    1  &   128    & 107  \\
 64 &  107   &    1  &    64    &  43  \\
 32 &   43   &    1  &    32    &  11  \\
 16 &   43   &    0  &          &      \\
  8 &   11   &    1  &     8    &   3  \\
  4 &   11   &    0  &          &      \\
  2 &    1   &    1  &     2    &   1  \\
  1 &    1   &    1  &     1    &   0  \\
\hline
\end{tabular}

\vspace{30pt}
\begin{Large}
Resultat: 1 1 1 0 1 0 1 1
\end{Large}

\end{centering}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{The buildup of an IP address}

An IPv4 address is really a 32-bit value, written as four
groups of eight bit.

\begin{itemize}
  \item Makes them easier to read.
  \item Makes grouping easier.
  \item Makes calculations on parts simpler.
\end{itemize}

We can use the method we just learned, and do calculations on each octet
by itself. In sub-neting and super-neting, we may ignore the octets that
are not affected by a given mask.

\vspace{10pt}

\begin{tabular}{ccccccc}
192 & . & 168 & . & 0 & . & 10 \\
11000000 & . & 10101000 & . & 00000000 & .  & 00001010
\end{tabular}


\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{What is a network mask?}

A network mask is a 32-bit number determining what parts
of an IP-address is representing a network, and what parts
represent a single given host within that network.

\begin{itemize}
  \item A network: a logical group of nodes
  \item A network address, the part of all node addresses that are identical
  \item A host/node address, the part of the address that is unique.
  \item The network mask is involved in determining network and host address.
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{How does the network mask work?}

\begin{itemize}
\item
In the network mask, all bits that represent the \textbf{network} have
the value \textbf{1}, while all the bits that represent the host component
have the value \textbf{0}.
\vspace{10pt}

\item
In the network mask, we supply ones (\textbf{1}) from the left until the
\textit{entire} network address is identified. After this, we suppy
zeroes (\textbf{0} until we have 32 bits.
\vspace{10pt}

\item
There will \textit{\textbf{never}} be a zero before a one when reading
from left to right
\vspace{10pt}

\item
Simmilar; there will \textit{\textbf{never}} be a one before a zero when
reading from right to left.
\vspace{10pt}

\item
The number of ones in the network mask is called the mask length.

\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{How does the network mask behave in binary?}

\begin{itemize}
  \item Network equipment use the mask to do boolean calculations
  \begin{itemize}
    \item AND
    \item NOT
  \end{itemize}

  \item IP-address AND network mask gives network address
  \item IP-address AND NOT network mask gives the host address.

\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{How does the network mask behave in binary?}

\begin{tabular}{l|ccccccc}
\hline \hline
   & 192 & . & 168 & . & 0 & . & 10 \\
   & 11000000 & . & 10101000 & . & 00000000 & .  & 00001010 \\
\hline \hspace{2pt}\\ \hline
   & 255 & . & 255 & . & 255 & . & 0 \\
   & 11111111 & . & 11111111 & . & 11111111 & .  & 00000000 \\
\hline \hspace{2pt}\\ \hline
   & 11000000 & . & 10101000 & . & 00000000 & .  & 00001010 \\
\& & 11111111 & . & 11111111 & . & 11111111 & .  & 00000000 \\
\hline
=  & 11000000 & . & 10101000 & . & 00000000 & .  & 00000000 \\
=  & 192 & . & 168 & . & 0 & . & 0 \\
\hline \hspace{2pt}\\ \hline
   & 11000000 & . & 10101000 & . & 00000000 & .  & 00001010 \\
\& ! & 11111111 & . & 11111111 & . & 11111111 & .  & 00000000 \\
\hline
=  & 00000000 & . & 00000000 & . & 00000000 & .  & 00001010 \\
=  & 0 & . & 0 & . & 0 & . & 10 \\
\hline \hline
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{A simpler view on the network mask}

When you see a network mask and an IP address represented in binary:

\begin{itemize}
  \item Place a separator between the last \textbf{1} and the first \textbf{0} in the mask
  \item Place a separator at the same spot in the IP address.
  \item Anything \textbf{before} the separator is the network address.
  \item Anything \textbf{after} the separator is the host address.
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{An example of simple mask representation:}

\begin{tabular}{l|ccccccc}
\hline \hline
   & 192 & . & 168 & . & 0 & . & 10 \\
   & 11000000 & . & 10101000 & . & 00000000 & .  & 00001010 \\
\hline \hspace{2pt}\\ \hline
   & 255 & . & 255 & . & 255 & . & 0 \\
   & 11111111 & . & 11111111 & . & 11111111 & .  & 00000000 \\
\hline \hspace{2pt}\\ \hline
   & 11111111 & . & 11111111 & . & 11111111 & \vline  & 00000000 \\
   & 11000000 & . & 10101000 & . & 00000000 & \vline  & 00001010 \\
\hline
nett & \textbf{11000000} & . & \textbf{10101000} & . & \textbf{00000000} & \vline  & 00000000 \\
host & nnnnnnnn & . & nnnnnnnn & . & nnnnnnnn & \vline  & \textbf{00001010} \\
\hline \hline
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Another example of simple mask representation:}

\begin{tabular}{l|ccccccc}
\hline \hline
   & 192 & . & 168 & . & 20 & . & 10 \\
   & 11000000 & . & 10101000 & . & 00010100 & .  & 00001010 \\
\hline \hspace{2pt}\\ \hline
   & 255 & . & 255 & . & 0   & . & 0 \\
   & 11111111 & . & 11111111 & . & 00000000 & .  & 00000000 \\
\hline \hspace{2pt}\\ \hline
   & 11111111 & . & 11111111 & \vline & 00000000 & . & 00000000 \\
   & 11000000 & . & 10101000 & \vline & 00010100 & . & 00001010 \\
\hline
nett & \textbf{11000000} & . & \textbf{10101000} & \vline & 00000000 & .  & 00000000 \\
host & nnnnnnnn & . & nnnnnnnn & \vline & \textbf{00010100} & .  & \textbf{00001010} \\
\hline \hline
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{Network mask cheat-sheet}

\begin{centering}
\begin{tabular}{l||c|cccccc|cc}
\hline
Bits borrowed & 0   &   1 &   2 &   3 &   4 &   5 &   6 &   7 &   8 \\
Prefix        & /24 & /25 & /26 & /27 & /28 & /29 & /30 & /31 & /32 \\
Netmask       & 0   & 128 & 192 & 224 & 240 & 248 & 252 & 254 & 255 \\
N. of nets    & 1   &   2 &   4 &   8 &  16 &  32 &  64 & 128 & 256 \\
N. of values  & 256 & 128 &  64 &  32 &  16 &   8 &   4 &   2 &   1 \\
N. of hosts   & 254 & 126 &  62 &  30 &  14 &   6 &   2 &   - &   / 
\end{tabular}
\end{centering}
\vspace{40pt}

\end{frame}

%---------------------------------------------------------------
\begin{frame}

\frametitle{Broadcast!}

A complete IP addressing is composed by:
\begin{itemize}
  \item Network mask
  \begin{itemize}
    \item determining what is the network- and what is the host address
  \end{itemize}
  \item Network address
  \begin{itemize}
    \item The part of the IP address where all netmask bits are set to 1
  \end{itemize}
  \item Hostaddress
  \begin{itemize}
    \item The part of the IP address where all netmask bits are 0
  \end{itemize}
\end{itemize}

In addition to this, we have the \textbf{broadcast address}

This is composed of:
Denne er består av:
\begin{itemize}
  \item All parts of the network adress where the mask has a 1
  \item All bits set to 1 where the network mask is 0
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Broadcast? Purpose}

The purpose of the broadcast address is to be able to send data to
\textbf{all} hosts in the same network at the same time.

Hensikten med broadcast-adressen er å kunne sende data til \textbf{alle}
hosts i samme nettverk samtidig!

A computer/host listens for packets sendt to:
\begin{itemize}
  \item Its network address, with its own host address
  \item Its network address, and all host-bits set to one.
\end{itemize}

\begin{tabular}{l|ccccccc}
\hline \hline
IP   & 192 & . & 168 & . & 0 & . & 10 \\
Mask   & 255 & . & 255 & . & 255 & . & 0 \\
Net & \textbf{11000000} & . & \textbf{10101000} & . & \textbf{00000000} & \vline  & 00000000 \\
Host & nnnnnnnn & . & nnnnnnnn & . & nnnnnnnn & \vline  & \textbf{00001010} \\
B-Cast& \textbf{11000000} & . & \textbf{10101000} & . & \textbf{00000000} & \vline  & \textbf{11111111} \\
B-Cast& \textbf{192} & . & \textbf{168} & . & \textbf{0} & \vline  & \textbf{255} \\
\hline \hline
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{IP-addresses, class}

Back when the TCP model was introduced, and IP addressing was first
deployed, not many needed addresses, but they were needed in 
diffrent scopes. So, classes were applied.

Classes were ranges of nettwork addresses that could be allocated
to organizations based on an estimate of the number of hosts the
organisation planned to deploy.

Classes are today an impractical idea for deployment on the Internet,
but the still come up and bite us, so we need to know how they work.

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{IP-classes, distribution}

\begin{tabular}{l|rrrll}
Class           &  Class A & Class B & Class C & Class D   & Class E \\
\hline
Num. of bits  &  24       & 16      & 8       &          &         \\
Mask-bits       &   8       & 16      & 24      &          &         \\
Num. of hosts &  16 777 214 & 65 534   & 254     &          & \\
Num. of nets    &  128      & 16 384   & 2 097 152 & & \\
Use           &  Large & Medium & Small & Multicast & Res.
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{IP-classes, numbering}

The class-division of IP-addresses is done in the leading bits.
\begin{itemize}
  \item Class A:
  \begin{itemize}
    \item No leading 1's before first 0
  \end{itemize}

  \item Class B:
  \begin{itemize}
    \item One leading 1's before first 0
  \end{itemize}

  \item Class C:
  \begin{itemize}
    \item Two leading 1's before first 0
  \end{itemize}
  \item A 0 after the leading 1's

\end{itemize}
\vspace{10pt}

\begin{tabular}{llll}
Class A & 1-127   & 0 & \textbf{0}nnn nnnn  \\
Class B & 128-191 & 10 & \textbf{10}nn nnnn . nnnn nnnn \\
Class C & 192-223 & 110 & \textbf{110}n nnnn . nnnn nnnn . nnnn nnnn \\
Class D & 224-239 & 1110 & \textbf{1110}  \\
Class E & 240-255 & 11110 & \textbf{1111 0}
\end{tabular}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Special network numbers}

A set of special address ranges are allocated:
\begin{itemize}
  \item One for loopback (host local) addressing and internal testing (RFC1700, 3330)
  \item Four for internal networks, also known as private addresses (RFC1918, RFC3330)
\end{itemize}

The four private RFC1918 addressblocks are:
\begin{itemize}
  \item One Class A net: 10.0.0.0/8
  \item Sixteen Class B nets: 172.16.0.0/16 til 172.31.0.0/16
  \item 255 Class C nets: 192.168.0.0/24 til 192.168.255.0/24
  \item Link-local net, one Class B net: 169.254.0.0/16
\end{itemize}
\vspace{20pt}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Subnets}

\begin{itemize}
  \item Subnetting involves splitting a net into smaller parts
  \item Subnetting is done by "borrowing" bits from the host component
  \item Each bit borrowed splits the previous net in two halves.
\end{itemize}

Two formulas:
\begin{itemize}
  \item Number of host addresses = $2^{h} - 2$
  \item Number of subnets = $2^{s}$
\end{itemize}

Here, \textbf{s} represents number of borrowed bits,
and \textbf{h} the number of remaining host-address bits.

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{The size of a network}

\begin{itemize}
\item The number of hosts in a network is two less than the number
of valid values.

\item Number of valid values is determined by raising two by the power
of the number of host address bits.

\end{itemize}

Eksempel 1:
\begin{itemize}
  \item Netmask 255.255.255.0 (24 bit, 8 bit host)
  \item Valid values: 256 ($2^{8}$), 0 to 255
  \item Number of hosts: 256 - 2 = 254
\end{itemize}

Eksempel 2:
\begin{itemize}
  \item Netmask 255.255.255.128 (25 bit, 7 bit host)
  \item Valid values: 128 ($2^{7}$),  0 to 127 or 128 til 255
  \item Number of hosts: 128 - 2 = 126
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Number of networks}

\begin{itemize}
\item When subnetting, we always start with an original 
(allocated, chosen) network, with an original network mask.

\item The number of identically-sized networks we and ut with when
subnetting is determined by how many bits are extended to the original mask.

\item Bits added/extended, are borrowed/stolen from the host-address part.

\end{itemize}

Example:
\begin{itemize}
  \item Netmask 255.255.255.0 (24 bit, 8 bit host)
  \item Take two bits from host for use in new netmask
  \item New netmask: 255.255.255.192 (128 + 64)
  \item Number of nets: $2^{2} = 4$
  \item Number of hosts in each net: $2^{6} - 2  = 64 - 2 = 62$
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Network adresses after subnetting}

As we start subnetting with an original network address and netmask,
and then extend the network mask, our resulting nettwork addresses
will be the possible bit-combinations allowed by the added bits.

\begin{itemize}
\item 192.168.20.0 / 255.255.255.0 \\
\item 1100 0000 . 1010 1000 . 0001 1000  \\
\end{itemize}

Extend netmask with two bits:
\begin{itemize}
\item --- --- . --- --- . --- --- . \textbf{00}00 0000 $\Longrightarrow$ 192.168.20.\textbf{0}
\item --- --- . --- --- . --- --- . \textbf{01}00 0000 $\Longrightarrow$ 192.168.20.\textbf{64}
\item --- --- . --- --- . --- --- . \textbf{10}00 0000 $\Longrightarrow$ 192.168.20.\textbf{128}
\item --- --- . --- --- . --- --- . \textbf{11}00 0000 $\Longrightarrow$ 192.168.20.\textbf{192}
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Supernetting!}

\begin{itemize}
  \item Supernetting does not mean building networks for Superman
  \item Supernetting is the opposite of subnetting
  \item A different name for supernetting is \textbf{summarization}
\end{itemize}

When summarizing, we move the network-mark to the left, and create fewer, but lager, networks.
\begin{itemize}
  \item For each bit changed, we halve the number of networks, and double the number of hosts
  \item Two nets with identical mask, adjacent to each other on a "bit boundary" can be summarized
  directly by moving a bit in the netmask
  \item A "bit boundary" involbes having the first Bit to the left of the mask is set to zero
    in the first net, and one in the second.
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Supernetting!}

\begin{small}
172.16.2.0/24 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 001\textbf{0} . --- ---\\
172.16.3.0/24 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 001\textbf{1} . --- ---\\
\vspace{4pt}
172.16.2.0/23 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 001\textbf{--} . --- ---
\end{small}
\vspace{20pt}

\begin{small}
172.16.0.0/24 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 000\textbf{0} . --- ---\\
172.16.1.0/24 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 000\textbf{1} . --- ---\\
\vspace{4pt}
172.16.0.0/23 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 000\textbf{--} . --- ---
\end{small}
\vspace{20pt}

\begin{small}
172.16.0.0/23 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 00\textbf{0--} . --- ---\\
172.16.2.0/23 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 00\textbf{1--} . --- ---\\
\vspace{4pt}
172.16.0.0/22 $\rightarrow$ 1010 1100 . 0001 0000 . 0000 00\textbf{-- --} . --- ---
\end{small}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Supernetting!}

The number of hosts in a net is determined by $2^{h} - 2$. When supernetting, 
we increase the number of bits in the host-part of the address

\begin{itemize}
  \item Example, /24-nets joined to form a single /22:
\end{itemize}

\[
    2^{8} = 256
\] \[
    2 \cdot 2^{8} = 2^{9} = 512
\] \[
    2 \cdot 2^{9} = 2^{10} = 1024
\]

We have moved from 24 mask-, 8 hostbits to 22 mask- and 10 hostbits, and end up with:
\[
    2^{10} - 2 = 1024 - 2 = 1022 (hosts)
\]
\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Classfull addressing}

We can change address ranges:
\begin{itemize}
  \item From large nets to smaller nets using subnetting
  \item From smaller nets to lager nets using supernetting
\end{itemize}

Initially, one always started on the class boundaries, and created smaller
subnets. In addition, all subnets created followed the classful principal,
and were of identical size.


\vspace{5pt}
The same applied to supernetting, one never crossed the class boundary of
the allocated classful network address when summarizing.

\vspace{5pt}
In classfull addressing:
\begin{itemize}
  \item \textbf{all networks have the same size}
  \item class boundaries are absolute.
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Inefficient addressing}

Classfull addressing is inefficient, lots and lots of addresses are wasted,
for instance when using link-networks. If you need 1025 hosts in a subnet, 
you need at leas a Class B network (65534 hosts), subnetted to 21 bits mask
at the smallest. With 21 bits in the mask: $2^{11} - 2 = 2046 hosts$

Inside your organization, all nets would have to be that size, even
if you were deploying a link-net, having only two hosts/nodes!

\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{Classless addressing}

Classless addressing involves not caring about the old class divisions!

\begin{itemize}
  \item Classless addressing allows summarization of two classfull segments
  \begin{itemize}
    \item As example, two C-class nets (startbit 110, 24 bit) can be summed into one.
  \end{itemize}
  \item Classless addressing allows nets of different sizes within the same allocated segment.
\end{itemize}

\begin{itemize}
  \item IP addresse is now done in a classless manner.
\end{itemize}


\end{frame}
%---------------------------------------------------------------
\begin{frame}

\frametitle{CIDR and VLSM}

\begin{itemize}
  \item \large{VLSM}\\
        In a classical network of classful nets, separated in smaller, equal parts.
        Communication went vie routers exchanging only network addresses. All nets had
        to be of identical size. Introduction of Variable Length Subnet Mask allowed
        networks to be separated into various different sizes.

        To accomplish this, Classless routing protocols where created, where the 
        \textit{network mask} was send along with the network address

  \item \large{CIDR} allows routing-tables to be smaller, by supernetting across
        classful boundaries, and using "prefix length" in place of the network mask
        \begin{itemize}
          \item 192.168.20.0 255.255.252.0 $\Longrightarrow$ 192.168.20.0/22
        \end{itemize}
\end{itemize}

\end{frame}
%---------------------------------------------------------------
\begin{frame}
\frametitle{CIDR compared to VLSM}

\begin{itemize}
  \item VLSM is sub- og supernetting inside a single network
  \item CIDR is summarization in routing between networks.
  \item VLSM-nets are dependant on CIDR to be able to communicate.
  \item CIDR applies VLSM as its absolute central concept.
\end{itemize}

Both are terms within \textbf{Classless addressing and routing}

\end{frame}
%---------------------------------------------------------------

\begin{frame}[fragile]

\frametitle{TASKS!}

\begin{itemize}
  \item Check that you have IMT2521 in Fronter
  \item Verify that you can log on to Cisco Networking Academy
  \item IP Addressing and Subnetworking Workbook
  \item VLSM Workbook
\end{itemize}


\end{frame}
%---------------------------------------------------------------

\end{document}
