Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ある日、突然ホスト名が “MacBookPro” になった話

Yoshimasa Niwa
October 30, 2024
150

ある日、突然ホスト名が “MacBookPro” になった話

ある日、突然ホスト名が “MacBookPro” になった話

Yoshimasa Niwa

October 30, 2024
Tweet

Transcript

  1. System Configuration Parameters macOS ͷઃఆ ComputerName Λ௨ৗઃఆ͢Δ LocalHostName ͸σϑΥϧτͰ ComputerName

    HostName ͸௨ৗ ”” (ۭനจࣈྻ) ɻDNS ͷٯҾ͖Ͱܾఆɻ hostname(1) ΍ gethostname(3) ͷ஋͸͜ͷ HostName
  2. DHCPREQUEST Option 12 DHCP Ͱϗετ໊Λࢦఆ͢Δ ࠓ࣌ͷ DHCP ͸ RFC 2131

    Dynamic Host Con fi guration Protocol Ͱنఆ͞ΕΔ ॴҦαʔόʔɾΫϥΠΞϯτϞσϧͰɺΫϥΠΞϯτͷཁٻ ʹαʔόʔ͕ IP ΞυϨε΍ DNS αʔόͷΞυϨεΛฦ౴͢ Δ
  3. -------- ------- | | +-------------------------->| |<-------------------+ | INIT- | |

    +-------------------->| INIT | | | REBOOT |DHCPNAK/ +---------->| |<---+ | | |Restart| | ------- | | -------- | DHCPNAK/ | | | | Discard offer | -/Send DHCPDISCOVER | -/Send DHCPREQUEST | | | | | | DHCPACK v | | ----------- | (not accept.)/ ----------- | | | | | Send DHCPDECLINE | | | | REBOOTING | | | | SELECTING |<----+ | | | | / | | |DHCPOFFER/ | ----------- | / ----------- | |Collect | | | / | | | replies | DHCPACK/ | / +----------------+ +-------+ | Record lease, set| | v Select offer/ | timers T1, T2 ------------ send DHCPREQUEST | | | +----->| | DHCPNAK, Lease expired/ | | | | REQUESTING | Halt network | DHCPOFFER/ | | | | Discard ------------ | | | | | | ----------- | | +--------+ DHCPACK/ | | | | Record lease, set -----| REBINDING | | | timers T1, T2 / | | | | | DHCPACK/ ----------- | | v Record lease, set ^ | +----------------> ------- /timers T1,T2 | | +----->| |<---+ | | | | BOUND |<---+ | | DHCPOFFER, DHCPACK, | | | T2 expires/ DHCPNAK/ DHCPNAK/Discard ------- | Broadcast Halt network | | | | DHCPREQUEST | +-------+ | DHCPACK/ | | T1 expires/ Record lease, set | | Send DHCPREQUEST timers T1, T2 | | to leasing server | | | | ---------- | | | | |------------+ | +->| RENEWING | | | |----------------------------+ ---------- Figure 5: State-transition diagram for DHCP clients https://datatracker.ietf.org/doc/html/rfc2131
  4. DHCPREQUEST Option 12 DHCP Ͱϗετ໊Λࢦఆ͢Δ ΫϥΠΞϯτ͸ DHCPREQUEST ΛૹΓɺαʔόʔ͸ DHCPACK Ͱ

    IPΞυϨεΛฦ͢ DHCPREQUEST ʹ͸Φϓγϣϯ͕͋ΓɺRFC 1533 Ͱنఆ͞ ΕΔ Host Name Option (Code = 12) Ͱϗετ໊ΛࢦఆͰ͖Δ
  5. ͍Ζ͍Ζ࿙ΕͯΔ Wi-Fi ͷϓϥΠόγʔ Wi-Fi ͸ΘΓͱઅૢͳͦ͘ͷ΁Μʹ͋ΔͷΛ࢖ͬͯ͠·͏ Wi-Fi Ͱ IPv4 ௨৴͕Ͱ͖Δͷ͸ DHCP

    ͕͋Δ͔Β Ϋϥ΢Ξϯτ͸ DHCP ʹ͍Ζ͍Ζ৘ใΛ౉ͯ͠͠·ͬͯΔ ϗετ໊͕ʮ୭ʑͷPCʯͩͱɺOption 12 ʹ୭ʑͷ෦෼͕ ೖ͍ͬͯͨΓͯ͠ɺIPΞυϨε͔Βݸਓ͕ಛఆͰ͖ΔՄೳੑ ΋͋Δ
  6. ͍Ζ͍Ζ࿙ΕͯΔ Wi-FiͷϓϥΠόγʔ ࣮͸ macOS 15 ͔Β DHCP ΫϥΠΞϯτͷ࣮૷͕มΘͬͯ ͍Δɻ σϑΥϧτͰ͸ɺWi-Fi

    ܦ༝ͷ DHCPREQUEST ͷϗετ໊͸ ৗʹσόΠεͷछྨʹͳΔɻྫ͑͹ɺMacBookPro ΍ɺ MacBookAir
  7. 2nd LSB of 1st octet of OUI MACΞυϨεϥϯμϚΠθʔγϣϯ iPhone ΍

    Mac ͷ MAC ΞυϨε͸σϑΥϧτͰϥϯμϚΠζ ͞Ε͍ͯΔ MAC ΞυϨε͸ 64-bit ͋ͬͯɺ࠷ॳͷ 32-bit ͸ϕϯμʔ͝ ͱʹܾ·͍ͬͯΔ ͜ΕΛ OUIs (Organizationally Unique Identi fi ers) ͱ͍͏
  8. 2nd LSB of 1st octet of OUI MACΞυϨεϥϯμϚΠθʔγϣϯ ࠷ॳͷόΠτͷԼ͔Β2൪໨ͷϏοτ͸ OUI

    ͷҰ෦ OUI ͸ϝʔΧʔ͝ͱʹൃߦ͞Ε͍ͯΔ ·͔͞ɺApple ͸ಛఆͷ OUI ϨϯδΛશ෦͍࣋ͬͯΔ?
  9. 2nd LSB of 1st octet of OUI MACΞυϨεϥϯμϚΠθʔγϣϯ ͭ͡͸ɺOUI ͷ࠷ॳͷόΠτͷԼ2Ϗοτ͸༧໿͞Ε͍ͯΔ

    Լ͔Β1Ϗοτ͸༻్͕ܾ·͍ͬͯΔ Լ͔Β2ϏοτΊ͸0ͱܾ·͍ͬͯΔ ͭ·Γɺਖ਼نͷOUIͰɺԼ͔Β2Ϗοτ໨͕1ʹͳΔ͜ͱ͸ͳ ͍