#### Prefijo
\\[
{\scriptstyle
\begin{array}{cccc}
32 & - & 7 & = /25 \\\\
\text{Total} & \text{} & \text{Host} & \text{CIDR}
\end{array}
}
\\]
\\[
\text{CIDR } /25 =
\begin{cases}
25 \text{ bits de red} \\\\
7 \text{ bits de host}
\end{cases}
\\]
#### Máscara de Subred
En binario:
\\[
\begin{array}{cccc}
\textcolor{green}{11111111} &
\textcolor{green}{11111111} &
\textcolor{green}{11111111} &
\textcolor{green}{1}0000000 \\\\
255 & 255 & 255 & 128
\end{array}
\\]
\\[
\text{Cada bit representa potencias de 2:}
\\]
\\[
\begin{array}{cccccccc}
128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\\\
2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0
\end{array}
\\]
---
## WAN (2 hosts)
Buscamos el menor valor de (n):
\\[2^1 - 2 = 0\\]
(no alcanza)
\\[2^2 - 2 = 2\\]
(exacto)
#### Prefijo
\\[
{\scriptstyle
\begin{array}{cccc}
32 & - & 2 & = /30 \\\\
\text{Total} & \text{} & \text{Host} & \text{CIDR}
\end{array}
}
\\]
\\[
\text{CIDR } /30 =
\begin{cases}
30 \text{ bits de red} \\\\
2 \text{ bits de host}
\end{cases}
\\]
#### Máscara de Subred
En binario:
\\[
\begin{array}{cccc}
\textcolor{green}{11111111} &
\textcolor{green}{11111111} &
\textcolor{green}{11111111} &
\textcolor{green}{111111}00 \\\\
255 & 255 & 255 & 252
\end{array}
\\]
\\[
\text{Cada bit representa potencias de 2:}
\\]
\\[
\begin{array}{cccccccc}
128 & 64 & 32 & 16 & 8 & 4 & 2 & 1 \\\\
2^7 & 2^6 & 2^5 & 2^4 & 2^3 & 2^2 & 2^1 & 2^0
\end{array}
\\]
---
## Paso 2
### Asignar las redes (VLSM)
Se asignan desde la más grande a la más pequeña.
---
#### Laboratorios
Red:
**172.16.0.0/22**
#### Bloque
\\[
256 - 252 = 4
\\]
Avanza de 4 en el tercer octeto.
\\[
\text{Rango de hosts} =
\begin{cases}
\text{Primera IP: 172.16.0.1} \\\\
\text{Última IP: 172.16.3.254}
\end{cases}
\\]
\\[
\begin{array}{|c|}
\hline
\text{Puerta de enlace} \\\\
\hline
172.16.0.1 \\\\
\hline
\end{array}
\\]
\\[
\begin{array}{|c|}
\hline
\text{Broadcast} \\\\
\hline
172.16.3.255 \\\\
\hline
\end{array}
\\]
---
## Administración
Red:
**172.16.4.0/23**
#### Bloque
\\[
256 - 254 = 2
\\]
Avanza de 2 en el tercer octeto.
\\[
\text{Rango de hosts} =
\begin{cases}
\text{Primera IP: 172.16.4.1} \\\\
\text{Última IP: 172.16.5.254}
\end{cases}
\\]
\\[
\begin{array}{|c|}
\hline
\text{Puerta de enlace} \\\\
\hline
172.16.4.1 \\\\
\hline
\end{array}
\\]
\\[
\begin{array}{|c|}
\hline
\text{Broadcast} \\\\
\hline
172.16.5.255 \\\\
\hline
\end{array}
\\]
---
## Invitados
Siguiente red:
**172.16.6.0/25**
Bloque:
\\[256 - 128 = 128\\]
Rango:
* Primera IP: 172.16.6.1
* Última IP: 172.16.6.126
Broadcast:
* 172.16.6.127
---
## Enlace WAN
Siguiente red:
**172.16.6.128/30**
Bloque:
\\[256 - 252 = 4\\]
Rango:
* Primera IP: 172.16.6.129
* Última IP: 172.16.6.130
Broadcast:
* 172.16.6.131
---
# Resultado final
| Área | Red | Prefijo | Máscara | Primera IP | Última IP | Broadcast |
| -------------- | ------------ | ------- | --------------- | ------------ | ------------ | ------------ |
| Laboratorios | 172.16.0.0 | /22 | 255.255.252.0 | 172.16.0.1 | 172.16.3.254 | 172.16.3.255 |
| Administración | 172.16.4.0 | /23 | 255.255.254.0 | 172.16.4.1 | 172.16.5.254 | 172.16.5.255 |
| Invitados | 172.16.6.0 | /25 | 255.255.255.128 | 172.16.6.1 | 172.16.6.126 | 172.16.6.127 |
| WAN | 172.16.6.128 | /30 | 255.255.255.252 | 172.16.6.129 | 172.16.6.130 | 172.16.6.131 |
### Fórmulas utilizadas
**1. Hosts necesarios**
\\[2^n - 2 \geq Hosts\\]
Determina cuántos bits de host necesitas.
---
**2. Prefijo**
\\[32 - n\\]
Obtiene la máscara CIDR.
---
**3. Tamaño del bloque**
\\[256 - \text{octeto de la máscara}\\]
Sirve para encontrar dónde comienza la siguiente subred.
Ejemplos:
* /22 → 255.255.252.0 → (256-252=4)
* /23 → 255.255.254.0 → (256-254=2)
* /25 → 255.255.255.128 → (256-128=128)
* /30 → 255.255.255.252 → (256-252=4)