--Disable IPv6 on network interfaces with NetworkManager's command line tool nmcli
# cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core)
IPv6 is currently enabled. If the ifconfig command shows an inet6 entry, then the device has IPv6 enabled.
# nmcli connection show
NAME UUID TYPE DEVICE
eth0 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX ethernet eth0
# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX broadcast XXX.XXX.XXX.XXX
inet6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX prefixlen 64 scopeid 0x0<global>
inet6 XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX prefixlen 64 scopeid 0x20<link>
ether XX:XX:XX:XX:XX:XX txqueuelen 1000 (Ethernet)
RX packets 1856709 bytes 121862479 (116.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 53733 bytes 8848173 (8.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Disable IPv6 on network interface eth0 with the nmcli connection modify command. Specify disabled for ipv6.method. Specify invalid values for ipv6.addresses and ipv6.gateway.
# nmcli connection modify eth0 ipv6.method "disabled" ipv6.addresses "" ipv6.gateway ""
Check the settings with the nmcli connection show command.
# nmcli connection show eth0 | grep ipv6
ipv6.method: disabled
ipv6.dns: --
ipv6.dns-search: --
ipv6.dns-options: --
ipv6.dns-priority: 0
ipv6.addresses: --
ipv6.gateway: --
ipv6.routes: --
ipv6.route-metric: -1
ipv6.route-table: 0 (unspec)
ipv6.routing-rules: --
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: 0 (disabled)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-duid: --
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
Use the nmcli connection up command to restart the network connection for the settings to take effect.
# nmcli connection up eth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
The official document of Red Hat Enterprise Linux 8 describes how to specify only ipv6.method, but in this environment, if you do not set the values of ipv6.addresses and ipv6.gateway, the following error will occur. Was there.
# nmcli connection modify eth0 ipv6.method "disabled"
Error: Failed to modify connection 'eth0': ipv6.addresses: this property is not allowed for 'method=disabled'
# nmcli connection modify eth0 ipv6.method "disabled" ipv6.addresses ""
Error: Failed to modify connection 'eth0': ipv6.gateway: gateway cannot be set if there are no addresses configured
If the ifconfig command does not show an inet6 entry, then IPv6 is disabled on this network interface.
# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX broadcast XXX.XXX.XXX.XXX
ether XX:XX:XX:XX:XX:XX txqueuelen 1000 (Ethernet)
RX packets 1885535 bytes 123804373 (118.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 56110 bytes 9257206 (8.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
If 1 is written to the disable_ipv6 file, IPv6 is disabled on this network interface.
# cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6
1
-[Chapter 19 Disabling IPv6 on Systems Using NetworkManager Red Hat Enterprise Linux 8 \ | Red Hat Customer Portal](https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html/ configuring_and_managing_networking / disabling-ipv6-on-a-system-that-uses-networkmanager_configuring-and-managing-networking) -[3 \ .3 . IP network settings using nmcli Red Hat Enterprise Linux 7 \ | Red Hat Customer Portal](https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html / networking_guide / sec-configuring_ip_networking_with_nmcli)
Recommended Posts