十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站制作、成都做网站、外贸营销网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的汾阳网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
服务端:
1、DHCP服务 指定分配ip地址 定位引导文件next-server //指向TFTP路径
filename //引导程序文件位置
—————————————————————————2、TFTP服务(简单文件传输协议) UDP69端口
高效率 容量小
(引导程序pxelinnx.0(syslinux包),压缩内核vmlinuz,
系统初始化文件initrd.img,启动菜单default)—————————————————————————
3.FTP (vsftp) 文件传输协议 系统镜像(centos7)
安全 容量大 TCP 20(数据传输), 21(连接)—————————————————————————
安装包:dhcp, tftp-server, vsftp, syslinux
4.安装并配置kickstart无人值守
[root@localhost ~]# ifconfig //查看网卡详细信息
ens33: flags=4163 mtu 1500
inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255
inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeid 0x20
ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet)
RX packets 622 bytes 385786 (376.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 217 bytes 18826 (18.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens36: flags=4163 mtu 1500
inet6 fe80::658e:4c2d:2273:9cf5 prefixlen 64 scopeid 0x20
ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet)
RX packets 7 bytes 795 (795.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 82 bytes 13820 (13.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
//我们的两块网卡有了
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ //到我们的网卡配置文件夹中
[root@localhost network-scripts]# ls
ifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnel
ifcfg-lo ifdown-post ifup-aliases ifu-plusb ifup-wireless
ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global
ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions
ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6
ifdown-ib ifdown-Team ifup-ippp ifup-sit
ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team
ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36 //复制ens33网卡的信息到ens36中
[root@localhost network-scripts]# vim ifcfg-ens36 //进入ens36网卡进行配置
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static //静态
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens36
DEVICE=ens36
ONBOOT=yes
IPADDR=192.168.100.100 //IP地址
NETMASK=255.255.255.0 //子网掩码
GATWAY=192.168.100.100 //默认网关
~
~
~
~
~
~
~
~
~
:wq //保存退出
[root@localhost network-scripts]# systemctl restart network //重启网络服务,查看我们的网址有没有配上去
[root@localhost network-scripts]# ifconfig
ens33: flags=4163 mtu 1500
inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255
inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeid 0x20
ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet)
RX packets 2302 bytes 679197 (663.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 951 bytes 111027 (108.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens36: flags=4163 mtu 1500
inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::658e:4c2d:2273:9cf5 prefixlen 64 scopeid 0x20
ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet)
RX packets 9 bytes 1281 (1.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 230 bytes 39857 (38.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]# yum install dhcp -y //安装DHCP服务
[root@localhost network-scripts]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? yes //复制模板
[root@localhost network-scripts]# vim /etc/dhcp/dhcpd.conf //配置dhcp服务
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.20 192.168.100.30; //地址范围
option routers 192.168.100.100; //默认网关指向客户端
option domain-name-servers 114.114.114.114; //地址解析南京的服务器解析
next-server 192.168.100.100; //指向TFTP服务器是自己的地址
filename "pxelinux.0"; //ftp站点底下的引导程序文件位置
}
#This is a very basic subnet declaration.
:wq
[root@localhost network-scripts]# yum install syslinux -y
[root@localhost network-scripts]# yum install tftp-server -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装
--> 解决依赖关系完成
[root@localhost network-scripts]# rpm -ql tftp-server
/etc/xinetd.d/tftp //配置文件
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot //站点
cp /usr/share/syslinux/pxelinux.0
[root@localhost network-scripts]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ //复制引导程序到站点
[root@localhost network-scripts]# ls /var/lib/tftpboot/
pxelinux.0
[root@localhost network-scripts]# vim /etc/xinetd.d/tftp
default: off
#description: The tftp server serves files using the trivial file transfer \
protocol. The tftp protocol is often used to boot diskless \
workstations, download configuration files to network-aware printers, \
and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no //把yes改成no就行
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~
~
~
~
~
~
~
~
:wq
[root@localhost network-scripts]# yum install vsftpd -y //安装站点
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirrors.aliyun.com
正在解决依赖关系
[root@localhost network-scripts]# cd /var/ftp
[root@localhost ftp]# ls
pub
[root@localhost ftp]# mkdir centos7 //创建一个文件夹
[root@localhost ftp]# ls
centos7 pub
[root@localhost ftp]# mount /dev/sr0 /var/ftp/centos7 //挂载
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ftp]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda2 xfs 10G 4.3G 5.8G 43% /
devtmpfs devtmpfs 898M 0 898M 0% /dev
tmpfs tmpfs 912M 0 912M 0% /dev/shm
tmpfs tmpfs 912M 9.0M 903M 1% /run
tmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup
/dev/sda5 xfs 10G 37M 10G 1% /home
/dev/sda1 xfs 6.0G 174M 5.9G 3% /boot
tmpfs tmpfs 183M 20K 183M 1% /run/user/0
/dev/sr0 iso9660 4.3G 4.3G 0 100% /var/ftp/centos7
[root@localhost ftp]# cd centos7/
[root@localhost centos7]# ls
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@localhost centos7]# cd images/
[root@localhost images]# ls
efiboot.img pxeboot TRANS.TBL
[root@localhost images]# cd pxeboot/
[root@localhost pxeboot]# ls
initrd.img TRANS.TBL vmlinuz
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/ 把系统内核和初始化文件放到站点中
[root@localhost pxeboot]# ls /var/lib/tftpboot/
initrd.img pxelinux.0 vmlinuz
[root@localhost pxeboot]#
[root@localhost pxeboot]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 vmlinuz
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 pxelinux.cfg vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg
[root@localhost pxelinux.cfg]# vim default //配置启动菜单
default auto
prompt 1
label auto
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.100.100/centos7
label linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.100.100/centos7
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
~
~
~
~
~
~
~
~
~
~
~
~
~
~
:wq
[root@localhost pxelinux.cfg]# systemctl stop firewalld.service 关闭防火墙
[root@localhost pxelinux.cfg]# setenforce 0 //关闭增强功能
[root@localhost pxelinux.cfg]# systemctl start dhcpd //开启这三个服务
[root@localhost pxelinux.cfg]# systemctl start tftp
[root@localhost pxelinux.cfg]# systemctl start vsftpd
[root@localhost pxelinux.cfg]#
[root@localhost pxelinux.cfg]# yum install system-config-kickstart -y //安装无人值守工具
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
[root@localhost pxelinux.cfg]# cd /var/ftp/
[root@localhost ftp]# ls
centos7 ks.cfg pub
[root@localhost ftp]# vim ks.cfg
[root@localhost ftp]# cd /root
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 公共 模板 视频 图片 文档 下载 音乐 桌面
[root@localhost ~]# vim anaconda-ks.cfg //到这个模板下
把这个模板复制到我们的无人值守工具配置文件中
%packages
@^gnome-desktop-environment
@base
@core
@desktop-debugging
@dial-up
@directory-client
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
kexec-tools
%end
加个ks.cfg文件地址就可以了ks=ftp://192.168.100.100/ks.cfg
[root@localhost ftp]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 pxelinux.cfg vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# ls
default
[root@localhost pxelinux.cfg]# vim default
default auto
prompt 1
label auto
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfg
label linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.100.100/centos7
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7