[CentOS] Centos 7.3.1611 - NetworkManager + dhcp + ipv6

Wed Mar 22 11:01:49 UTC 2017
Patrick Laimbock <patrick at laimbock.com>

On 21-03-17 20:51, Diaulas Castro wrote:
> Used steps on sysctl from Centos7 FAQ (https://wiki.centos.org/FAQ/CentOS7) and some gathered on internet
>
> # cat /etc/sysctl.d/90-disable_ipv6.conf
> net.ipv6.conf.all.disable_ipv6=1
> net.ipv6.conf.default.disable_ipv6=1
> net.ipv6.conf.eth0.disable_ipv6=1
> net.ipv6.conf.eth1.disable_ipv6=1
> net.ipv6.conf.all.use_tempaddr=0
> net.ipv6.conf.all.autoconf=0
> net.ipv6.conf.all.accept_ra=0
> net.ipv6.conf.default.autoconf=0
> net.ipv6.conf.default.accept_ra=0
> net.ipv6.conf.eth0.autoconf=0
> net.ipv6.conf.eth1.autoconf=0
>
>
> But with dhcp, NetworkManager (or something) reenables ipv6 on interfaces.
>
> #sysctl -a | grep ipv6 | grep disable
> net.ipv6.conf.all.disable_ipv6 = 1
> net.ipv6.conf.default.disable_ipv6 = 1
> net.ipv6.conf.eth0.disable_ipv6 = 0
> net.ipv6.conf.eth1.disable_ipv6 = 1
> net.ipv6.conf.lo.disable_ipv6 = 1
>
> And the interface gets the ipv4 but still have temporary ipv6 on it (our dhcp doesnt support ipv6)
>
> # ip a s eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
>     link/ether 00:0c:29:31:5a:9d brd ff:ff:ff:ff:ff:ff
>     inet 10.10.216.247/24 brd 10.10.216.255 scope global dynamic eth0
>        valid_lft 451sec preferred_lft 451sec
>     inet6 fe80::20c:29ff:fe31:5a9d/64 scope link
>        valid_lft forever preferred_lft forever
>
> And this bugs  my use for ovftool with the option "--X:waitForIp" because it's returns (mostly of times) the ipv6 addr
>
> It's a bug, missing documentation or my

IIRC you can disable IPv6 in NetworkManager with:

# nmcli connection modify eth0 ipv6.method ignore
# systemctl restart NetworkManager

or you can disable IPv6 entirely with:

# vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 <other options>"

# grub-mkconfig -o /boot/grub2/grub.cfg
# reboot

HTH,
Patrick