lol

Run a DHCP-server in macOS Monterey (12.4)

- Posted in macOS by

1) Go to Network Preferences

2) Configure IP-address on the wired connection: 10.39.105.2/24

3) Edit a new file for the server-configuration, run sudo nano /etc/bootpd.plist and add:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>bootp_enabled</key>
      <false/>
      <key>detect_other_dhcp_server</key>
      <integer>1</integer>
      <key>dhcp_enabled</key>
      <array>
        <string>en0</string>
      </array>
      <key>reply_threshold_seconds</key>
      <integer>0</integer>
      <key>Subnets</key>
      <array>
        <dict>
          <key>allocate</key>
          <true/>
          <key>dhcp_router</key>
          <string>10.39.105.1</string>
          <key>lease_max</key>
          <integer>86400</integer>
          <key>lease_min</key>
          <integer>86400</integer>
          <key>name</key>
          <string>10.39.105</string>
          <key>net_address</key>
          <string>10.39.105.0</string>
          <key>net_mask</key>
          <string>255.255.255.0</string>
          <key>net_range</key>
          <array>
            <string>10.39.105.100</string>
            <string>10.39.105.200</string>
          </array>
        </dict>
      </array>
    </dict>
</plist>

Save the file by hitting Ctrl+X then typing y and then hit the enter-key

4) Start the DHCP-daemon: sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist  

5) Stop the DHCP-daemon: sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist