啓動nfs服務時報錯 systemd: rpcbind.socket failed to listen on sockets: Address family not supported by pro

問題描述

在使用 “sudo systemctl restart nfs” 命令啓動 nfs 服務時報錯,/var/log/message 文件中有如下錯誤

Sep 29 09:39:47 myhost systemd: Starting Preprocess NFS configuration...
Sep 29 09:39:47 myhost systemd: rpcbind.socket failed to listen on sockets: Address family not supported by protocol
Sep 29 09:39:47 myhost systemd: Failed to listen on RPCbind Server Activation Socket.

解決辦法

  • 修改 /etc/sysctl.conf 文件

    添加如下兩行

    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    
  • 修改 rpcbind.socket 文件

    首先查找 rpcbind.socket 文件路徑

    $ sudo find /etc/ -name '*rpcbind.socket*'
    /etc/systemd/system/sockets.target.wants/rpcbind.socket
    

    編輯 /etc/systemd/system/sockets.target.wants/rpcbind.socket 文件,將其中 ListenStream 關於IPv6的部分註釋掉,如下:

    [Unit]
    Description=RPCbind Server Activation Socket
    
    [Socket]
    ListenStream=/var/run/rpcbind.sock
    #ListenStream=[::]:111
    ListenStream=0.0.0.0:111
    BindIPv6Only=ipv6-only
    
    [Install]
    WantedBy=sockets.target
    
  • 重新啓動 nfs 服務

    $ sudo systemctl daemon-reload
    $ sudo systemctl restart nfs
    
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章