在redhat上搭建TFTP服务(详解)
其实这一过程是比较简单的,只是其中可能影藏了几个小点容易出现一点点错误,
分析一下可能是因为思路不够清晰的问题吧!或者是不太熟悉,当然这都没关系!
下面我前两天设计到到要远程加载内核,把我的过程和大家分享一下吧!!
第一步:
首先如果你没有安装相关的包的话那就先安装包!!
可以直接rpm安装,也可以yum安装;
我的机器上是这两个包.
tftp-0.49-7.el6.x86_64.rpm ---客户端
tftp-server-0.49-7.el6.x86_64.rpm ---服务器端(装完这个包/etc/xinetd.d/下就会出现tftp这个文件)
我相信用到这个同学都会装包(rpm -ivh tftp-server-0.49-7.el6.x86_64.rpm)
[root@localhost yum_src]# rpm -ivh tftp-server-0.49-7.el6.x86_64.rpm
Preparing... ########################################### [100%]
package tftp-server-0.49-7.el6.x86_64 is already installed
[root@localhost yum_src]#
或者yum install tftp
[root@localhost yum_src]# yum install tftp
Loaded plugins: refresh-packagekit
nk6-adv-x64-os | 2.9 kB 00:00 ...
Setting up Install Process
Package tftp-0.49-7.el6.x86_64 already installed and latest version
Nothing to do
因为我已经安装过了,所以你看到的是上面的结果;当然如果你对上面yum有疑问,还请网上找一下如何搭建yum源;
第二步:
万事俱备,只欠东风!!
修改配置文件
[root@localhost yum_src]# vim /etc/xinetd.d/tftp
1 # default: off --默认是关闭的,需要手动打开;
2 # description: The tftp server serves files using the trivial file transfer \
3 # protocol. The tftp protocol is often used to boot diskless \
4 # workstations, download configuration files to network-aware printers, \
5 # and to start the installation process for some operating systems.
6 service tftp
7 {
8 socket_type = dgram
9 protocol = udp
10 wait = yes
11 user = root
12 server = /usr/sbin/in.tftpd
13 server_args = -s /tftpboot/ 这里建议放在根目录下的(考虑到权限问题)
14 disable = no
15 per_source = 11
16 cps = 100 2
17 flags = IPv4
18 }
参数-s指定chroot
上面我在根目录下
#mkdir tftpboot
#chmod 777 tftpboot ---给比较大的权限
如果有必要的话关闭防火墙,防止防火墙禁用69端口;
#/etc/init.d/iptables stop //关闭防火墙
启动tftp服务
#service xinetd restart //启动tftp服务
用法:/etc/init.d/xinetd {start|stop|status|restart|condrestart|reload}
使用命令来看一下服务是否已经启动;
[root@localhost yum_src]# netstat -nlp |grep 69
udp 0 0 0.0.0.0:69 0.0.0.0:* 1565/xinetd
使用tftp服务
[root@localhost yum_src]# tftp localhost(指127.0.0.1 也可以是远程IP地址)
tftp> ? //输入?号来查看可以使用的命令
tftp-hpa 0.49
Commands may be abbreviated. Commands are:
connect connect to remote tftp
mode set file transfer mode
put send file //上传(上传文件只能是存在于server_args指定的目录中的文件)
get receive file //下载(下载文件会下载到你当前执行tftp命令时所在路径下)
quit exit tftp //退出tftp
verbose toggle verbose mode //
trace toggle packet tracing
literal toggle literal mode, ignore ':' in file name
status show current status
binary set mode to octet
ascii set mode to netascii
rexmt set per-packet transmission timeout
timeout set total retransmission timeout
? print help information
help print help information
tftp>
我在这里测试一下:
]# cd /tftpboot/
]# touch 112.txt
[root@localhost ]# cd ../
[root@localhost tftpboot]# ls
slkdaj
[root@localhost tftpboot]# tftp ip地址
tftp> get 112.txt
tftp> put slkdaj
tftp> q
上面是在我的机器上做了演示,你可以在自己的机子上试试;
理一下思路:安装包---》配置文件-----》启动服务----》检查一下服务是否启动(netstat -nlp 那个命令)
配置的时候尽量在根目录下,防止权限问题影响;防止防火墙影响;
下面简单翻译一下上面的命令说明,其实我们常用的就get put quit三个了!!
connect:连接到远程tftp服务器
mode:文件传输模式
put:上传文件
get:下载文件
quit:退出 (直接q就ok)
verbose:显示详细的处理信息
tarce:显示包路径
status:显示当前状态信息
binary:二进制传输模式
ascii:ascii 传送模式
rexmt:设置包传输的超时时间
timeout:设置重传的超时时间
help:帮助信息
? :帮助信息
祝你万事如意!!!
其实这一过程是比较简单的,只是其中可能影藏了几个小点容易出现一点点错误,
分析一下可能是因为思路不够清晰的问题吧!或者是不太熟悉,当然这都没关系!
下面我前两天设计到到要远程加载内核,把我的过程和大家分享一下吧!!
第一步:
首先如果你没有安装相关的包的话那就先安装包!!
可以直接rpm安装,也可以yum安装;
我的机器上是这两个包.
tftp-0.49-7.el6.x86_64.rpm ---客户端
tftp-server-0.49-7.el6.x86_64.rpm ---服务器端(装完这个包/etc/xinetd.d/下就会出现tftp这个文件)
我相信用到这个同学都会装包(rpm -ivh tftp-server-0.49-7.el6.x86_64.rpm)
[root@localhost yum_src]# rpm -ivh tftp-server-0.49-7.el6.x86_64.rpm
Preparing... ########################################### [100%]
package tftp-server-0.49-7.el6.x86_64 is already installed
[root@localhost yum_src]#
或者yum install tftp
[root@localhost yum_src]# yum install tftp
Loaded plugins: refresh-packagekit
nk6-adv-x64-os | 2.9 kB 00:00 ...
Setting up Install Process
Package tftp-0.49-7.el6.x86_64 already installed and latest version
Nothing to do
因为我已经安装过了,所以你看到的是上面的结果;当然如果你对上面yum有疑问,还请网上找一下如何搭建yum源;
第二步:
万事俱备,只欠东风!!
修改配置文件
[root@localhost yum_src]# vim /etc/xinetd.d/tftp
1 # default: off --默认是关闭的,需要手动打开;
2 # description: The tftp server serves files using the trivial file transfer \
3 # protocol. The tftp protocol is often used to boot diskless \
4 # workstations, download configuration files to network-aware printers, \
5 # and to start the installation process for some operating systems.
6 service tftp
7 {
8 socket_type = dgram
9 protocol = udp
10 wait = yes
11 user = root
12 server = /usr/sbin/in.tftpd
13 server_args = -s /tftpboot/ 这里建议放在根目录下的(考虑到权限问题)
14 disable = no
15 per_source = 11
16 cps = 100 2
17 flags = IPv4
18 }
参数-s指定chroot
上面我在根目录下
#mkdir tftpboot
#chmod 777 tftpboot ---给比较大的权限
如果有必要的话关闭防火墙,防止防火墙禁用69端口;
#/etc/init.d/iptables stop //关闭防火墙
启动tftp服务
#service xinetd restart //启动tftp服务
用法:/etc/init.d/xinetd {start|stop|status|restart|condrestart|reload}
使用命令来看一下服务是否已经启动;
[root@localhost yum_src]# netstat -nlp |grep 69
udp 0 0 0.0.0.0:69 0.0.0.0:* 1565/xinetd
使用tftp服务
[root@localhost yum_src]# tftp localhost(指127.0.0.1 也可以是远程IP地址)
tftp> ? //输入?号来查看可以使用的命令
tftp-hpa 0.49
Commands may be abbreviated. Commands are:
connect connect to remote tftp
mode set file transfer mode
put send file //上传(上传文件只能是存在于server_args指定的目录中的文件)
get receive file //下载(下载文件会下载到你当前执行tftp命令时所在路径下)
quit exit tftp //退出tftp
verbose toggle verbose mode //
trace toggle packet tracing
literal toggle literal mode, ignore ':' in file name
status show current status
binary set mode to octet
ascii set mode to netascii
rexmt set per-packet transmission timeout
timeout set total retransmission timeout
? print help information
help print help information
tftp>
我在这里测试一下:
]# cd /tftpboot/
]# touch 112.txt
[root@localhost ]# cd ../
[root@localhost tftpboot]# ls
slkdaj
[root@localhost tftpboot]# tftp ip地址
tftp> get 112.txt
tftp> put slkdaj
tftp> q
上面是在我的机器上做了演示,你可以在自己的机子上试试;
理一下思路:安装包---》配置文件-----》启动服务----》检查一下服务是否启动(netstat -nlp 那个命令)
配置的时候尽量在根目录下,防止权限问题影响;防止防火墙影响;
下面简单翻译一下上面的命令说明,其实我们常用的就get put quit三个了!!
connect:连接到远程tftp服务器
mode:文件传输模式
put:上传文件
get:下载文件
quit:退出 (直接q就ok)
verbose:显示详细的处理信息
tarce:显示包路径
status:显示当前状态信息
binary:二进制传输模式
ascii:ascii 传送模式
rexmt:设置包传输的超时时间
timeout:设置重传的超时时间
help:帮助信息
? :帮助信息
祝你万事如意!!!