Dnsmasq配備GPXEを使用してCentos 7をインストール
3047 ワード
実験環境1台Centos 7.6の仮想マシンip:192.168.148.17/24 PXE環境を配置する;仮想マシンをテストマシンとして新規作成
今回の実験はdnsmasqをdhcp、tftpサーバとして採用した.vsftpdはインストールソースを提供します
別の新しい仮想デフォルトを起動してネットワークからシステムのインストールを行います
転載先:https://blog.51cto.com/1012682/2382324
今回の実験はdnsmasqをdhcp、tftpサーバとして採用した.vsftpdはインストールソースを提供します
#
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
#syslinux pxe
[root@localhost ~]# yum -y install dnsmasq vsftpd syslinux
[root@localhost ~]# mkdir /var/ftp/pub/centos7
[root@localhost ~]# systemctl enable dnsmasq vsftpd
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# mkdir /var/ftp/pub/centos7
[root@localhost ~]# mount /dev/sr0 /var/ftp/pub/centos7/
# tftp
[root@localhost ~]# mkdir /var/lib/dnsmasq/tftpboot/
[root@localhost ~]# cd /var/lib/dnsmasq/tftpboot/
[root@localhost tftpboot]# cp /usr/share/syslinux/{menu.c32,gpxelinux.0} .
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cp /var/ftp/pub/centos7/isolinux/isolinux.cfg pxelinux.cfg/default
# default Gpxe tftp ftp,http
default menu.c32
timeout 600
menu title CentOS 7
label linux
menu label ^Install CentOS 7
kernel ftp://192.168.148.17/pub/centos7/isolinux/vmlinuz
append initrd=ftp://192.168.148.17/pub/centos7/isolinux/initrd.img inst.repo=ftp://192.168.148.17/pub/centos7/
label local
menu label Boot from ^local drive
menu default
localboot 0xffff
# /etc/dnsmasq.d/ pxe.conf ; dhcp , tftp , tftp ; :
[root@localhost ~]# cat /etc/dnsmasq.d/pxe.conf
dhcp-range=192.168.148.50,192.168.148.100,255.255.255.0,12h
enable-tftp
dhcp-boot=/var/lib/dnsmasq/tftpboot/gpxelinux.0,192.168.148.17
[root@localhost ~]# systemctl start dnsmasq
# ipv4 udp
[root@localhost ~]# ss -4 -unl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:53 *:*
UNCONN 0 0 *:67 *:*
UNCONN 0 0 *:69 *:*
#
#
[root@localhost ~]# systemctl enable firewalld
[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: ssh dhcpv6-client
ports:
protocols:
[root@localhost ~]# firewall-cmd --permanent --add-service=ftp
[root@localhost ~]# firewall-cmd --permanent --add-service=tftp
[root@localhost ~]# firewall-cmd --permanent --add-service=dhcp
[root@localhost ~]# firewall-cmd --reload
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0 eth1
sources:
services: ssh dhcpv6-client dhcp ftp tftp
別の新しい仮想デフォルトを起動してネットワークからシステムのインストールを行います
転載先:https://blog.51cto.com/1012682/2382324