AI generated

Third-party XGS-PON ONT on B4RN — working reference

Status: confirmed working and persistent across reboot. Verified on: WAS-110 class stick (prx126-sfp-pon), 8311 firmware v2.8.3 basic, masquerading a Nokia XS-2426G-B, MikroTik hEX S behind it, B4RN Nokia OLT.

🔧 = value you must read off your own hardware or line. Do not copy mine.


1. The one thing that will catch you out

B4RN’s Nokia OLT pushes Encryption Key Ring = 0 (ME 268, attribute 10) onto every data GEM, but then encrypts downstream anyway. XGS-PON encrypts downstream only, so the result is a link that looks perfect and works in one direction:

Clean O5 · populated VLAN table · DHCP DISCOVERs leaving · nothing ever coming back

Fix is to force key ring 3 (unicast, downstream only) on each data GEM. A genuine Nokia ONT does this internally, which is why the original hardware just worked.

It resets on every reboot and on every re-range, because it’s a live OMCI write, not stored config. Section 5 makes it stick.


2. Values you need from your own kit 🔧

Read these off the label of the ONT you’re replacing and from your line:

fwenv Mine (XS-2426G-B) Where yours comes from
8311_gpon_sn ALCLFDF81E4E 🔧 ONT label — this is your line’s identity
8311_equipment_id XS-2426G-B 🔧 ONT model, exactly as printed
8311_hw_ver 3FE49546CAAA 🔧 ONT label / original ONT’s GUI
8311_sw_verA 3FE49544IJLJ03 🔧 original ONT’s running firmware
8311_iphost_mac 0C:82:47:58:F4:10 🔧 “IP Host MAC” on the ONT label
8311_reg_id_hex (redacted) 🔧 Registration ID; last 12 chars are the PLOAM password
Data GEM IDs 1051, 1052, 1053 🔧 assigned by the OLT — see §4

The A-variant guides use different strings (3FE49348BAAA / 3FE49385IJKL09) — those are for the XS-2426G-A. Check which revision you actually have.

Not per-line — copy these as-is

fwenv Value Note
8311_mib_file /etc/mibs/prx300_1V_bell.ini leave alone; see §7
8311_fw_match_b64 decodes to (3FE[0-9A-Z]{11})$ Nokia version pattern
8311_cp_hw_ver_sync 1
8311_override_active / _commit A / A
8311_pon_slot 10
8311_internet_vlan 400 B4RN internet service
8311_fix_vlans 2 (hook-script-only)
8311_pingd 0

3. Confirming you have a real O5

omci_pipe.sh meadg 131 0 1

41 4C 43 4C = ALCL, a genuine Nokia OLT. Spaces (20 20 20 20) mean a fake O5 and nothing downstream of it is meaningful.

pontop -b -g s | head -40      # want: O5.1, Associated; FEC on both directions
pontop -b -g w                 # active alarms - must be empty

If you ever see O7, unplug the fibre immediately — that’s a rogue ONT taking down the whole split.


4. Identify your GEM ports 🔧

ip -o -d link list | grep -o 'gem[0-9-]*.*'

On my line:

Interface dir mc T-CONT Action
gem-omci 3 0 tcont-omci Leave alone — management channel
gem2046 2 (dsonly) 0 — Leave alone — downstream-only broadcast
gem1051 🔧 3 0 tcont32768 Set key ring 3
gem1052 🔧 3 0 tcont32768 Set key ring 3
gem1053 🔧 3 0 tcont32769 Set key ring 3

Rules for deciding, so you can work out your own:

  • Numeric gemNNNN with dir: 3 and mc: 0 → data GEM, needs key ring 3.
  • dir: 2 / dsonly → downstream-only, skip.
  • gem-omci → skip.
  • mc: 1 → multicast; correct value is 2, not 3. (None on B4RN currently.)

Note 1051/1052 share one T-CONT and 1053 has its own — three services, two upstream scheduling containers.


5. The fix, made permanent

5a. Apply it now

for g in 1051 1052 1053; do omci_pipe.sh meads 268 "$g" 10 3; done   # 🔧 your GEM IDs

Effect is immediate, no reboot. Verify at both layers:

for g in 1051 1052 1053; do
    printf 'gem%s driver: ' "$g"; ip -o -d link list dev "gem$g" | grep -o 'enc: [0-9]'
    printf 'gem%s omci:   ' "$g"; omci_pipe.sh meadg 268 "$g" 10 | awk -F'attr_data=' '{print $2}'
done

Want enc: 3 and 03.

5b. Make it survive reboots

Config lives in U-Boot environment variables, and bootcmd wipes the overlay on every boot (ubi remove rootfs_data) — so fwenv is the only viable storage. A one-shot hook is not enough: hooks run before OMCI provisioning has created the GEM interfaces. Fork a watchdog instead.

#!/bin/sh
# 8311 hook - XGEM key ring workaround for B4RN (Nokia/ALCL OLT).
# OLT pushes Encryption Key Ring 0 on ME 268 for every data GEM on each
# MIB upload, so downstream frames are discarded. Force 3.

LOCK=/tmp/8311-gemkeys.pid
LOG=/tmp/8311-gemkeys.log
INTERVAL=20

if [ -f "$LOCK" ] && kill -0 "$(cat "$LOCK" 2>/dev/null)" 2>/dev/null; then exit 0; fi

log() {
    if [ -f "$LOG" ] && [ "$(wc -c < "$LOG")" -gt 65536 ]; then : > "$LOG"; fi
    echo "$(date '+%F %T') $*" >> "$LOG"
}

watchdog() {
    OMCI=$(command -v omci_pipe.sh || echo /usr/bin/omci_pipe.sh)
    log "=== watchdog started ==="
    while : ; do
        for path in /sys/class/net/gem[0-9]*; do
            [ -e "$path" ] || continue
            dev=${path##*/}                       # glob excludes gem-omci
            detail=$(ip -o -d link list dev "$dev" 2>/dev/null) || continue
            case "$detail" in
                *dsonly*)   continue ;;           # downstream-only GEM
                *"mc: 1"*)  continue ;;           # multicast wants 2, not 3
                *"enc: 3"*) continue ;;           # already correct - no OMCI traffic
            esac
            log "$dev: $(echo "$detail" | grep -o 'enc: [0-9]' | head -n1) -> setting 3"
            "$OMCI" meads 268 "${dev#gem}" 10 3 >/dev/null 2>&1
            sleep 1
            log "$dev: now $(ip -o -d link list dev "$dev" | grep -o 'enc: [0-9]' | head -n1)"
        done
        sleep "$INTERVAL"
    done
}

watchdog &
echo $! > "$LOCK"
exit 0

Paste into the firmware builder’s hook script editor (present on recent builds), or store it directly:

fw_printenv | grep -i 8311_ | grep -i hook     # 🔧 find the variable name on your build
fw_setenv <hook_var> "$(cat /tmp/gemkeys.sh)"
fw_printenv <hook_var>                          # confirm it stored intact

Why it’s built this way: no dependence on 8311-detect-config.sh (it only writes a config file when passed -c <path>, so sourcing /tmp/8311-config.sh silently yields empty variables); zero OMCI traffic when nothing needs fixing; log size-capped because /tmp is RAM; $! not $$ because ash reports the parent shell.

5c. Test before trusting it

sh /tmp/gemkeys.sh                          # should log only "watchdog started"
omci_pipe.sh meads 268 1053 10 0            # deliberately break one  🔧
sleep 25
grep gem1053 /tmp/8311-gemkeys.log          # want "enc: 0 -> setting 3"
kill "$(cat /tmp/8311-gemkeys.pid)"; rm -f /tmp/8311-gemkeys.pid

Then reboot and check /tmp/8311-gemkeys.log exists with three “setting 3” lines. Verified working on my unit — all three GEMs corrected ~43 s after provisioning.

5d. Flash both banks

The OLT can select the active image, upgrade the inactive one and reboot the ONT unprompted. Flash your working build to A and B, and set the fwenvs for both slots — otherwise a slot switch strands you on hook-less firmware weeks later, apparently at random.


6. Router side (MikroTik)

B4RN services: VLAN 400 (internet), 600, 901 (p-bit 3). The ONT’s own VLAN table discards untagged upstream — your router must tag.

/system backup save name=pre-vlan400

/interface vlan add name=wan400 vlan-id=400 interface=ether1 comment=&quot;B4RN internet&quot;
/ip dhcp-client set [find where interface=ether1] interface=wan400
/interface list member add list=WAN interface=wan400 comment=&quot;temp-vlan400&quot;
  • Move the existing DHCP client, don’t add a new one — preserves client-id/hostname.
  • WAN list membership is essential, or masquerade won’t fire. If your NAT rule names ether1 explicitly, update out-interface.
  • VLAN interfaces inherit the parent MAC, so DHCP identity is unchanged.
  • Work in Safe Mode (Ctrl-X).
  • hEX S has a 1G cage; the SFP+ stick negotiates down. May need /interface ethernet set sfp1 sfp-ignore-rx-los=yes on RouterOS 7.15+.

Verify: /ip dhcp-client print detail → status: bound, then /ping 1.1.1.1.


7. Diagnostic order

# Check Command
1 Real O5 omci_pipe.sh meadg 131 0 1 → expect ALCL
2 Alarms pontop -b -g w → empty
3 VLAN table populated 8311-extvlan-decode.sh -t
4 Upstream leaving pontop -b -g 'GEM/XGEM Port Counters'
5 Key errors same screen — rising = this bug
6 Optics /interface ethernet monitor sfp1 — Rx −29 to −8 dBm

From the router:

Observation Conclusion
Outbound only, no replies, on every VLAN tried Key ring
Outbound only on one VLAN, another works Wrong VLAN for that service
Packets on ether1 but not wan400 Downstream tag mismatch
Replies visible, no lease Router-side firewall / DHCP client

Testing two VLANs at once (use add-default-route=no so they can’t fight) is the fastest way to separate a per-service fault from a common-mode one.

Key errors are cumulative and can’t be zeroed without a reboot — a non-zero count after applying the fix is just history. Watch the delta, not the number.


8. Dead ends — don’t repeat these

  • Swapping the MIB file. A populated VLAN table already proves the OLT accepted your MIB. prx300_1U.ini is the PPTP/bridge-UNI MIB; this setup presents a VEIP, so switching would break the ACS session and risk a blank table.
  • Cloning your router’s WAN MAC. Only relevant when replacing an integrated ONT+gateway. With a bridged ONT and unchanged router, DHCP identity is untouched.
  • Hunting for the right VLAN ID. Two VLANs failing identically means a common-mode fault. Stop looking at VLANs.
  • 8311_persist_root=1. Debug/testing only, and requires editing bootcmd. The fwenv-stored hook achieves persistence without it.

9. Redact before publishing

Field Why
8311_reg_id_hex Last 12 characters are the PLOAM password
8311_root_pwhash Root password hash
8311_gpon_sn Your line’s identity — safe to share privately, strip publicly

Dump config with fw_printenv \| grep '^8311_' \| sort; decode any *_b64 variable with base64 -d. Note fw_printenv reads the active slot only.


10. ME quick reference

ME Class Note
11 PPTP Ethernet UNI exists = bridge MIB loaded
47 MAC Bridge Port Config Data
84 VLAN Tagging Filter Data
131 OLT-G attr 1 = OLT vendor ID (ALCL check)
134 IP Host Config Data ONT’s own management stack
171 Extended VLAN Tagging Op Config Data the VLAN table; assoc 10 = VEIP
268 GEM Port Network CTP attr 10 = Encryption Key Ring
329 Virtual Ethernet Interface Point conventionally instance 257

Key ring values: 0 = none · 1 = unicast both directions · 2 = broadcast · 3 = unicast downstream only ← correct for Nokia/ALCL


Appendix: what a GEM port is

A logical connection — a virtual pipe — between OLT and ONT inside the shared PON. GEM = GPON Encapsulation Method (XGEM on XGS-PON). Each frame carries a 16-bit Port-ID assigned by the OLT (range 1023 – 65534; 65535 is idle filler). Downstream, every ONT hears every frame and filters on Port-ID.

The 8-byte XGEM header includes a 2-bit Key index — which is why encryption state is per port. That’s the structural reason this bug is so misleading: OMCI runs on its own GEM with its own key state, so the OLT can push you a perfect VLAN table while every user-data GEM silently bins its downstream traffic. A healthy management channel proves nothing about your data GEMs — always check the key ring on each one.

Separately, a GEM port maps to a T-CONT (Alloc-ID), which is what actually gets granted upstream airtime. GEM = identity; T-CONT = bandwidth and scheduling.