|
|
就是把启动的内核和参数等传输过去。真不错,这样我的笔记本就可以不装 boot 分区直接通过网卡启动了。活活。。。。
简单的说一下配置。原理自己去找资料看吧,软件下载地址都在最后。
1。配置 DHCP Server。
[PHP]
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = " XEClient";
option vendor-class-identifier " XEClient";
vendor-option-space PXE;
# At least one of the vendor-specific PXE options must be set in
# order for the client boot ROMs to realize that we are a PXE-compliant
# server. We set the MCAST IP address to 0.0.0.0 to tell the boot ROM
# that we can't provide multicast TFTP (address 0.0.0.0 means no
# address).
option PXE.mtftp-ip 0.0.0.0;
# This is the name of the file the boot ROMs should download.
filename "pxelinux.0";
# This is the name of the server they should get it from.
next-server 192.168.0.1;
}
ddns-update-style interim;
ignore client-updates;
default-lease-time 1200;
max-lease-time 9200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.254;
option domain-name-servers 192.168.0.1,192.168.0.2;
option domain-name "mydomain.org";
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.100;
}
[/PHP]
前部分是为 PXE 配置的,后边的则是给 DHCP 普通设置。我不明白那些 PXE 的参数意思,但是确实可用。主要的参数就是那个 filename,我没改。
修改后,重启 dhcp 服务器。确保正确启动。
2。设置 tftp 服务器。
安装 tftp-hpa-0.42:
./configure --prefix=/usr
make && make install
修改 /etc/xinetd.d/tftp 文件内容为:
[PHP]
# Begin /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -u nobody -s /tftpboot
per_source = 11
cps = 100 2
}
# End /etc/xinetd.d/tftp
[/PHP]
重启 xinetd 服务器。
3。建立目录。用作储存文件使用。
mkdir -p /tftpboot
mkdir -p /tftpboot/pxelinux.cfg
下载 syslinux-3.11,把里边的 pxelinux.0 拷贝出来。
install -v -m 644 -o 0 -g 0 pxelinux.0 /tftpboot
在 /tftpboot/pxelinux.cfg 里边创建一个文件 default,内容:
[PHP]
DEFAULT vmlinuz1
PROMPT 1
LABEL vmlinuz1
KERNEL vmlinuz1
APPEND ramdisk_size=16384 root=/dev/hda5
LABEL vmlinuz2
KERNEL vmlinuz2
APPEND ramdisk_size=16384
[/PHP]
用过 LILO 和 GRUB 的人,都应该对里边的内容比较熟悉了。
default 是默认配置,PXE 是按照顺序查找设置文件的,具体的请看参考资料3。
KERNEL 指定的这个文件,要放在 /tftpboot 下边,而不是 pxelinux.cfg 下边。我是拷贝了现在用的内核到 /tftpboot 下边,命名 vmlinuz1。
4。一切搞定后,开启你的客户机,选中网卡启动。内核启动后就算是成功了,至于后边怎么加载你的硬盘,或者做 NFS rootfs,那和原来的是一样的,无须改变。:)。反正我的笔记本可以启动了,而且顺利进入了系统。
参考资料:
1. http://www.kernel.org/pub/linux/utils/boot/syslinux/
2. http://www.kernel.org/pub/software/network/tftp/
3. http://syslinux.zytor.com/pxe.php
4. http://www.linuxsir.cn/bbs/showthread.php?t=178411 |
|