Something went wrong. Try again.
An experimental port of NetBSD, FreeBSD, OpenBSD, and XNU to unkernel unkernel.dev
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344#!/bin/sh# SPDX-License-Identifier: GPL-2.0-or-later# Copyright (C) 2026 Tsiry Sandratraina## The XNU guest's network (kernel/tools/xnu-rootfs.sh, launchd's# com.unkernel.network): the host's stack is at fixed addresses (js.md,# Network), so en0 is configured by hand, with no DHCP client. configd# does the same from its preferences (xnu-root/Library/Preferences/# SystemConfiguration/preferences.plist: a manual service on en0, whose# DNS server IPMonitor publishes for libinfo and mDNSResponder); this job# is what runs without configd, and before it is done./sbin/ifconfig en0 >/dev/null 2>&1 || exit 0/sbin/ifconfig en0 inet 10.0.2.15 netmask 255.255.255.0 up/sbin/route -n add default 10.0.2.2 >/dev/null 2>&1[ -s /etc/resolv.conf ] || printf 'nameserver 10.0.2.3\n' > /etc/resolv.conf
# configd's IPConfiguration and InterfaceNamer wait for IOKit network# interfaces, which en0 (a BSD ifnet) is not, so the service's state is# published here as they would: IPMonitor makes it the primary service and# publishes the DNS configuration (State:/Network/Global/DNS) libinfo and# mDNSResponder resolve with. The service is the preferences' (its UUID).svc=4B570000-0000-4000-8000-0000000000E0for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; do /usr/sbin/scutil <<'SC' >/dev/null 2>&1 && breaklistSC sleep 1done/usr/sbin/scutil >/dev/null 2>&1 <<SCd.initd.add Addresses * 10.0.2.15d.add SubnetMasks * 255.255.255.0d.add Router 10.0.2.2d.add InterfaceName en0set State:/Network/Service/$svc/IPv4d.initd.add ServerAddresses * 10.0.2.3set State:/Network/Service/$svc/DNSd.initd.add Active ? TRUEset State:/Network/Interface/en0/LinkSCexit 0