Tag: Openwrt

DHCP Option 224でPXE boot後のrole情報を渡す

DHCP Option 224でPXE boot後のrole情報を渡す

目的

PXE boot では、firmware、initramfs、rootfs 上の network manager がそれぞれ DHCP を使うことがある。

このうち、OS 起動後の automation に必要な metadata を DHCP Option 224 で渡すと、同じ rootfs から起動する client でも role や stage を切り替えやすい。

ここでは Option 224 を overlay_id / role / roles / stage のような runtime config 伝播に使う設計をまとめる。

使い方

Option 224 の値は、単純な key-value 文字列にする。

overlay_id=pi-node-1,role=base,roles=base,worker,stage=staging

client 側では DHCP hook がこの値を受け取り、runtime env file を作る。

/run/dhcp/role.env

systemd unit や wrapper はこの env file を読み、対象 role でなければ skip する。

Read more...

Raspberry Pi netbootのTFTP host directory設計

Raspberry Pi netbootのTFTP host directory設計

Raspberry Pi の network boot は、一般的な PXE の pxelinux.cfg とは違う挙動をする。

特に Pi firmware は、TFTP root 直下だけでなく board 固有の directory を探す。bootfile でサブディレクトリを指定しても、cmdline.txt が期待した場所から読まれないことがある。

このため、Pi ごとの board hash directory を TFTP root 直下に実ディレクトリとして作り、host ごとに cmdline.txt を制御する設計が扱いやすい。

本文中の 192.0.2.0/24 は説明用の documentation range である。homecluster-infra で OpenWrt 実機へ反映する場合は、router hostvars の openwrt_lan_ipaddropenwrt_dhcp_ntp_serversopenwrt_gentoo_server_host を外部 inventory で明示し、TFTP / NFS / dnsmasq の endpoint に documentation range を残さない。

目的

  • boot firmware / kernel / DTB / initramfs は release 単位で共有する
  • host ごとの config.txt / cmdline.txt は board hash directory に置く
  • NFS root の release 切替は cmdline.txt で行う
  • TFTP release の更新と host boot 先の切替を分ける

directory構成

例として、TFTP root を次のように分ける。

Read more...