Link layer and IP
Introducido
7:25
Redes de computadoras
A network carries your bytes across a planet of machines that owe each other nothing. The first three units move a frame: layering, the link layer with IP, and…
Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar
En esta lección
| English | Significado |
|---|---|
| frame/freɪm/ | A discrete unit in a sequence or transmission; in video, one complete image, and in networking, a link-layer data unit. |
| MAC address/mæk əˈdres/ | A link-layer identifier used to address a network interface within a local network. |
| CRC/ˌsiː ɑː ˈsiː/ | CRC (código de redundancia cíclica) |
| IP address/ˌaɪ ˈpiː əˈdres/ | A numerical address used to identify and route traffic to an interface on an Internet Protocol network. |
| NAT/næt/ | network address translation: a router rewrites private source addresses and ports to one public address and remembers each mapping |
| subnet/ˈsʌbnet/ | Subdivisions of an IP network defined by their address prefixes. |
| ARP/ɑːp/ | the protocol that finds the MAC address for an IP address on the local network |
| hosts | |
| default gateway/dɪˈfɒlt ˈɡeɪtweɪ/ | the router a host sends packets to when the destination is outside its own network |
Dos direcciones, dos alcances
- Un marco Ethernet: dirección MAC de destino de 6 bytes, origen de 6 bytes, tipo de 2 bytes, carga útil, CRC de 4 bytes. La MAC nombra a un vecino y cambia en cada salto.
- Un encabezado IPv4: versión/IHL, longitud total, TTL, protocolo, suma de verificación, direcciones IP de origen y destino de 4 bytes. La IP identifica al destinatario y nunca cambia.


Crossing 3 routers, the destination IP —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
MAC names the neighbour and changes; IP names the stranger and never does.
Decodificar el encabezado del curso
45 00 00 3C … 40 06 …: versión 4, IHL 5 — $5 \times 4 = 20$ bytes de encabezado; longitud total $0x003C = 60$ (20 encabezado + 40 carga útil); TTL $0x40 = 64$; protocolo 6 = TCP.- El CRC protege todo el marco enlace por enlace; la suma de verificación IP solo protege el encabezado de extremo a extremo: los routers reescriben el encabezado (el TTL se decrementa) pero no los datos, por lo que la integridad se limita a lo que su reescritor toca.
IHL = 5 means the header is —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
IHL counts 32-bit words: 5 x 4 = 20 bytes.
Tres routers, cuatro marcos
- Al cruzar 3 routers, un paquete viaja en 4 marcos y transporta 4 MACs de destino diferentes —uno por salto, seleccionado por IP— mientras su IP de destino permanece fija durante todo el trayecto.
- El IHL cuenta palabras de 32 bits, la longitud total cuenta bytes: mezclar ambas unidades es el error clásico del encabezado.
Total length 0x003C with IHL 5 leaves — payload bytes
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
60 total - 20 header = 40 payload bytes.
As a packet crosses three routers, its destination MAC address stays the same all the way.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
A MAC address names only the next neighbour, so each of the $4$ frames carries a new destination MAC. The destination IP address is what stays the same end to end.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Subnets and ARP
- The prefix length fixes the size of a subnet 子网. A /24 has $256$ addresses and $254$ usable hosts (the network and broadcast addresses are reserved); a /26 has $64$, so $62$ hosts. Host $192.168.1.130/26$ is in the block $192.168.1.128$ to $.191$.
- To send inside its own subnet, a host needs the neighbour's MAC, so ARP 地址解析协议 broadcasts "who has this IP?" and caches the reply. For any address outside the subnet, the host sends the frame to the MAC of the default gateway 默认网关 instead.
How many usable host addresses does a /27 subnet have?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
2^(32-27) = 32 addresses, minus network and broadcast = 30.
What is the network address of 10.0.5.77/28?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
A /28 block holds 16 addresses; 77 falls in 64 to 79, so the network address is 10.0.5.64.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Many hosts behind one address
- A home router with NAT 网络地址转换 gives the laptops private addresses such as 192.168.1.20. On the way out, it rewrites the source to its one public address and a new port, and remembers the pair.
- Replies come back to that port and are rewritten again. An outside host cannot open a connection inwards, because no entry exists until an inside host sends first.
Behind NAT, an outside host can open a connection to an inside laptop with no setup.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
The router has no mapping until the inside host sends first.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Worked example: split a /24 into four
- Four /26 blocks of 64 addresses fit in 192.168.1.0/24: .0, .64, .128 and .192, each with 62 usable hosts 主机.
- Host 192.168.1.200/26 is in the last block: network .192, broadcast .255, hosts .193 to .254. A /27 halves that again: 32 addresses, $\mathbf{30}$ hosts.
Usable hosts in a /27 subnet?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$2^5 = 32$ addresses minus network and broadcast.
Host 192.168.1.200/26 belongs to the block starting at:
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
The /26 blocks start at .0, .64, .128 and .192.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Marks that slip away
- IHL in bytes. IHL counts 32-bit words: IHL $5$ means $20$ bytes.
- The MAC as an end-to-end address. The MAC changes at every hop; the IP address IP地址 stays the same.
- Thinking the IP checksum covers the data, end to end. It covers only the header and is recomputed at every router; TCP's checksum protects the data end to end.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Recap
- The MAC names the next neighbour and changes every hop; the IP address IP地址 names the destination and stays fixed.
- IHL counts 32-bit words; total length counts bytes.
- CRC: one link. IP checksum: the header, hop by hop. TCP/UDP checksum: the data, end to end.
¿Qué salió mal? Solo el equipo del sitio ve esta información.