MFormations
Modern Network Engineering

Chapitre 3

Chapter 03: IPv4 et IPv6

Chapter 03: IPv4 et IPv6

Chapter 03: IPv4 et IPv6

1. IPv4 Addressing

1.1 IPv4 Address Structure

An IPv4 address is a 32-bit number, typically written in dotted-decimal notation: 192.168.1.10

Binary: 11000000.10101000.00000001.00001010 Decimal: 192.168.1.10

Each address has two parts:

  • Network portion: Identifies the network
  • Host portion: Identifies the host within the network

1.2 Address Classes (Classful Addressing)

Historically, IPv4 addresses were divided into classes:

ClassFirst BitsStartEndDefault MaskNetworksHosts/Network
A00.0.0.0127.255.255.255/812816,777,214
B10128.0.0.0191.255.255.255/1616,38465,534
C110192.0.0.0223.255.255.255/242,097,152254
D1110224.0.0.0239.255.255.255Multicast--
E1111240.0.0.0255.255.255.255Reserved--

1.3 CIDR (Classless Inter-Domain Routing)

RFC 1518/1519 (1993) replaced classful addressing with CIDR. The network/host boundary can be anywhere, specified by the prefix length: 192.168.1.0/24

Diagramme en cours de génération...

Key CIDR concepts:

  • Prefix length (e.g., /24) indicates number of network bits
  • No fixed class boundaries
  • Enables route aggregation (summarization)
  • Conserves address space

1.4 Subnetting

Dividing a network into smaller subnets.

Diagramme en cours de génération...

Subnetting Cheatsheet:

PrefixMaskNetworksHosts
/24255.255.255.01254
/25255.255.255.1282126
/26255.255.255.192462
/27255.255.255.224830
/28255.255.255.2401614
/29255.255.255.248326
/30255.255.255.252642
/31255.255.255.2541280 (point-to-point)
/32255.255.255.2552561 (host route)

1.5 VLSM (Variable Length Subnet Mask)

Using different subnet masks for different subnets within the same network.

Example: 192.168.1.0/24 with requirements:

  • Subnet A: 100 hosts → /25 (126 hosts)
  • Subnet B: 50 hosts → /26 (62 hosts)
  • Subnet C: 25 hosts → /27 (30 hosts)
  • Subnet D: 2 hosts (router link) → /30 (2 hosts)
Diagramme en cours de génération...

1.6 Special IPv4 Addresses

AddressPurpose
0.0.0.0/8"This network" (source only)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local (APIPA)
10.0.0.0/8Private (RFC 1918)
172.16.0.0/12Private (RFC 1918)
192.168.0.0/16Private (RFC 1918)
224.0.0.0/4Multicast
240.0.0.0/4Reserved
255.255.255.255Limited broadcast

1.7 NAT (Network Address Translation)

RFC 3022 - Translates private IPs to public IPs.

Diagramme en cours de génération...

NAT Types:

  • SNAT (Source NAT): Translate source IP (outbound)
  • DNAT (Destination NAT): Translate destination IP (inbound)
  • PAT (Port Address Translation): Many-to-one using ports
  • 1:1 NAT: One private IP to one public IP

1.8 IPv4 Header

Diagramme en cours de génération...

2. IPv6 Addressing

2.1 IPv6 Address Structure

IPv6 uses 128-bit addresses, written in hexadecimal: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Format rules:

  1. 8 groups of 16 bits (4 hex digits each)
  2. Leading zeros can be omitted
  3. One contiguous group of zeros can be replaced with ::

Example shortening: 2001:0db8:0000:0000:0000:8a2e:0370:73342001:db8:0:0:0:8a2e:370:73342001:db8::8a2e:370:7334

2.2 IPv6 Address Types

Diagramme en cours de génération...
TypePrefixRangeUsage
Global Unicast2000::/32000:: - 3fff:ffff:...Internet routable
Unique Localfc00::/7fc00:: - fdff:ffff:...Private (like 10.0.0.0/8)
Link-Localfe80::/10fe80:: - febf:ffff:...Local link only
Multicastff00::/8ff00:: - ffff:ffff:...One-to-many
Loopback::1/128::1Localhost
Unspecified::/128::Not assigned
IPv4-mapped::ffff:0:0/96::ffff:x.x.x.xIPv4 transition

2.3 IPv6 Header

Diagramme en cours de génération...

Simplified header vs IPv4:

  • No checksum (reduces processing)
  • No fragmentation (handled by sender)
  • No options (uses extension headers)
  • Fixed 40-byte header
  • Flow Label for QoS
  • Hop Limit instead of TTL

2.4 IPv6 Extension Headers

Diagramme en cours de génération...

2.5 SLAAC (Stateless Address Autoconfiguration)

Diagramme en cours de génération...

SLAAC flags in RA:

  • M (Managed): 0 = no DHCPv6, 1 = use DHCPv6 for addresses
  • O (Other): 0 = no other info, 1 = use DHCPv6 for other config

Address configuration methods:

MethodAddressOther ConfigUse Case
SLAACRA prefix + EUI-64/privacyNone (or RDNSS)Simple networks
SLAAC + DHCPv6RA prefix + EUI-64/privacyDHCPv6 for DNS etc.Enterprise
DHCPv6 (stateless)RA prefix + EUI-64/privacyDHCPv6 for optionsManaged networks
DHCPv6 (stateful)DHCPv6 (M=1)DHCPv6Managed networks

2.6 NDP (Neighbor Discovery Protocol)

Replaces ARP in IPv6. Uses ICMPv6 messages:

MessageTypePurpose
NS (Neighbor Solicitation)135Request MAC of neighbor
NA (Neighbor Advertisement)136Response to NS
RS (Router Solicitation)133Request RA from router
RA (Router Advertisement)134Announce prefixes, routes
Redirect137Better next hop

NDP vs ARP:

  • NDP uses ICMPv6 (not a separate protocol)
  • NDP includes DAD, SLAAC
  • NDP uses solicited-node multicast (not broadcast)
  • NDP is secured by Secure Neighbor Discovery (SEND)

3. ICMP (Internet Control Message Protocol)

3.1 ICMPv4

Used for diagnostics and error reporting.

TypeCodeDescription
00Echo Reply
30Destination Network Unreachable
31Destination Host Unreachable
33Port Unreachable
34Fragmentation Needed (DF set)
80Echo Request
110TTL Exceeded
111Fragment Reassembly Time Exceeded

3.2 ping

Diagramme en cours de génération...

3.3 traceroute

Diagramme en cours de génération...

3.4 Path MTU Discovery

Diagramme en cours de génération...

4. Transition Mechanisms

4.1 Dual Stack

Both IPv4 and IPv6 run simultaneously. The device uses whichever is available.

Diagramme en cours de génération...

4.2 Tunneling

IPv6 packets encapsulated in IPv4 (or vice versa).

Diagramme en cours de génération...

Tunnel Types:

  • 6in4: IPv6 in IPv4 (protocol 41)
  • 6to4: Automatic tunnel using 2002::/16
  • Teredo: IPv6 over UDP
  • ISATAP: Intra-site Automatic Tunnel
  • GRE: Generic Routing Encapsulation

4.3 NAT64 / DNS64

Translates IPv6-only clients to IPv4 servers.

Diagramme en cours de génération...

5. Subnetting Exercises

Example 1: Basic Subnetting

Network: 192.168.1.0/24 → Create 4 subnets

SubnetNetworkRangeBroadcast
1192.168.1.0/26.1 - .62.63
2192.168.1.64/26.65 - .126.127
3192.168.1.128/26.129 - .190.191
4192.168.1.192/26.193 - .254.255

Example 2: VLSM

Given: 10.0.0.0/8

  • Need: 500 hosts → /23 (510 hosts)
  • Need: 200 hosts → /24 (254 hosts)
  • Need: 100 hosts → /25 (126 hosts)
  • Need: 2 router links → /30 each

Allocation:

  1. 10.0.0.0/23 (500 hosts)
  2. 10.0.2.0/24 (200 hosts)
  3. 10.0.3.0/25 (100 hosts)
  4. 10.0.3.128/30 (router link 1)
  5. 10.0.3.132/30 (router link 2)

Example 3: IPv6 Subnetting

Prefix: 2001:db8:abcd::/48

Subnets available: 16 bits = 65,536 /64 subnets

SubnetPrefixUse
02001:db8:abcd:0000::/64Management
12001:db8:abcd:0001::/64Users Floor 1
22001:db8:abcd:0002::/64Users Floor 2
.........
FFFF2001:db8:abcd:ffff::/64Reserved

6. Summary

AspectIPv4IPv6
Address size32 bits128 bits
NotationDotted decimalHexadecimal
Header size20-60 bytes40 bytes
Address typesUnicast, multicast, broadcastUnicast, multicast, anycast
Private addressesRFC 1918ULA (fc00::/7)
Link-localAPIPA (169.254/16)fe80::/10
ARPARP (broadcast)NDP (multicast)
FragmentationRouters can fragmentOnly source fragments
ChecksumHas header checksumNo checksum
QoSTOS byteTraffic class + Flow label
IPsecOptionalOriginally required
ConfigDHCP (manual or auto)SLAAC, DHCPv6

7. Exercises

Exercise 1

Given 172.16.0.0/16, subnet for 30 subnets. What prefix length? What are the first 3 subnet addresses?

Exercise 2

Calculate: What is the network address, broadcast, and valid host range for 192.168.15.37/28?

Exercise 3

Design a VLSM plan for: 10.0.0.0/8 with 3 subnets needing 1000, 500, and 250 hosts, plus 5 /30 point-to-point links.

Exercise 4

IPv6: Shorten 2001:0db8:0000:0000:0000:ff00:0042:8329. Expand fe80::1.

Exercise 5

Calculate the EUI-64 interface ID for MAC 00:1a:2b:3c:4d:5e.