Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1337498
  • 博文数量: 1334
  • 博客积分: 645
  • 博客等级: 上士
  • 技术积分: 5762
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-25 16:56
文章分类

全部博文(1334)

文章存档

2014年(108)

2013年(1059)

2012年(169)

分类: LINUX

2014-10-05 17:36:03

使用uboot-1.1.6的tftp命令时总是超时,像下面这样

lzd> tftp 0x30000000 /home/lzd/nfs/image                                                          
TFTP from server 10.107.4.145; our IP address is 10.107.4.146                   
Filename '/home/lzd/nfs/image'.                                                 
Load address: 0x30000000                                                        
Loading: T T T T T T T T T T                                                    
Retry count exceeded; starting again                                            
TFTP from server 10.107.4.145; our IP address is 10.107.4.146                   
Filename '/home/lzd/nfs/image'.                                                 
Load address: 0x30000000                                                        
Loading: T T T T T T T T T T                                                    
Retry count exceeded; starting again
......

跟踪下数据包的接受情况
#tcpdump(tcpdump -n比较好)
08:43:52.677818 arp who-has lzd-laptop.local tell 10.107.4.146
08:43:52.677860 arp reply lzd-laptop.local is-at 00:0b:db:98:a0:5d (oui Unknown)
08:43:52.677966 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:43:52.678016 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:43:57.675237 arp who-has 10.107.4.146 tell lzd-laptop.local
08:43:57.675342 arp reply 10.107.4.146 is-at 00:80:00:80:00:80 (oui Unknown)
08:43:57.677452 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:43:57.677502 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:02.677134 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:02.677199 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:07.676805 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:07.676871 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:12.676474 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:12.676538 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:17.676144 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:17.676210 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:22.675815 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:22.675879 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:27.675484 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:27.675550 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:32.675154 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:32.675223 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:37.674825 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:37.674890 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74
08:44:37.675176 arp who-has 10.107.4.146 tell lzd-laptop.local
08:44:37.675268 arp reply 10.107.4.146 is-at 00:80:00:80:00:80 (oui Unknown)
08:44:42.674493 IP 10.107.4.146.1358 > lzd-laptop.local.tftp:  38 RRQ "/home/lzd/nfs/image" octet timeout 5
08:44:42.674557 IP lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74

可见,主机总是在告诉dm9000a,tftp端口不可达,就是说没有tftp端口可用。
lzd-laptop.local > 10.107.4.146: ICMP lzd-laptop.local udp port tftp unreachable, length 74

奇怪我不是安装vsftpd了吗?
lzd@lzd-laptop:~$ netstat -a |grep tcp (netstat -an |grep tcp)
tcp        0      0 *:nfs                   *:*                     LISTEN     
tcp        0      0 *:53516                 *:*                     LISTEN     
tcp        0      0 *:sunrpc                *:*                     LISTEN     
tcp        0      0 *:45203                 *:*                     LISTEN     
tcp        0      0 *:ftp                   *:*                     LISTEN     
tcp        0      0 localhost:ipp           *:*                     LISTEN     
tcp        0      0 *:51743                 *:*                     LISTEN     
lzd@lzd-laptop:~$ netstat -a |grep udp
udp        0      0 *:52993                 *:*                                
udp        0      0 *:nfs                   *:*                                
udp        0      0 *:55968                 *:*                                
udp        0      0 *:35879                 *:*                                
udp        0      0 *:42054                 *:*                                
udp        0      0 *:736                   *:*                                
udp        0      0 *:mdns                  *:*                                
udp        0      0 *:sunrpc                *:*      

真的没有tftp的服务器,原来vsftpd不是tftp服务器,呵呵,真菜。google下,看看大家都用什么tftp服务器。

找到了,我只安装服务器。
sudo apt-get install tftpd [tftp]

我没安装 netkit-inetd
sudo apt-get install netkit-inetd

但是,netkit-inetd是必须的,tftpd依赖它来管理网络连接,所以

The following extra packages will be installed:
  openbsd-inetd
The following NEW packages will be installed:
  openbsd-inetd tftpd

发现了/etc/inetd.conf 配置文件,内容是默认的,已经写好了,呵呵
tftp        dgram    udp    wait    nobody    /usr/sbin/tcpd    /usr/sbin/in.tftpd /srv/tftp

但是/srv/tftp这个目录并没有被创建
#/srv/tftp
#mkdir tftp

重新启动inetd
#/etc/init.d/openbsd-inetd restart

在检查下
root@lzd-laptop:~# netstat -an|grep udp
udp        0      0 0.0.0.0:52993           0.0.0.0:*                          
udp        0      0 0.0.0.0:2049            0.0.0.0:*                          
udp        0      0 0.0.0.0:55968           0.0.0.0:*                          
udp        0      0 0.0.0.0:35879           0.0.0.0:*                          
udp        0      0 0.0.0.0:69              0.0.0.0:*  ok了                        
udp        0      0 0.0.0.0:42054           0.0.0.0:*                          
udp        0      0 0.0.0.0:736             0.0.0.0:*                          
udp        0      0 0.0.0.0:5353            0.0.0.0:*                          
udp        0      0 0.0.0.0:111             0.0.0.0:*   

inetd已经开始运行了,^_^ 在试试看。
lzd>  tftp 0x30000000 /home/lzd/nfs/image                                       
dm9000 i/o: 0x20000300, id: 0x90000a46                                          
MAC: 00:80:00:80:00:80                                                          
TFTP from server 10.107.4.145; our IP address is 10.107.4.146                   
Filename '/home/lzd/nfs/image'.                                                 
Load address: 0x30000000                                                        
Loading: T                                                                      
TFTP error: 'Access violation' (2)                                              
Starting again

这次的错误是暴力访问,呵呵

lzd>  tftp 0x30000000 /srv/tftp/image                                           
dm9000 i/o: 0x20000300, id: 0x90000a46                                          
MAC: 00:80:00:80:00:80                                                          
TFTP from server 10.107.4.145; our IP address is 10.107.4.146                   
Filename '/srv/tftp/image'.                                                     
Load address: 0x30000000                                                        
Loading: T ###########################################T ######################  
         #################################################################      
         #################################################################      
         #################################################################      
         ###########################################                            
done                                                                            
Bytes transferred = 1546996 (179af4 hex)                                        
lzd>


lzd> tftp 0x30000000 image                                                      
dm9000 i/o: 0x20000300, id: 0x90000a46                                          
MAC: 00:80:00:80:00:80                                                          
TFTP from server 10.107.4.145; our IP address is 10.107.4.146                   
Filename 'image'.                                                               
Load address: 0x30000000                                                        
Loading: T #################################################################    
         #################################################################      
         #################################################################      
         #################################################################      
         ###########################################                            
done                                                                            
Bytes transferred = 1546996 (179af4 hex)                                        
lzd>

两次都成功了,然后
lzd> go 0x30000000                                                              
## Starting application at 0x30000000 ...                                       
Uncompressing Linux.............................................................
                                                                                
crc error                                                                      
                                                                               
 -- System halted
为什么回这样呢?以后在分析。
参考的文章http://weibing.blogbus.com/logs/12146712.html
 
阅读(3488) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~