Fork me on GitHub

sysctl.conf禁用ipv6导致nfs无法启动的问题解决

rpcbind.socket failed to listen on sockets: Address family not supported by protocol

背景

虚拟机模板禁用了ipv6,创建了虚拟机

1
2
3
4
5
6
7
[root@centos7 ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv6.conf.all.disable_ipv6 =1
net.ipv6.conf.default.disable_ipv6 =1

启动nfs报错,报错如下

Error:

rpcbind service fails to start with below error message in /var/log/messages

1
2
rpcbind.socket failed to listen on sockets: Address family not support
ed by protocol

I got this error the other day while working on Red Hat Enterprise Linux 7.3 and after digging for a while I got to know there is a sort of a BUG in RHEL 7.3.

Analysis:

I found a BUG reported for this issue and I was facing the exact one.

https://bugzilla.redhat.com/show_bug.cgi?id=1402961

As explained by one of the engineers on the above page

1
"The problem is that if you disable ipv6 n sysctl.conf, it is not disabled from the beginning of the boot, but actually quite late in the boot process. Meanwhile systemd found out that ipv6 is enabled and scheduled a start of a socket, that would listen on ipv6."

Just to summarise if you have disabled ipv6 using your sysctl configurations then it is disabled only on kernel level but not via GRUB so it is not disabled completely hence systemd will attempt to make a connection on port 111 on any ipv6 address, [::]:111 during the boot up.

To know more on how to disable ipv6 follow below link

How to disable or enable ipv6 in Linux

解决办法:

/etc/sysctl.conf

1
net.ipv6.conf.all.disable_ipv6 = 1

grub级别禁用ipv6

1
2
# dracut -v -f
# systemctl start rpcbind
好记性不如烂笔头,生命不息,学习不止!

分享