codecamp

19.2.2 配置TFTP服务程序

我们曾经在第11章中学习过vsftpd服务与TFTP服务。vsftpd是一款功能丰富的文件传输服务程序,允许用户以匿名开放模式、本地用户模式、虚拟用户模式来进行访问认证。但是,当前的客户端主机还没有安装操作系统,该如何进行登录认证呢?而TFTP作为一种基于UDP协议的简单文件传输协议,不需要进行用户认证即可获取到所需的文件资源。因此接下来配置TFTP服务程序,为客户端主机提供引导及驱动文件。当客户端主机有了基本的驱动程序之后,再通过vsftpd服务程序将完整的光盘镜像文件传输过去。

    [root@linuxprobe ~]# yum install tftp-server
    Loaded plugins: langpacks, product-id, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Resolving Dependencies
    --> Running transaction check
    ---> Package tftp-server.x86_64 0:5.2-11.el7 will be installed
    --> Processing Dependency: xinetd for package: tftp-server-5.2-11.el7.x86_64
    --> Running transaction check
    ---> Package xinetd.x86_64 2:2.3.15-12.el7 will be installed
    --> Finished Dependency Resolution
    Dependencies Resolved
    ================================================================================
     Package Arch Version Repository Size
    ================================================================================
    Installing:
     tftp-server x86_64 5.2-11.el7 rhel 44 k
    Installing for dependencies:
     xinetd x86_64 2:2.3.15-12.el7 rhel 128 k
    Transaction Summary
    ================================================================================
    Install 1 Package (+1 Dependent package)
    Total download size: 172 k
    Installed size: 325 k
    Is this ok [y/d/N]: y
    Downloading packages:
    --------------------------------------------------------------------------------
    Total 1.7 MB/s | 172 kB 00:00 
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
     Installing : 2:xinetd-2.3.15-12.el7.x86_64 1/2 
     Installing : tftp-server-5.2-11.el7.x86_64 2/2 
     Verifying : 2:xinetd-2.3.15-12.el7.x86_64 1/2 
     Verifying : tftp-server-5.2-11.el7.x86_64 2/2 
    Installed:
     tftp-server.x86_64 0:5.2-11.el7 
    Dependency Installed:
     xinetd.x86_64 2:2.3.15-12.el7 
    Complete!

TFTP是一种非常精简的文件传输服务程序,它的运行和关闭是由xinetd网络守护进程服务来管理的。xinetd服务程序会同时监听系统的多个端口,然后根据用户请求的端口号调取相应的服务程序来响应用户的请求。需要开启TFTP服务程序,只需在xinetd服务程序的配置文件中把disable参数改成no就可以了。保存配置文件并退出,然后重启xinetd服务程序,并将其加入到开机启动项中(在RHEL 7系统中,已经默认启用了xinetd服务程序,因此在将其添加到开机启动项中的时候没有输出信息属于正常情况)。

    [root@linuxprobe ~.d]# 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
    [root@linuxprobe xinetd.d]# systemctl restart xinetd
    [root@linuxprobe xinetd.d]# systemctl enable xinetd

TFTP服务程序默认使用的是UDP协议,占用的端口号为69,所以在生产环境中还需要在firewalld防火墙管理工具中写入使其永久生效的允许策略,以便让客户端主机顺利获取到引导文件。

    [root@linuxprobe ~]# firewall-cmd --permanent --add-port=69/udp
    success
    [root@linuxprobe ~]# firewall-cmd --reload 
    success
19.2.1 配置DHCP服务程序
19.2.3 配置SYSLinux服务程序
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }