Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1071590
  • 博文数量: 132
  • 博客积分: 612
  • 博客等级: 中士
  • 技术积分: 1389
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-14 16:06
文章分类

全部博文(132)

文章存档

2015年(2)

2014年(55)

2013年(53)

2012年(2)

2011年(20)

分类: LINUX

2015-07-21 18:48:06

http://blog.sina.com.cn/s/blog_65d6476a01017zkh.html

1.
下载tftp服务器、客户端tftp和守护进程xinetd三个包
yum install xinetd tftp tftp-server
//xinetd.i386 2: 2.3.14-21.fc10
//tftp-0.49-1.fc10.i386.rpm
//tftp-server-0.49-1.fc10.i386.rpm
2.配置vi /etc/xinetd.d/tftp
修改server_args = -s /tftpboot -c,这里的-c一定要加上,否则只能下载不能上传!!!
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -c
per_source = 11
cps = 100 2
flags = IPv4
}
3.关闭防火墙
4.建立tftp工作目录并修改属性(不修改属性会出现error
cd /
mkdir tftpboot
chmod 777 -R /tftpboot/
5.开启服务,上传下载文件
######################################
我的配置过程中先后顺序和出现的问题如下:
下载tftp服务客户端tftp和守护进程xinetd
yum install xinetd
yum install tftp tftp-server
//xinetd.i386 2:2.3.14-21.fc10
//tftp-0.49-1.fc10.i386.rpm
//tftp-server-0.49-1.fc10.i386.rpm
关闭防火墙
service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
cd /
mkdir tftpboot
cd tftpboot
cp /etc/inittab /tftpboot/
tftp 172.18.1.90
tftp> get inittab
Transfer timed out.
tftp>quit
[root@localhost tftpboot]# netstat -a|grep tftp
[root@localhost tftpboot]# ls
inittab
[root@localhost tftpboot]# touch aaa
[root@localhost tftpboot]# ls
aaa inittab
[root@localhost tftpboot]# tftp 172.18.1.90
tftp> get aaa
Transfer timed out.
tftp> quit
不知何故出现“Transfer timed out.”的错误提示,想想没有修改tftp配置文件:
[root@localhost tftpboot]# cd /etc/xinetd.d
[root@localhost xinetd.d]# vi tftp
修改保存:
disable=no
server_args=-s /tftpboot/ -c
[root@localhost xinetd.d]# cd /
[root@localhost /]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@localhost /]# netstat -a | grep tftp
udp 0 0 *:tftp *:*
[root@localhost /]# tftp 172.18.1.90
tftp> get aaa
Error code 1: File not found
tftp> get inittab
Error code 1: File not found
tftp> quit
错误不一样了,以为需要安装tftpd服务器端,yum install tftpd没有源
但这次想起来新建/tftpboot/目录时候没有对该目录权限进行修改,就一切ok
[root@localhost /]# chmod 777 -R /tftpboot/
[root@localhost /]# tftp 172.18.1.90
tftp> get aaa
tftp> get inittab
tftp> q
[root@localhost /]# ls
aaa boot etc inittab lost+found mnt proc sbin srv tftpboot usr
bin dev home lib media opt root selinux sys tmp var
//根目录出现了aaainittab文件,下载成功!
再来试试上传文件:
[root@localhost /]# cd /tftpboot
[root@localhost tftpboot]# ls
aaa inittab
[root@localhost tftpboot]# rm aaa
rm: remove regular empty file `aaa'? y
[root@localhost tftpboot]# ls
inittab
[root@localhost tftpboot]# tftp 172.18.1.90
tftp> put aaa
tftp: aaa: No such file or directory
tftp> put aaa
tftp: aaa: No such file or directory
tftp> q
[root@localhost tftpboot]# cd /
[root@localhost /]# ls
aaa boot etc inittab lost+found mnt proc sbin srv tftpboot usr
bin dev home lib media opt root selinux sys tmp var
[root@localhost /]# tftp 172.18.1.90
tftp> put aaa
tftp> q
[root@localhost /]# cd /tftpboot
[root@localhost tftpboot]# ls
aaa inittab
上传成功!
上面错误原因就是tftp的执行目录要再根目录下进行,因为默认根目录为当前操作的目录。

阅读(1681) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~