通過設置MAC電腦的DHCP服務器可以為局域網內的其它設備自動分配IP地址,還能把物理地址和IP地址綁定起來,限制IP地址的獲取。
b)點擊 Utilities > Terminal
c)在 Terminal 中輸入 csrutil disable,之后回車
d)重啟 Mac
-
-
-
<plist version="1.0">
-
<dict>
-
<key>Disabled</key>
-
<true/>
-
<key>Label</key>
-
<string>com.apple.bootpd</string>
-
<key>Program</key>
-
<string>/usr/libexec/bootpd</string>
-
<key>ProgramArguments</key>
-
<array>
-
<string>/usr/libexec/bootpd</string>
-
<string>-Dv</string>
-
</array>
-
<key>Sockets</key>
-
<dict>
-
<key>Listeners</key>
-
<dict>
-
<key>SockFamily</key>
-
<string>IPv4</string>
-
<key>SockServiceName</key>
-
<string>bootps</string>
-
<key>SockType</key>
-
<string>dgram</string>
-
</dict>
-
</dict>
-
<key>inetdCompatibility</key>
-
<dict>
-
<key>Wait</key>
-
<true/>
-
</dict>
-
</dict>
-
</plist>
3)加載啟動腳本命令:sudo /bin/launchctl load -w /System/Library/LaunchDaemons/bootps.plist
4)去除啟動腳本命令:sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/bootps.plist
設置bootpd的運行方式
1)bootpd有兩個配置文件,一個是bootps.plist用於指導dhcp和bootp服務的工作方式,另一個是bootptab,用於設置地址池。(注意,此處的bootps.plist與上一個步驟的plist文件同名,但作用完全不同,前者的目的是設置開機啟動bootpd程序,本文件的目地是指導bootpd程序的運行方式)
2)bootps.plist的路徑:/etc/bootps.plist
3)bootps.plist配置文件內容:
-
-
-
<plist version="1.0">
-
<dict>
-
<key>Subnets</key>
-
<array>
-
<dict>
-
<key>allocate</key>
-
<true/>
-
<key>allow</key>
-
<array>
-
<string>8C:FA:BA:01:E6:F3</string>
-
<string>6C:FD:B9:C8:7E:2B</string>
-
<string>B8:09:8A:83:22:A3</string>
-
<string>10:dd:b1:c6:b4:37</string>
-
<string>60:92:17:A2:C2:65</string>
-
<string>E0:06:E6:1B:AE:A0</string>
-
<string>E8:8D:28:DF:13:0C</string>
-
<string>64:09:80:D8:5B:98</string>
-
<string>b8:98:f7:11:a4:79</string>
-
<string>70:72:3C:53:CE:BA</string>
-
<string>00:0a:f5:10:fb:2c</string>
-
<string>b8:98:f7:aa:1e:0d</string>
-
<string>28:b2:bd:af:07:62</string>
-
<string>68:3e:34:4c:ca:cb</string>
-
<string>9C:44:3D:1E:68:F4</string>
-
<string>A8:15:4D:F5:4A:AC</string>
-
<string>68:3e:34:4c:ca:cb</string>
-
<string>54:EE:75:27:6C:D4</string>
-
</array>
-
<key>dhcp_domain_name</key>
-
<string>ns1.drugsales.com</string>
-
<key>dhcp_domain_name_server</key>
-
<string>192.168.1.1</string>
-
<key>dhcp_router</key>
-
<string>192.168.1.1</string>
-
<key>lease_max</key>
-
<integer>86400</integer>
-
<key>lease_min</key>
-
<integer>86400</integer>
-
<key>name</key>
-
<string>vulcan</string>
-
<key>net_address</key>
-
<string>192.168.1.0</string>
-
<key>net_mask</key>
-
<string>255.255.255.0</string>
-
<key>net_range</key>
-
<array>
-
<string>192.168.1.100</string>
-
<string>192.168.1.200</string>
-
</array>
-
</dict>
-
</array>
-
<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>
-
</dict>
-
</plist>
-
%%
-
# machine entries have the following format:
-
#
-
# hostname hwtype hwaddr ipaddr bootfile
-
vulcan-macmini 1 10:dd:b1:c6:b4:37 192.168.1.2
-
vulcan-iphone5s 1 60:92:17:A2:C2:65 192.168.1.100
-
tangling-pc 1 E0:06:E6:1B:AE:A0 192.168.1.101
-
tangling-iphone5 1 E8:8D:28:DF:13:0C 192.168.1.102
-
tangMum-xiaomi 1 64:09:80:D8:5B:98 192.168.1.103
-
iPad3 1 8C:FA:BA:01:E6:F3 192.168.1.104
-
vulcan-huawei 1 70:72:3C:53:CE:BA 192.168.1.105
-
vulcan-u2 1 00:0a:f5:10:fb:2c 192.168.1.106
-
vulcan-u4 1 b8:98:f7:aa:1e:0d 192.168.1.107
-
vulcan-win8-wifi 1 28:b2:bd:af:07:62 192.168.1.108
-
vulcan-win8-eth 1 54:EE:75:27:6C:D4 192.168.1.109
-
mum-mobile 1 d0:2d:b3:8e:48:4c 192.168.1.110
-
vulcan-meilan 1 68:3e:34:4c:ca:cb 192.168.1.111
-
android-tvbox 1 9C:44:3D:1E:68:F4 192.168.1.112
-
yangzhenxue-iphone5s 1 B8:09:8A:83:22:A3 192.168.1.113
-
yangzhenxue-hasee 1 6C:FD:B9:C8:7E:2B 192.168.1.114
6)使用蘋果系統自帶的“控制台”工具程序可以查看bootpd的運行日志。
7)bootpd的日志文件輸出到/var/log/system.log文件中。
如果輸出以下調試信息,恭喜你,這說明bootpd的啟動是沒有問題的:
Jan 4 00:05:16 bogon bootpd[3185]: server starting
Jan 4 00:05:16 bogon bootpd[3185]: re-reading /etc/bootptab
Jan 4 00:05:16 bogon bootpd[3185]: Loaded 16 entries from bootptab (0 bad)
Jan 4 00:05:16 bogon bootpd[3185]: server name bogon
Jan 4 00:05:16 bogon bootpd[3185]: interface en0: ip 192.168.1.2 mask 255.255.255.0
常見錯誤信息:
1.bootpd[1091]: bind call failed: Permission denied
2.bootpd[1290]: bind call failed: Address already in use,說明地址已經被綁定,很可能有bootpd的另一個實例在運行。
