pengkobe / reading-notes

:stars: to record daily reading notes. I build an issue blog to record daily FE study notes. suggestion and comments are welcomed.
https://github.com/pengkobe/reading-notes/issues
MIT License
13 stars 1 forks source link

mac as dhcp server #518

Open pengkobe opened 3 years ago

pengkobe commented 3 years ago

refer: https://support.atlona.com/hc/en-us/articles/360007290473-KB01474-How-to-turn-your-computer-Mac-OS-into-a-DHCP-server-to-give-your-Atlona-unit-an-IP-address

  1. config your mac network enviroment

    # your ip address connect with the gateway at upper level
    IP address - 192.168.10.2
    # to access by computer in your local network
    Subnet Mask - 255.255.255.0
  2. create /etc/bootpd.plist, configuration as follows:

    <?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>192.168.10.1</string>
            <key>lease_max</key>
            <integer>86400</integer>
            <key>lease_min</key>
            <integer>86400</integer>
            <key>name</key>
            <string>192.168.10</string>
            <key>net_address</key>
            <string>192.168.10.0</string>
            <key>net_mask</key>
            <string>255.255.255.0</string>
            <key>net_range</key>
            <array>
                <string>192.168.10.100</string>
                <string>192.168.10.200</string>
            </array>
        </dict>
    </array>
    </dict>
    </plist>
  3. start & stop

    sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
    sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist