linux pxe+dhcp+nfs+tftp

时间:2021-08-08 10:54:53

yum -y install vsftpd dhcp xinetd tftp-server syslinux(安装"syslinux"才有pxelinux.0)

tftp 服务(vim /etc/xinetd.d/tftp)

service tftp
{
  socket_type  = dgram
  protocol    = udp
  wait      = yes
  user      = root
  server       = /usr/sbin/in.tftpd
  server_args   = -s /var/lib/tftpboot
  disable      = no
  per_source    = 11
  cps        = 100 2
  flags      = IPv4
}

service xinetd restart


dhcp服务

cp -a /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

vim  /etc/dhcp/dhcpd.conf

allow booting;

allow bootp;

subnet 172.16.1.0 netmask 255.255.255.0 {

  range 172.16.1.10 172.16.1.20; #分配地址的范围

  option routers 172.16.1.1; #网关

  default-lease-time 600;

  max-lease-time 7200;

  next-server 172.16.1.1; #tftp服务器IP地址

  filename "/pxelinux.0";

}

service dhcpd restart


nfs服务vim /etc/exports

/media *(rw)

service nfs start


PXE引导配置

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

mkdir /var/lib/tftpboot/pxelinux.cfg/  #用于存放客户端的配置文件

mount /dev/cdrom /media

cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

chmod +w default

vim default

default linux 对应 label linux