LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1539|回复: 5

[总算明白了] PXE 远程启动是干嘛的。

[复制链接]
发表于 2006-3-9 02:54:33 | 显示全部楼层 |阅读模式
就是把启动的内核和参数等传输过去。真不错,这样我的笔记本就可以不装 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
发表于 2006-3-10 07:46:59 | 显示全部楼层
记得以前有将PXES的iso可以用来做不同的client连上各种Server,如Citrix,RDP,NX,VNC等。

挺好玩的:rolleyes:
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-10 16:03:29 | 显示全部楼层
PXE ,怎么做成ISO?。。就是启动的时候。。怎么处理的?
回复 支持 反对

使用道具 举报

发表于 2006-3-10 20:10:25 | 显示全部楼层
不是这个意思,我是指有现成的 iso 可以玩

http://downloads.2x.com/pxes/1.1.1/PREBUILT/
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-10 21:14:02 | 显示全部楼层
好像pxes 和 PXE 不是一个东西?还是我没理解光碟里边的东西的作用?

PXE 启动就是用网卡启动的,这样就不需要 软驱和光驱了,现在改用 CDROM 启动了,还有啥特别的呢?。。
回复 支持 反对

使用道具 举报

发表于 2006-3-10 21:35:27 | 显示全部楼层
Oh, I mixed up!

都是Thin client 的用图,太相似了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表