PXE dhcp tftp -c6

  1. PXE 網路安裝需要 dhcp 及 tftp-server 套件
    [root@dyH ~]# yum install dhcp tftp-server -y
    
  2. dhcpd 服務設定並啟動
    1. 編輯設定檔
      [root@dyH ~]# vim /etc/dhcp/dhcpd.conf
      
      ddns-update-style none;
      option space PXE;
      
      subnet 192.168.111.0 netmask 255.255.255.0 {
      	class "PXE" {
          	match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
              option vendor-encapsulated-options 01:04:00:00:00:00:ff;
              option boot-size 0x1;
              filename "pxelinux.0";
              option tftp-server-name "deyu.wang";
              option vendor-class-identifier "PXEClient";
              vendor-option-space PXE;
      	}
      
      		#The following lines are standard all of the time.
              option routers 192.168.111.254;
              option subnet-mask 255.255.255.0;
              option domain-name "deyu.wang";
              option domain-name-servers 168.95.1.1,139.175.10.20;
              default-lease-time 21600;
              max-lease-time 43200;
      
              # Assign IPs 101-100 to PXE clients
              pool {
                  allow members of "PXE";
                  default-lease-time 120;
                  max-lease-time 180;
                  range 192.168.111.22 192.168.111.99;
              }
              pool {
                  deny members of "PXE";
                  range 192.168.111.100 192.168.111.199;
              }
          next-server 192.168.111.254;
          filename "ftp://192.168.111.254/pub/centos6/add/crt-ks.cfg";
      }
      
    2. 服務啟動
      [root@dyH ~]# /etc/init.d/dhcpd restart
      
    3. 看是否需要開機時啟動
      [root@dyH ~]# chkconfig dhcpd on
      
  3. tftp 服務設定及啟動
    1. 編輯設定檔
      [root@dyH ~]# 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/ftp/pub/centos6/isolinux  <== pxe isolinux 放的位置
          disable         = no   <== 啟動
          per_source      = 11
          cps         = 100 2
          flags           = IPv4
      }
      
    2. 服務啟動
      [root@dyH ~]# /etc/init.d/xinetd restart
      
  4. 網路設定
    1. 設定網卡 ethx 的 ip <== 必須與 dhcpd, pxelinux.cfg/default 中設定的相同
      [root@dyH ~]# ifconfig eth0 192.168.111.254/24
      
    2. 設定 dhcpd 網卡
      [root@dyH ~]# vim /etc/sysconfig/dhcpd
      DHCPDARGS="eth0"