IPv6 may be undesirable in certain situations, disable IPv6 on Fedora Linux for systems that can by only with the IPv4 protocol stack
Fedora and RHEL disable IPv6 stack as follows
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
If one interface should run without IPv6, e.g. ens160.
net.ipv6.conf.ens160.disable_ipv6 = 1
Save the sysctl.conf file and enable the setting.
If you want to Disable IPv6 on Fedora or CentOS interface during operation, the following command applies.
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
Alternatively you can run this command in terminal shell.
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
IPv6 on Fedora is now disabled, a reboot is not necessary.
SSH Server AddressFamily configuration
If the removal of IPv6 for running daemons is a disaster, e.g. SSH Server, the configuration on Fedora or RHEL can be change as follows.
#or remove hash(#)
Then restart the SSH daemon.
systemctl restart sshd
Postfix ipv4 loopback interface
Postfix may also require to customize the ipv4 loopback interface.
#inet_interfaces = localhost
inet_interfaces = 127.0.0.1
With CentOS 6, the kernel module can be customized.
options ipv6 disable=1
Disable the IPv6 stack.
chkconfig ip6tables off
Then reboot the system.
Checking for IPv6 addresses.
ifconfig | grep inet6
ip a | grep inet6
Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP). The communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. IPv6 was developed by the Internet Engineering Task Force (IETF) to deal with the long-anticipated problem of IPv4 address exhaustion, and was intended to replace IPv4. In December 1998, IPv6 became a Draft Standard for the IETF, which subsequently ratified it as an Internet Standard on 14 July 2017.
IPv6 is an Internet Layer protocol for packet-switched internetworking and provides end-to-end datagram transmission across multiple IP networks. Closely adhering to the design principles developed in the previous version of the protocol, Internet Protocol Version 4 (IPv4).