使用一台CentOS 6/7做DHCP和HTTP服务器

安装dnsmasq, httpd,启用DHCP和HTTP服务


yum -y install httpd dnsmasq


vi /etc/dnsmasq.conf

145行处:dhcp-range=x.x.x.x x.x.x.x, 12h


启动httpd和dnsmasq服务 (暂时禁用iptables)

ss -lntu 查看端口

httpd:  tcp 80

dnsmasq: tcp/udp 53, udp 67


mkdir /var/www/http/ks

把ks.cfg文件放到此目录下,内容如下:

#version=DEVEL
# System authorization information
# Install OS instead of upgrade
install


# Use CDROM installation media
cdrom


# Use text mode install
text


# Run the Setup Agent on first boot
firstboot --enable
#ignoredisk --only-use=sda


# Reboot after installation
reboot --eject


# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'


# System language
lang en_US.UTF-8


# SELinux configuration
selinux --disabled


# Firewall configuration
firewall --enabled --ssh


# Network information
network  --bootproto=static --device=eth0 --gateway=192.168.x.x --ip=192.168.x.x --nameserver=192.168.x.x --netmask=255.255.255.0 --noipv6 --activate
network  --hostname=test


# System authorization information
auth --enableshadow --passalgo=sha512
# Root password
# on CentOS 6, using grub-crypt --sha-512 to generate rootpw hash value
rootpw --iscrypted $6$ljdvgN7F4JF5CwHd$YUbZ557MRruCaqPSSpunrTG1tEkkPLwRC6N6c8V/VlO/ycw.6g0vq6C/x1mfNlA73Bmlaxwg9BcTl3U5fJwRD/


# System services
services --disabled="chronyd"


# System timezone
timezone Asia/Shanghai --isUtc --nontp

# System bootloader configuration
#bootloader --location=mbr --boot-drive=sda
bootloader --location=mbr
autopart --type=lvm


# Clear the Master Boot Record
zerombr


# Partition clearing information
clearpart --all --initlabel


%packages
@^minimal
@core
wget
telnet
net-tools

nano
unzip
ftp
ntp
iptables-services

%end


%post
sed -i 's,quiet,quiet net.ifnames=0 biosdevname=0,g' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg > /dev/null 2>&1
sed -i 's,UTC,LOCAL,g' /etc/adjtime

echo "DOMAIN=egis.local" >> /etc/sysconfig/network-scripts/ifcfg-eth0
systemctl disable postfix

systemctl disable firewalld
systemctl enable iptables


%end


%addon com_redhat_kdump --disable --reserve-mb='auto'


%end



安装光盘(CentOS-7-x86_64-DVD-1511.iso)启动,在Install CentOS 7处按Tab键,插入如下参数:

net.ifnames=0 biosdevname=0 ks=http://webserver-ip/ks/ks.cfg


My thoughts on bonding for kickstart:

network  --bootproto=static --device=bond0 --gateway=192.168.x.x --ip=192.168.x.x --nameserver=192.168.x.x --netmask=255.255.255.0 --noipv6 --activate --bondslaves=eth0,eth1 --bondopts=mode=active-backup,miimon=100

network  --bootproto=static --device=eth0 --noipv6 --activate
network  --bootproto=static --device=eth1 --noipv6 --activate


查看状态: cat /proc/net/bonding/bond0


for manual partiotion:

# autopart --type=lvm
part /boot --fstype=xfs --size=205
part swap --size=8192
part / --fstype=xfs --size=2048 --grow
part /home --fstype=xfs  --size=10240