Linux – tftp 除錯

Loading

測試環境為 Ubuntu 16.04 x86_64.

tftp 常見的錯誤訊息

  • PXE-E3B-TFTP Error file not found
    最近新設定一台 PXE 但使用 PXE 開機卻出現下面的錯誤訊息!

    PXE-T01: file not found
    PXE-E3B-TFTP Error file not found
    PXE-M0F exiting Intel boot agent
    

    使用 tcpdump 則是出現這樣的訊息

    IP tftp: 28 RRQ "/pxelinux.0" octet tsize 0
    

    也確定 tftp 服務是開啟的

    # netstat -an | fgrep -w 69
    udp        0      0 0.0.0.0:69              0.0.0.0:*
    

    查了半天才看出原來 /etc/xinetd.d/tftp 和 /etc/dhcpd.conf 目錄設定錯誤.

    #vi /etc/xinetd.d/tftp
    server_args = -s /tftpboot
    
    # vi /etc/dhcpd.conf
    filename “linux-install/pxelinux.0″
    

    dhcpd.conf 所指定的檔案目錄是以 tftp 為基準點,所以寫成 “filename “linux-install/pxelinux.0″;” 是指向 “/tftpboot/linux-install/pxelinux.0″;”

  • PXE-E99: Unexptced network error
    這一次遇到的是 tftp IPv6 的問題.

    >> Start PXE over IPv6.
    Static IP address is 3FFE:501:666:100:0:0:0:2C
    Server IP address is 3FFE:501:666:100:0:0:0:1
    NBP filename is grubaa64.efi
    NBP filesize is 0 bytes
    PXE-E99: Unexptced network error
    

    tftp 設定要修改成 flags = IPv6 (會同時支援 Ipv4 與 IPv6)

    [root@benjr ~]# cat /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
    {
                        disable          = no
                        socket_type      = dgram
                        protocol         = udp
                        wait             = yes
                        user             = root
                        server           = /usr/sbin/in.tftpd
                        server_args      = -s /var/lib/tftpboot
                        per_source       = 11
                        cps              = 100 2
                        flags            = IPv6
    }
    [root@benjr ~]# service xinetd restart
    
  • PXE-E32: TFTP Open timeout
    另外一個常見的錯誤是

    PXE-E32: TFTP Open timeout
    

    可能的問題也跟前面一樣,需要在檢查一下你的 /etc/xinetd.d/tftp 和 /etc/dhcpd.conf 目錄設定.

  • Unified Extensible Firmware Interface (UEFI)
    其他常見的錯誤訊息,可以先在本機使用 tftp 指令來除錯(如下所示).

    PXE-E07: Network device error.
    PXE-E16: No offer received.
    PXE-E18: Server response timeout.
    PXE-E99: Unexpected network error.
    

tftp 除錯

  • tftp 指令
    如果檢查了半天還是不知哪裡出現問題,可在本機 Linux 使用 tftp 指令來檢視 tftp 的功能是否正常,除了 IPv4 外,也可以直接使用 IPv6 – #tftp 3ffe:501:6666:100::1 (你的 IPv6 IP).

    # tftp 172.16.0.2
    
    tftp> help
    tftp-hpa 0.49
    Commands may be abbreviated.  Commands are:
    
    connect         connect to remote tftp
    mode            set file transfer mode
    put             send file
    get             receive file
    quit            exit 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> get pxelinux.0
    getting from 172.16.0.2:pxelinux.0 to pxelinux.0 [netascii]
    Received 27213 bytes in 0.0 seconds [31745124 bit/s]
    tftp>quit
    #
    
  • tftp -vvvv 設定
    只要在 tftp 設定多加入 -vvv (Verbose),可以在 /var/log/syslog 或是 message 獲得更多的資訊,服務需要重啟.

    root@ubuntu:~# vi /etc/default/tftpd-hpa
    # /etc/default/tftpd-hpa
    TFTP_USERNAME="tftp"
    TFTP_DIRECTORY="/var/lib/tftpboot"
    TFTP_ADDRESS=":69"
    TFTP_OPTIONS="--secure -vvv"
    
    root@ubuntu:~# vi /etc/xinetd.d/tftp
    service tftp
    {
      socket_type     = dgram
      protocol        = udp
      wait            = no
      user            = root
      server          = /usr/sbin/in.tftpd
      server_args     = -s /var/lib/tftpboot -vvv
      disable         = no
      per_source      = 11
      cps             = 100 2
      flags           = IPv4
    }
    
  • 沒有解決問題,試試搜尋本站其他內容

    2 thoughts on “Linux – tftp 除錯

    1. 自動引用通知: Legacy – PXE Boot – Benjr.tw
    2. 自動引用通知: IPV6 PXE boot – Benjr.tw

    發佈留言

    發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

    這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料