Skip to main content
PSUT / IoTEngineering learning studio
WORKSPACE
Offline-first portalDr. Mohammad Alja’afreh
Connected Networks StudioNetworking and CommunicationExperimentsWorkspaces
ENGINEERING WORKSPACE
Home/Engineering Workspaces/N14 · IPv6 Addressing & Subnetting
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
Communication Networks · advanced laboratory
Networking and Communication

IPv6 Addressing & Subnetting

Ask Dr. Mohammad · N14 →

Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

Design experiment & verify evidence →
N14 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice
Learning workflow · Advanced networksN14 · IPv6 Addressing & Subnetting
N14 · Academic orientation

Scope and objectives

Scope of the experiment

Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

The focus of this experiment is to expand and compress IPv6 addresses and identify network prefixes. Students then calculate child-prefix allocation and address ranges, and verify prefix membership without IPv4 broadcast subtraction. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.

Learning objectives

  • Expand and compress IPv6 addresses and identify network prefixes.
  • Calculate child-prefix allocation and address ranges.
  • Verify prefix membership without IPv4 broadcast subtraction.
  • Identify the configured inputs (IPv6 address; Parent prefix length (0–128); Peer IPv6 address; Child prefix length (0–128); Child subnet index (decimal)) and record the corresponding observed outputs with units where applicable.
  • Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.

Expected learning outcomes

On completion, students can expand and compress IPv6 addresses and identify network prefixes, calculate child-prefix allocation and address ranges, and verify prefix membership without IPv4 broadcast subtraction.

Required deliverables

Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing verify prefix membership without IPv4 broadcast subtraction. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the following catalogue prerequisites before starting.

Environment and experimental methodology

The browser instrument and the specified local software or network environment. Use the experiment’s documented topology and distinguish modeled values from actual packet observations.

Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.

N14 · learning outcome

Understand the experiment

IPv6 prefix and child allocation

Network and host fields are determined by prefix length, not punctuation.
Network and host fields are determined by prefix length, not punctuation.

Scientific architecture · IPv6 Addressing & Subnetting

IPv6 binary and canonical notation — 0010 0000 0000 0001 / 2001; 0000 1101 1011 1000 / 0db8 → db8; 0000 0000 0001 0000 / 0010 → 10; All-zero hextets / longest run → ::; Example / 2001:db8:10::1
Scientific concept map: IPv6 address — Eight 16-bit hextets; Prefix length — Network bits; Canonical form — Compress zero run; Subnet index — Child prefix allocation; Membership — Compare masked addresses.

Scientific foundations and analytical reasoning

IPv6 contains 128 bits in eight hextets. Prefix membership compares leading bits; canonical text removes leading zeros and compresses the longest multi-hextet zero run.

Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.

Scientific theory · Binary representation and prefixes

An IPv6 address consists of 128 bits in eight 16-bit hextets. Each hextet contains four hexadecimal digits, each representing exactly four bits with weights 8,4,2,1. Leading zeros within a hextet may be omitted; trailing zeros within a nonzero hextet cannot be removed. Canonical form uses lowercase and replaces the longest run of two or more consecutive zero hextets with a single double colon, choosing the first run on a tie.

Worked example and engineering interpretation

The hextet 0000 1101 1011 1000 becomes 0db8 then db8. The hextet 0000 0000 0001 0000 becomes 0010 then 10, never 1. A /48 can be subdivided into 2^(64−48)=65,536 /64 networks. Prefix membership compares leading bits, not textual similarity. Use the conversion workstation below for a reversible 128-bit check.

From binary to hexadecimal: the positional rule

Every four bits encode one hexadecimal digit. For bits b3 b2 b1 b0, the digit is 8b3 + 4b2 + 2b1 + b0. Group 32 such digits into eight hextets of four digits each, separated by colons. The following table provides all possible conversions.

BinaryHexBinaryHex
0000010008
0001110019
001021010a
001131011b
010041100c
010151101d
011061110e
011171111f

Worked address conversion

Hextet16 binary bitsFour hex digitsWithout leading zeros
H10010 0000 0000 000120012001
H20000 1101 1011 10000db8db8
H30001 0010 0011 010012341234
H40000 0000 0000 011100077
H50000 0000 0000 000000000
H60000 0000 0000 000000000
H70000 0000 0000 000000000
H80000 0000 0100 0010004242

Expanded: 2001:0db8:1234:0007:0000:0000:0000:0042

Leading zeros removed: 2001:db8:1234:7:0:0:0:42

Canonical: 2001:db8:1234:7::42. The double colon represents exactly three whole zero hextets. In the reverse conversion five hextets are explicit, so restore 8−5=3 zeros, then pad all fields to four digits.

Leading versus trailing zeros: do not change the value

OriginalCorrect canonical formWhy
001010Leading zeros are removable; the trailing zero is significant (16 decimal, not 1).
0a00a00The two trailing zeros must remain; a00 is 2560 decimal.
2001:db8:0:0:10:0:0:02001:db8:0:0:10::Compress the three whole trailing zero fields, not the two shorter internal zeros.
2001:db8:0:0:1:0:0:12001:db8::1:0:0:1Two equal-length runs; choose the leftmost.
2001:db8:1:0:2:3:4:102001:db8:1:0:2:3:4:10A single zero field is not compressed in RFC 5952 canonical output.
0:0:0:0:0:0:0:1::1Seven leading whole zero fields; unspecified all-zero address is ::.

Use :: at most once. The uncompressed spelling may be valid even when noncanonical. IPv6 prefix notation (for example /64) describes the network bits and is separate from textual shortening. IPv6 has no broadcast address. Link-local, multicast and loopback have distinct semantics. In this lab the converter focuses on hexadecimal notation; dotted-decimal mixed notation, zone identifiers and prefix suffixes are not accepted by the converter.

Standards: RFC 4291 §2.2–2.3; RFC 5952 §4 (canonical hexadecimal representation).

Engineering principles · additional worked teaching example

IPv6 has 128 bits; /56 leaves 8 bits for /64 child subnet index, giving 256 /64 networks. 2001:db8:abcd:1200::/56 child index 0x34 is 2001:db8:abcd:1234::/64. Zero compression may be used only once.

From theory to experiment

Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.

How to investigate IPv6 Addressing & Subnetting

Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.

Experiment-specific guided practice

Objective: Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

  1. Enter the baseline address exactly as shown. Observe the eight 16-bit hextets, leading-zero removal, and longest zero-run compression (leftmost on a tie, no compression of a single zero hextet). The bit panel separates parent prefix, child-subnet extension and remaining bits.
  2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7.
  3. Set parent /64, child /64, index 0. Change peer to 2001:db8:1234:7::99, then 2001:db8:1234:8::1. Expected: same prefix, then different prefix.
  4. Inspect ::, ::1, fe80::1, fd00::1, ff02::1, ::ffff:192.0.2.1. To avoid unrelated allocation errors, use parent /64, child /64 and index 0. Expected: unspecified, loopback, link-local, unique-local, multicast and IPv4-mapped respectively. No broadcast; NDP uses multicast. SLAAC uses router advertisements and address configuration; DHCPv6 is a separate mechanism.

Reference check:

Model boundary:

Independent task and submission evidence

2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.

Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.

TrialChanged settingFixed settingsPredicted resultActual observation / unitsEvidence / uncertainty
A: baselineReferenceRecordPredictRecordRecord
B: one changeRecordSame as APredictRecordRecord
A: repeatRestoreSame as APredictRecordRecord

Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.

Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

IPv6 has no broadcast. A /64 is usual for SLAAC, /127 is used on suitable point-to-point links and /128 identifies a single address. Anycast uses unicast-format addresses and cannot be identified from text. Prefix membership does not prove reachability. Documentation addresses are not public deployment targets.

Worked engineering reasoning and boundary conditions

IPv6 addresses have eight 16-bit hextets. Prefix length specifies leading bits; :: compresses one consecutive zero run. A /48 split into /64 gives 2^16 subnets. No IPv6 broadcast. Example 2001:db8:abcd:1::/64 belongs to 2001:db8:abcd::/48.

Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.

Mathematical representation and interpretation

IPv6 prefix allocation

p is parent prefix length and q child length. Prefix capacity is an address count, not a subtraction for IPv4-style network and broadcast reservations.

\[N_{\mathrm{children}}=2^{q-p},\qquad N_{\mathrm{addresses/child}}=2^{128-q},\qquad 0\le p\le q\le128\]

A /56 parent contains 256 /64 child prefixes.

Concept animation · operation pathway

Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.

IPv6 Addressing & Subnetting: operation pathwayParent2001:db8:abcd::/48Child prefix/64Subnet bits64−48=16Children65,536; child 1 →abcd:1::/64Read the active operation, then inspect the accumulated state.

Step 1 of 4 · Parent

Parent

Parent
2001:db8:abcd::/48

Teaching example only; inspect live calculations or real practical evidence separately.

Recall the concept before revealing its explanation.

0 / 3 revealed
N14 · 01 / 08Why is :: allowed only once?Reveal explanation
Engineering explanation

Multiple omissions would make the number of missing hextets ambiguous.

N14 · 02 / 08What is a /48 to /64 allocation?Reveal explanation
Engineering explanation

16 subnet bits, 2^16 = 65,536 child prefixes.

N14 · 03 / 08Is anycast a distinct address syntax?Reveal explanation
Engineering explanation

No. It uses unicast-format addresses assigned to multiple interfaces; routing determines delivery.

N14 · 04 / 08How many /64 children fit into an IPv6 /48?Reveal explanation
Engineering reasoning

2^(64−48) = 65,536. Valid indices run from 0 through 65,535.

N14 · 05 / 08Why does matching a prefix not prove reachability?Reveal explanation
Engineering reasoning

Membership is an address calculation; routes, link state, policy and neighbor discovery affect actual communication.

N14 · 06 / 08An IPv6 parent prefix is subdivided. Select every technically valid statement. A. Extending /48 to /64 adds 16 network bits. B. IPv6 has no broadcast address. C. A /64 has 64 available addresses. D. Compressing zeros changes the underlying 128-bit address.Reveal explanation
Applied scenario

Correct: A. Extending /48 to /64 adds 16 network bits.; B. IPv6 has no broadcast address.

N14 · 07 / 08In IPv6 Addressing & Subnetting, which reference and changed settings are prescribed for Peer IPv6 address?Reveal explanation
Controlled configuration

Peer IPv6 address: 2001:db8:1234:8::1 → 2001:db8:1235::1; hold the remaining settings fixed.

N14 · 08 / 08What expected result distinguishes the reference and changed trials in IPv6 Addressing & Subnetting?Reveal explanation
Expected observation

Canonical 2001:db8:1234:7::42; network 2001:db8:1234::/48; 65,536 /64 subnets; index 7 is 2001:db8:1234:7::/64. The changed peer is outside the prefix.

Interactive networking and security instrument

Loading experiment-specific apparatus…
Previous model / additional reference tools
Simulation task

Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

Explore the model using its own controls. Record a prediction before changing a condition. Compare the reference with a changed condition, then use the Experiment tab for the procedure, acceptance criteria and notebook. Model outputs and physical observations must remain separate.

Interactive engineering workbenchN14 · Existing model
Interactive workbench

Predict, configure and observe

Model-linked protocol trace

Animated IPv6 Addressing & Subnetting

Change the controls above; the trace and numerical summary update from the computed model results. Animation timing is for learning, not measured protocol latency.

Recent trace events

    N14 · Model-linked instrumentation

    Visual observation lens

    Back to controls ↑

    Readout from the original computational model; not physical measurements.

    Loading instrument…

    Awaiting model display.

    Experimental instrumentation · A/B

    Compare two model conditions

    Capture a baseline, change one experimental condition, run the model if required and capture the comparison. Snapshots contain visible controls and display text, not physical sensor readings. Review before exporting.

    Open simulation view
    Baseline A
    Not captured
    Comparison B
    Not captured

    Capture a baseline to begin.

    Evidence portfolio →
    V19.0 · Contextual AI workspace

    Ask your engineering assistants

    N14 · current context

    Ask Dr. Mohammad locally, or prepare an experiment-aware prompt for ChatGPT, Gemini or Claude. The external providers open in their own tabs; nothing is automatically submitted.

    Dr. Mohammad · offline
    Dr. Mohammad

    Offline curriculum-grounded assistance.

    Open local tutor
    IPv6 Addressing & Subnetting

    Public course objective, displayed commands, source excerpts and procedure. Private assessment content is not collected.

    Prepare a contextual AI prompt

    0 characters

    Common secret and email patterns are redacted on preparation; this is not a comprehensive privacy filter. Review the entire editable prompt, including student work and unpublished research, before sharing. The providers apply their own accounts, privacy settings and limits.

    Prepare → review → copy & open your selected provider → paste and submit there.

    Required analytical activity · IPv6 notation

    Complete the following on paper or in your laboratory report before revealing the simulator result. Use the binary conversion table in Concepts.

    1. Convert the eight binary hextets in the worked table to hexadecimal independently. Show the weighted nibble calculation for 1101 and 1011; remove leading zeros and compress the longest run.

    2. Write the canonical form of 2001:0db8:0000:0000:0010:0000:0000:0000. Explain why replacing 0010 with 1 is invalid.

    3. Compress 2001:0db8:0000:0000:0001:0000:0000:0001 and 2001:0db8:0001:0000:0002:0003:0004:0010. Explain the equal-run and single-zero rules.

    4. Expand fe80::a00:0:10 to eight hextets and then 128 binary bits. Check which zeros in a00 and 10 are significant.

    5. Enter your own 128-bit sequence in the simulator, convert each nibble, identify the zero runs, predict the canonical form, then round-trip it back to binary. Record the exact original and reconstructed values.

    Experimental verification

    1. Open Simulation and find the binary → hexadecimal → canonical notation workstation. Choose Course address and press Restart.
    2. Step through each stage. Select individual nibbles to inspect the weighted binary calculation, and compare the result with your written derivation.
    3. Choose Trailing digit trap, Equal zero runs and One zero hextet. Check the highlighted omitted leading zeros, retained significant trailing zeros and chosen whole-hextet run.
    4. Choose an address or paste exactly 128 bits. Toggle one bit, predict which hextet changes, and replay the stages. Enter your own canonical text in the independent checker. Try a valid noncanonical form and a changed address; document the different verdicts.
    5. Use Complete view to verify round-trip equality of all 128 bits. Record expanded, leading-zero-stripped and canonical forms with the chosen run; do not confuse compression with prefix allocation. Continue with the existing subnetting and classification investigations.

    Independent theoretical exercises

    Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.

    01 · Predict and derive using the given inputs

    Compress 2001:0db8:1234:0007:0000:0000:0000:0042; derive /48 network and /64 child index 7. Count /64 children and addresses per child.

    02 · Compare or justify using evidence

    Compare peer 2001:db8:1234:8::1 under /48 and /64; calculate child index 65535 and explain why 65536 is invalid. Classify ::1, fe80::1 and ff02::1.

    03 · Subnet exercise

    Subnet exercise · Independent work

    Given 2001:db8:55:ab00::/56 find /64 child index 0x2A, number of children and addresses per child.

    Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.

    Expanded independent theoretical exercise bank

    Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.

    Foundational · Apply the principle

    Independent theoretical exercise · N14-01

    Expand 2001:db8:abcd::9 to eight hextets.

    Intermediate · Calculate or trace

    Independent theoretical exercise · N14-02

    How many /64 children in a /56?

    Intermediate · Interpret the result

    Independent theoretical exercise · N14-03

    For 2001:db8:abcd:1200::/56, give /64 child at index 0x2A.

    Advanced · Analyze a condition

    Independent theoretical exercise · N14-04

    Do 2001:db8:abcd:12ff::1 and 2001:db8:abcd:1300::1 share 2001:db8:abcd:1200::/56?

    Advanced · Diagnose or compare

    Independent theoretical exercise · N14-05

    Why cannot IPv6 address use :: twice?

    Challenging · Engineering verification

    Independent theoretical exercise · N14-06

    Design prefix validation tests for /56 allocation.

    Challenging numerical variant 1

    Calculation · Independent work

    A /52 allocation is split into /64 subnets. Reserve 1 /64s for infrastructure, then allocate 8 /64s per site. How many complete sites can be supported?

    Challenging numerical variant 2

    Calculation · Independent work

    A /48 allocation is split into /64 subnets. Reserve 3 /64s for infrastructure, then allocate 8 /64s per site. How many complete sites can be supported?

    Challenging numerical variant 3

    Calculation · Independent work

    A /56 allocation is split into /64 subnets. Reserve 2 /64s for infrastructure, then allocate 8 /64s per site. How many complete sites can be supported?

    Step-by-step experimental procedure

    Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks.

    1 · Reference workbench configuration

    Use the named reference workbench and its reference inputs. Additional live instruments may have different controls; use the matching instrument. Record virtual and practical results separately.

    IPv6 address2001:0db8:1234:0007:0000:0000:0000:0042
    Parent prefix length (0–128)48
    Peer IPv6 address2001:db8:1234:8::1
    Child prefix length (0–128)64
    Child subnet index (decimal)7

    2 · Perform the investigation in order

    1. Enter the baseline address exactly as shown. Observe the eight 16-bit hextets, leading-zero removal, and longest zero-run compression (leftmost on a tie, no compression of a single zero hextet). The bit panel separates parent prefix, child-subnet extension and remaining bits.
    2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7.
    3. Set parent /64, child /64, index 0. Change peer to 2001:db8:1234:7::99, then 2001:db8:1234:8::1. Expected: same prefix, then different prefix.
    4. Inspect ::, ::1, fe80::1, fd00::1, ff02::1, ::ffff:192.0.2.1. To avoid unrelated allocation errors, use parent /64, child /64 and index 0. Expected: unspecified, loopback, link-local, unique-local, multicast and IPv4-mapped respectively. No broadcast; NDP uses multicast. SLAAC uses router advertisements and address configuration; DHCPv6 is a separate mechanism.
    5. For /127 and /128 set both prefix fields equal and index 0. Expected address counts 2 and 1; do not subtract two as for conventional IPv4 subnets. Try malformed 2001::db8::1: expected validation error and disabled export.
    6. Inside Ubuntu WSL, from the extracted website root, run python3 verification/advanced_dapp.py ipv6. Expected: 11 passing reference checks and "passed": true. No packages or interface modifications required. Optionally run ip -6 address show and ip -6 route show to observe your own system; absence of a global address is possible.

    3 · Compare controlled trials

    TrialIndependent changeExpected checkObservation
    ReferenceUse reference inputs aboveCanonical 2001:db8:1234:7::42; network 2001:db8:1234::/48; 65,536 /64 subnets; index 7 is 2001:db8:1234:7::/64. The changed peer is outside the prefix.Record actual result
    Controlled changePeer IPv6 address = 2001:db8:1235::1Canonical 2001:db8:1234:7::42; network 2001:db8:1234::/48; 65,536 /64 subnets; index 7 is 2001:db8:1234:7::/64. The changed peer is outside the prefix.Record actual result

    4 · Analyze and report

    IPv6 has no broadcast. A /64 is usual for SLAAC, /127 is used on suitable point-to-point links and /128 identifies a single address. Anycast uses unicast-format addresses and cannot be identified from text. Prefix membership does not prove reachability. Documentation addresses are not public deployment targets.

    Required evidence: Record the ipv6 addressing & subnetting comparison and justify the changed outcome from the calculated trace.

    Model boundary: IPv6 has no broadcast. A /64 is usual for SLAAC, /127 is used on suitable point-to-point links and /128 identifies a single address. Anycast uses unicast-format addresses and cannot be identified from text. Prefix membership does not prove reachability. Documentation addresses are not public deployment targets.

    Controlled investigation · reproducible evidence

    Method. Use the existing reference workbench configuration and the named controlled changes below. A controlled variable stays fixed while the independent variable is intentionally changed; the dependent variable is the resulting observed output. First predict each trial from the Concepts page. Run the baseline, then change only the specified setting and record the outcome. For deterministic traces one execution per case and a repeated verification are sufficient; for timing or stochastic measurements repeat at least five times, recording each run, median and range. Reset to the reference state between independent comparisons.

    TrialIndependent changeDependent observation
    ReferenceUse reference inputs aboveRecord actual outcome and units
    Controlled changePeer IPv6 address = 2001:db8:1235::1Record actual outcome and units

    Evidence: attach the completed comparison table, one trace or screenshot per condition, and actual practical terminal/hardware evidence where applicable. Explain any prediction mismatch and distinguish modeled behavior from measured results.

    Loading laboratory-specific procedure…

    Python / Google Colab notebook

    Original independent networking reference; loopback traffic only where applicable. Validated locally in a fresh Jupyter kernel. Download, then upload to Google Colab.

    Download NotebookOpen Google ColabAll Python notebooks

    Complete practical procedure & acceptance

    ✓ Expected baseline and controlled change: Canonical 2001:db8:1234:7::42; network 2001:db8:1234::/48; 65,536 /64 subnets; index 7 is 2001:db8:1234:7::/64. The changed peer is outside the prefix.

    1. Enter the baseline address exactly as shown. Observe the eight 16-bit hextets, leading-zero removal, and longest zero-run compression (leftmost on a tie, no compression of a single zero hextet). The bit panel separates parent prefix, child-subnet extension and remaining bits.
    2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7.
    3. Set parent /64, child /64, index 0. Change peer to 2001:db8:1234:7::99, then 2001:db8:1234:8::1. Expected: same prefix, then different prefix.
    4. Inspect ::, ::1, fe80::1, fd00::1, ff02::1, ::ffff:192.0.2.1. To avoid unrelated allocation errors, use parent /64, child /64 and index 0. Expected: unspecified, loopback, link-local, unique-local, multicast and IPv4-mapped respectively. No broadcast; NDP uses multicast. SLAAC uses router advertisements and address configuration; DHCPv6 is a separate mechanism.
    5. For /127 and /128 set both prefix fields equal and index 0. Expected address counts 2 and 1; do not subtract two as for conventional IPv4 subnets. Try malformed 2001::db8::1: expected validation error and disabled export.
    6. Inside Ubuntu WSL, from the extracted website root, run python3 verification/advanced_dapp.py ipv6. Expected: 11 passing reference checks and "passed": true. No packages or interface modifications required. Optionally run ip -6 address show and ip -6 route show to observe your own system; absence of a global address is possible.
    7. Export observed evidence, restore baseline and record limitations. Do not treat browser-model output as actual hardware or EVM evidence.

    Experimental notebook

    Record your own results. Values are not prefilled or independently verified.

    Record & discuss

    Notebook exports use related core lab P38; the supplementary ID is retained in the evidence. Technical reference.

    Learning progress

    Mark complete only after documenting your observations. This is not a verified result or official grade.

    View prerequisites and related learning

    Python / Google Colab laboratory

    N14 · 10 notebook cells · 3 executable Python cells

    Complete the theoretical investigation first. Run the cells in order, record actual outputs and compare against your prediction.

    How to execute

    1. Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
    2. Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
    3. Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.

    Execution scope: Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.

    01Instructions · Markdown
    # n14 · IPv6 Addressing & Subnetting **PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh** ## Introduction Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks. ## How to run 1. Download this notebook from the laboratory page. Open Google Colab → File → Upload notebook. 2. Select a Python CPU runtime. Run cells from top to bottom using Shift+Enter, or Runtime → Run all. 3. Read the printed observations and assertions. Change one parameter at a time and rerun the relevant cell. 4. Save your own outputs and compare them to the portal Experiment tab. **Execution boundary:** Original independent networking reference; loopback traffic only where applicable. Do not run the hardware or service commands in Colab. No real credentials are needed. The notebook is self-contained.
    02Instructions · Markdown
    ## Experiment-specific preparation Convert 128-bit addresses between expanded and canonical forms, classify address ranges, calculate prefix membership and allocate child networks. **Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):** 1. Enter the baseline address exactly as shown. Observe the eight 16-bit hextets, leading-zero removal, and longest zero-run compression (leftmost on a tie, no compression of a single zero hextet). The bit panel separates parent prefix, child-subnet extension and remaining bits. 2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7. 3. Set parent /64, child /64, index 0. Change peer to 2001:db8:1234:7::99, then 2001:db8:1234:8::1. Expected: same prefix, then different prefix. 4. Inspect ::, ::1, fe80::1, fd00::1, ff02::1, ::ffff:192.0.2.1. To avoid unrelated allocation errors, use parent /64, child /64 and index 0. Expected: unspecified, loopback, link-local, unique-local, multicast and IPv4-mapped respectively. No broadcast; NDP uses multicast. SLAAC uses router advertisements and address configuration; DHCPv6 is a separate mechanism. 5. For /127 and /128 set both prefix fields equal and index 0. Expected address counts 2 and 1; do not subtract two as for conventional IPv4 subnets. Try malformed 2001::db8::1: expected validation error and disabled export. **Evidence:** **Boundary:**
    03Instructions · Markdown
    ## 1. Objectives and reference condition - Reproduce the specific computational mechanism in this laboratory. - Inspect the output, compare the reference condition with a changed or rejected condition where implemented, and explain any discrepancy. - Distinguish actual local Python execution from mock, physical and external-service observations. ## 2. Environment check
    04Python · executable cell
    PYTHON · Code cell
    # =====================================================================
    # N14 | Code cell 01 | IPv6 Addressing & Subnetting
    # Purpose: 1. Objectives and reference condition - Reproduce the specific computational mechanism in this laboratory. - Inspect the output, compare the reference condition with a changed or rejected condition where implem
    # Inputs: the explicit fixture/settings below and any preceding cell state.
    # Output: inspect printed values, returned records or assertions; record evidence.
    # =====================================================================
    import sys
    print("Python",sys.version.split()[0])
    # Check the expected invariant so a mismatch fails visibly instead of appearing successful.
    assert sys.version_info >= (3,10)
    
    Ask Dr. Mohammad about this cell
    05Instructions · Markdown
    ## 3. Implementation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
    06Python · executable cell
    PYTHON · Code cell
    # =====================================================================
    # N14 | Code cell 02 | IPv6 Addressing & Subnetting
    # Purpose: 3. Implementation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
    # Inputs: the explicit fixture/settings below and any preceding cell state.
    # Output: inspect printed values, returned records or assertions; record evidence.
    # =====================================================================
    #!/usr/bin/env python3
    """Bounded, dependency-free local protocol exercises. No external hosts or raw sockets."""
    import argparse, ipaddress, json, socket, struct, threading, urllib.request
    from http.server import BaseHTTPRequestHandler, HTTPServer
    
    # Define the reusable operation check; keep its logic separate from the trial.
    def check(ok, label, evidence):
        if not ok: raise AssertionError(label)
        return dict(check=label,passed=True,evidence=evidence)
    
    # Define the reusable operation exchange; keep its logic separate from the trial.
    def exchange(request, responder, family=socket.AF_INET):
        host='::1' if family==socket.AF_INET6 else '127.0.0.1'
        with socket.socket(family,socket.SOCK_DGRAM) as server, socket.socket(family,socket.SOCK_DGRAM) as client:
            server.bind((host,0)); client.settimeout(1); server.settimeout(1)
            client.sendto(request,server.getsockname())
            data,peer=server.recvfrom(4096); response=responder(data)
            if response is None: return None
            server.sendto(response,peer); received,origin=client.recvfrom(4096)
            assert origin[:2]==server.getsockname()[:2]
            return received
    
    # Define the reusable operation checksum; keep its logic separate from the trial.
    def checksum(data):
        if len(data)%2:data+=b'\0'
        total=sum(struct.unpack('!'+str(len(data)//2)+'H',data))
        while total>>16:total=(total&0xffff)+(total>>16)
        return (~total)&0xffff
    
    # Define the reusable operation packet; keep its logic separate from the trial.
    def packet():
        h=bytearray.fromhex('4500003c0001400040110000c0000201c0000202')
        struct.pack_into('!H',h,10,checksum(h)); bad=bytearray(h);bad[8]^=1
        return [check(checksum(h)==0,'Valid IPv4 header',h.hex()),check(checksum(bad)!=0,'Modified TTL invalidates checksum',bad.hex())]
    
    # Define the reusable operation subnet; keep its logic separate from the trial.
    def subnet():
        n=ipaddress.ip_network('192.0.2.73/26',strict=False)
        return [check(str(n.network_address)=='192.0.2.64' and str(n.broadcast_address)=='192.0.2.127' and len(list(n.hosts()))==62,'CIDR /26',str(n)),check(len(list(ipaddress.ip_network('192.0.2.72/31').hosts()))==2,'Point-to-point /31','2 addresses')]
    
    # Define the reusable operation dns; keep its logic separate from the trial.
    def dns():
        def query(name):return bytes.fromhex('123401000001000000000000')+b''.join(bytes([len(x)])+x.encode() for x in name.split('.'))+b'\0\0\1\0\1'
        def respond(q):
            found=q==query('sensor.example');return q[:2]+struct.pack('!5H',0x8500 if found else 0x8503,1,int(found),0,0)+q[12:]+(bytes.fromhex('c00c000100010000003c0004c000020a') if found else b'')
        q=query('sensor.example');r=exchange(q,respond); n=exchange(query('unknown.example'),respond)
        out=[check(r[:2]==q[:2] and r[3]&15==0 and r[6:8]==b'\0\1' and r[-4:]==bytes([192,0,2,10]),'DNS-format UDP positive response',r.hex()),check(n[3]&15==3 and n[6:8]==b'\0\0','DNS-format NXDOMAIN',n.hex())]
        class Handler(BaseHTTPRequestHandler):
            def do_GET(self):
                body=b'{"temperature":25}' if self.path=='/temp' else b'Not found'; self.send_response(200 if self.path=='/temp' else 404);self.send_header('Content-Length',str(len(body)));self.end_headers();self.wfile.write(body)
            def log_message(self,*a):pass
        with HTTPServer(('127.0.0.1',0),Handler) as s:
            thread=threading.Thread(target=s.serve_forever,daemon=True);thread.start()
            try:
                opener=urllib.request.build_opener(urllib.request.ProxyHandler({}));url='http://127.0.0.1:'+str(s.server_port)
                with opener.open(url+'/temp',timeout=2) as res:out.append(check(res.status==200 and json.load(res)=={'temperature':25},'Actual HTTP GET','200 and JSON body'))
                try:opener.open(url+'/missing',timeout=2)
                except urllib.error.HTTPError as e:out.append(check(e.code==404,'Actual HTTP missing resource','404'))
                else:raise AssertionError('Expected HTTP 404')
            finally:s.shutdown();thread.join(timeout=2)
        return out
    
    # Define the reusable operation coap; keep its logic separate from the trial.
    def coap():
        con=bytes.fromhex('41011234abb474656d70');non=bytes.fromhex('51011234abb474656d70')
        def respond(q):
            if q==con:return bytes.fromhex('61451234abff3235')
            if q==non:return bytes.fromhex('51455678abff3235')
            raise AssertionError('unexpected fixture request')
        r=exchange(con,respond);n=exchange(non,respond)
        return [check(r==bytes.fromhex('61451234abff3235'),'Actual CoAP-format CON UDP exchange',r.hex()),check(n==bytes.fromhex('51455678abff3235'),'Actual CoAP-format NON UDP exchange',n.hex()),check(exchange(con,lambda _:None) is None,'Controlled dropped request; no response generated','fixture drop (not a measured timeout)'),check(exchange(con,respond)==r,'Repeated CON fixture recovery',r.hex())]
    
    # Define the reusable operation ipv6; keep its logic separate from the trial.
    def ipv6():
        return [check(ipaddress.ip_address('2001:db8::1').compressed=='2001:db8::1','IPv6 address parsing','2001:db8::1'),check(exchange(b'IPv6',lambda q:q,socket.AF_INET6)==b'IPv6','Actual IPv6 UDP loopback','::1')]
    
    Ask Dr. Mohammad about this cell
    07Instructions · Markdown
    ### Step 2 · Run the reference calculation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
    08Python · executable cell
    PYTHON · Code cell
    # =====================================================================
    # N14 | Code cell 03 | IPv6 Addressing & Subnetting
    # Purpose: Step 2 · Run the reference calculation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
    # Inputs: the explicit fixture/settings below and any preceding cell state.
    # Output: inspect printed values, returned records or assertions; record evidence.
    # =====================================================================
    # Set checks for the next computation or reference condition.
    checks=ipv6()
    print(json.dumps(checks,indent=2))
    # Check the expected invariant so a mismatch fails visibly instead of appearing successful.
    assert checks and all(x["passed"] for x in checks)
    
    Ask Dr. Mohammad about this cell
    09Instructions · Markdown
    ## 4. Results and analysis Record the actual output and whether the assertions pass. Identify a parameter to vary, state your prediction, repeat the reference calculation, then explain the changed result. | Trial | Configuration | Observation | Interpretation | |---|---|---|---| | A | Reference | | | | B | One controlled change | | | | C | Reference repeat | | | **Limitations:** Original independent networking reference; loopback traffic only where applicable. Notebook success does not certify external equipment or services.
    10Instructions · Markdown
    ## Guided reasoning and evidence A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above. **Independent task:** 2. Keep /48 and child /64; test index 0, 7, 65535 and 65536. Expected: first three accepted, 65536 rejected. Restore index 7. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat. | Trial | Input/configuration | Prediction | Observation | Evidence / limitation | |---|---|---|---|---| | A | Reference | | | | | B | Changed input | | | | | A repeat | Reference | | | | A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.
    Shared research workbenches · network designer & advanced studies
    Concurrent-device simulation & Monte Carlo research
    Distributed digital twin · topology, protocol & battery research