{"id":6669,"date":"2017-05-08T12:33:38","date_gmt":"2017-05-08T04:33:38","guid":{"rendered":"http:\/\/rmohan.com\/?p=6669"},"modified":"2017-05-08T12:33:54","modified_gmt":"2017-05-08T04:33:54","slug":"centos-rhel-7-how-to-disable-ipv6","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6669","title":{"rendered":"CentOS \/ RHEL 7 : How to disable IPv6"},"content":{"rendered":"<p>Post describes procedure to disable IPv6 on CentOS\/RHEL 7. There are 2 ways to do this :<br \/>\n1. Disable IPv6 in kernel module (requires reboot)<br \/>\n2. Disable IPv6 using sysctl settings (no reboot required)<\/p>\n<p>To verify if IPv6 is enabled or not, execute :<\/p>\n<p># 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]<br \/>\n1. Disable IPv6 in kernel module (requires reboot)<\/p>\n<p>1. Edit \/etc\/default\/grub and add ipv6.disable=1 in line GRUB_CMDLINE_LINUX, e.g.:<\/p>\n<p># cat \/etc\/default\/grub<br \/>\nGRUB_TIMEOUT=5<br \/>\nGRUB_DEFAULT=saved<br \/>\nGRUB_DISABLE_SUBMENU=true<br \/>\nGRUB_TERMINAL_OUTPUT=&#8221;console&#8221;<br \/>\nGRUB_CMDLINE_LINUX=&#8221;ipv6.disable=1 crashkernel=auto rhgb quiet&#8221;<br \/>\nGRUB_DISABLE_RECOVERY=&#8221;true&#8221;<br \/>\n2. Regenerate a GRUB configuration file and overwrite existing one:<\/p>\n<p># grub2-mkconfig -o \/boot\/grub2\/grub.cfg<br \/>\n3. Restart system and verify no line \u201cinet6\u201d in \u201cip addr show\u201d command output.<\/p>\n<p># shutdown -r now<br \/>\n# ip addr show | grep net6<br \/>\n2. Disable IPv6 using sysctl settings (no reboot required)<\/p>\n<p>1. Append below lines in \/etc\/sysctl.conf:<\/p>\n<p>net.ipv6.conf.all.disable_ipv6 = 1<br \/>\nnet.ipv6.conf.default.disable_ipv6 = 1<br \/>\nNOTE : To disable IPv6 on a single interface add below lines to \/etc\/sysctl.conf :<br \/>\nnet.ipv6.conf.[interface].disable_ipv6 = 1 ### put interface name here [interface]<br \/>\nnet.ipv6.conf.default.disable_ipv6 = 1<br \/>\n2. To make the settings affective, execute :<\/p>\n<p># sysctl -p<br \/>\nNOTE : 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<br \/>\n3. Add the AddressFamily line to sshd_config :<\/p>\n<p># vi \/etc\/ssh\/sshd_config<br \/>\n&#8230;.<br \/>\nAddressFamily inet<br \/>\n&#8230;.<br \/>\nRestart sshd for changes to get get effect :<\/p>\n<p># systemctl restart sshd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post describes procedure to disable IPv6 on CentOS\/RHEL 7. There are 2 ways to do this : 1. Disable IPv6 in kernel module (requires reboot) 2. Disable IPv6 using sysctl settings (no reboot required)<\/p>\n<p>To verify if IPv6 is enabled or not, execute :<\/p>\n<p># ifconfig -a | grep inet6 inet6 fe80::211:aff:fe6a:9de4 prefixlen 64 scopeid [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6669"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6669"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6669\/revisions"}],"predecessor-version":[{"id":6671,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6669\/revisions\/6671"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}