{"id":981,"date":"2018-11-12T15:55:39","date_gmt":"2018-11-12T08:55:39","guid":{"rendered":"https:\/\/www.whplus.com\/blog\/?p=981"},"modified":"2018-11-12T15:56:10","modified_gmt":"2018-11-12T08:56:10","slug":"how-to-disable-ipv6-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.whplus.com\/blog\/2018\/11\/12\/how-to-disable-ipv6-on-centos-7.html","title":{"rendered":"How to disable IPv6 on CentOS 7"},"content":{"rendered":"<p>To verify if IPv6 is enabled or not, execute :<\/p>\n<p><code># ifconfig -a | grep inet6<br \/>\n        inet6 fe80::211:aff:fe6a:9de4  prefixlen 64  scopeid 0x20<br \/>\n        inet6 ::1  prefixlen 128  scopeid 0x10[host]<\/code><\/p>\n<p><strong>1. Disable IPv6 in kernel module (requires reboot)<\/strong><br \/>\n1. Edit \/etc\/default\/grub and add ipv6.disable=1 in line GRUB_CMDLINE_LINUX, e.g.:<\/p>\n<p><code># cat \/etc\/default\/grub<br \/>\nGRUB_TIMEOUT=5<br \/>\nGRUB_DEFAULT=saved<br \/>\nGRUB_DISABLE_SUBMENU=true<br \/>\nGRUB_TERMINAL_OUTPUT=\"console\"<br \/>\nGRUB_CMDLINE_LINUX=\"ipv6.disable=1 crashkernel=auto rhgb quiet\"<br \/>\nGRUB_DISABLE_RECOVERY=\"true\"<\/code><\/p>\n<p>2. Regenerate a GRUB configuration file and overwrite existing one:<\/p>\n<p><code># grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/code><\/p>\n<p>3. Restart system and verify no line \u201cinet6\u201d in \u201cip addr show\u201d command output.<\/p>\n<p><code># shutdown -r now<\/code><\/p>\n<p><code># ip addr show | grep net6<\/code><br \/>\n<!--more--><\/p>\n<p><strong>2. Disable IPv6 using sysctl settings (no reboot required)<\/strong><\/p>\n<p>1. Append below lines in \/etc\/sysctl.conf:<\/p>\n<p><code>net.ipv6.conf.all.disable_ipv6 = 1<br \/>\nnet.ipv6.conf.default.disable_ipv6 = 1<\/code><\/p>\n<p>2. To make the settings affective, execute :<\/p>\n<p><code># sysctl -p<\/code><\/p>\n<p>NOTE : make sure the file \/etc\/ssh\/sshd_config contains the line AddressFamily inet to avoid breaking SSH Xforwarding if you are using the sysctl method<\/p>\n<p>3. Add the AddressFamily line to sshd_config :<\/p>\n<p><code># vi \/etc\/ssh\/sshd_config<\/code><\/p>\n<p><code>....<br \/>\nAddressFamily inet<br \/>\n....<\/code><\/p>\n<p>Restart sshd for changes to get get effect :<\/p>\n<p><code># systemctl restart sshd<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To verify if IPv6 is enabled or not, execute : # ifconfig -a | grep inet6 inet6 fe80::211:aff:fe6a:9de4 prefixlen 64 scopeid 0x20 inet6 ::1 prefixlen 128 scopeid 0x10[host] 1. Disable IPv6 in kernel module (requires reboot) 1. Edit \/etc\/default\/grub and add ipv6.disable=1 in line GRUB_CMDLINE_LINUX, e.g.: # cat \/etc\/default\/grub GRUB_TIMEOUT=5 GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT=&#8221;console&#8221; GRUB_CMDLINE_LINUX=&#8221;ipv6.disable=1 crashkernel=auto\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.whplus.com\/blog\/2018\/11\/12\/how-to-disable-ipv6-on-centos-7.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-981","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/comments?post=981"}],"version-history":[{"count":2,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/981\/revisions"}],"predecessor-version":[{"id":983,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/981\/revisions\/983"}],"wp:attachment":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/media?parent=981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/categories?post=981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/tags?post=981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}