1, port install dhcp
vi /opt/local/etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.101 192.168.0.254;
}
option domain-name-servers 8.8.8.8;
host e3-xeon-v3 {
hardware ethernet 00:25:90:d4:cc:4a;
filename "pxelinux.0";
next-server 192.168.0.100;
fixed-address 192.168.0.101;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}
注: 192.168.0.100 是Mac系统里的一个固定网卡的IP
运行:
sudo dhcpd -f -d -cf /opt/local/etc/dhcp/dhcpd.conf
2, install tftpserver
A, downlaoding tftpserver for mac
http://ww2.unime.it/flr/tftpserver/TftpServer.dmg
双击TftpServer, 复制些必要的文件到/priviate/tftpboot下 (具体的文件可以参考另外一篇文章 http://blog.youkuaiyun.com/hujunnt/article/details/11387221 )
ls -l /private/tftboot
-rw-r--r--@ 1 root wheel 33383679 6 3 16:30 initrd.img
-rw-r--r-- 1 root wheel 26595 6 3 16:15 pxelinux.0
drwxr-xr-x 3 root wheel 102 6 3 16:34 pxelinux.cfg
-rw-r--r--@ 1 root wheel 4128368 6 3 16:29 vmlinuz
B, 用port 安装
port install tftp-hpa
sudo tftpd -L -s <tftp-root-dir>
3, 启动 pxe 客户端,就可以了
虽然是Mac OS X,依然很简单