# Disable IPv6 from a script

**URL:** <https://forums.suse.com/t/disable-ipv6-from-a-script/24042>\
**Category:** SLES Networking\
**Created:** [June 6, 2013, 5:32pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042 "2013-06-06T17:32:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmcginnt](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mrmcginnt](https://forums.suse.com/u/mrmcginnt)\
**Post date:** [June 6, 2013, 5:32pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/1 "2013-06-06T17:32:40Z")

</div>

I need to disable IPv6 on 100 servers, so I was hoping to find a way to do it using a script. I searched the forums and the internet, but only found ways that might work. From what I can determine from using YaST to do it, YaST changes several files so I am looking for more of an authoritative answer. If anyone can help it would save me a lot of time.

Thanks,  
Tim

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [June 6, 2013, 7:01pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/2 "2013-06-06T19:01:11Z")

</div>

I’d start with the Yast changes. If you do not make those then the next  
time somebody goes to do anything networking-related (change hostname,  
DNS, server, IP, add other NICs, etc.) it is likely, depending on the  
setting, that things will be re-enabled. If you find how Yast does it  
(which ‘sysconfig’ files in particular) then scripting those changes and  
forcing a reboot (required) should be pretty simple.

Good luck.

---

<div class="post-metadata">

**Author:** ![Willem1](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@Willem1](https://forums.suse.com/u/Willem1)\
**Post date:** [June 7, 2013, 12:05am UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/3 "2013-06-07T00:05:06Z")

</div>

[QUOTE=mrmcginnt;13910]I need to disable IPv6 on 100 servers, so I was hoping to find a way to do it using a script. I searched the forums and the internet, but only found ways that might work. From what I can determine from using YaST to do it, YaST changes several files so I am looking for more of an authoritative answer. If anyone can help it would save me a lot of time.

Thanks,  
Tim[/QUOTE]

Along with Aaron’s reply, this might be an interesting approach: [http://const-cast.blogspot.nl/2009/11/disable-ipv6-using-sysctl-on-linux.html](http://const-cast.blogspot.nl/2009/11/disable-ipv6-using-sysctl-on-linux.html)

Which comes down to adding the following to /etc/sysctl.conf:

net.ipv6.conf.all.disable\_ipv6 = 1  
net.ipv6.conf.default.disable\_ipv6 = 1  
net.ipv6.conf.lo.disable\_ipv6 = 1

Cheers,  
Willem

---

<div class="post-metadata">

**Author:** ![smflood](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/smflood/32/10576_2.png) [@smflood](https://forums.suse.com/u/smflood)\
**Post date:** [June 7, 2013, 12:40pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/4 "2013-06-07T12:40:24Z")

</div>

On 06/06/2013 22:14, Magic31 wrote:  
[color=blue]

> Along with Aaron’s reply, this might be an interesting approach:  
> [http://const-cast.blogspot.nl/2009/11/disable-ipv6-using-sysctl-on-linux.html](http://const-cast.blogspot.nl/2009/11/disable-ipv6-using-sysctl-on-linux.html)
> 
> Which comes down to adding the following to /etc/sysctl.conf:
> 
> net.ipv6.conf.all.disable\_ipv6 = 1  
> net.ipv6.conf.default.disable\_ipv6 = 1  
> net.ipv6.conf.lo.disable\_ipv6 = 1[/color]

An alternative is to add the following line to /etc/modprobe.conf.local

alias net-pf-10 off

net-pf-10 is networking protocol family 10 which is IPv6 - see “modprobe  
-c | grep net-pf”.

The server(s) will then need restarting (just as disabling IPv6 during  
install also requires a restart).

## HTH.

Simon  
SUSE Knowledge Partner

* * *

## Do you work with SUSE technologies at a university, college or school? If so, your campus could benefit from joining the Technology Transfer Partner (TTP) program. See [novell.com/ttp](http://novell.com/ttp) for more details.

---

<div class="post-metadata">

**Author:** ![jkinning](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jkinning](https://forums.suse.com/u/jkinning)\
**Post date:** [May 6, 2014, 8:50pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/5 "2014-05-06T20:50:03Z")

</div>

So, I tried the following  
Added the following to /etc/sysctl.conf:  
net.ipv6.conf.all.disable\_ipv6 = 1  
net.ipv6.conf.default.disable\_ipv6 = 1  
net.ipv6.conf.lo.disable\_ipv6 = 1

This does appear to disable IPv6 when looking at the ifconfig output. However, if I look at the Networking in Yast the Enable IPv6 is still marked as enabled. Is there something else that needs to happen to remove this in Yast? I am running SLES 11sp3 and like the original poster have several servers which I need to disable this on. Just want to do it right the first time and the correct way.

---

<div class="post-metadata">

**Author:** ![smflood](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/smflood/32/10576_2.png) [@smflood](https://forums.suse.com/u/smflood)\
**Post date:** [May 13, 2014, 2:45pm UTC](https://forums.suse.com/t/disable-ipv6-from-a-script/24042/6 "2014-05-13T14:45:58Z")

</div>

On 06/05/2014 18:54, jkinning wrote:  
[color=blue]

> So, I tried the following  
> Added the following to /etc/sysctl.conf:  
> net.ipv6.conf.all.disable\_ipv6 = 1  
> net.ipv6.conf.default.disable\_ipv6 = 1  
> net.ipv6.conf.lo.disable\_ipv6 = 1
> 
> This does appear to disable IPv6 when looking at the ifconfig output.  
> However, if I look at the Networking in Yast the Enable IPv6 is still  
> marked as enabled. Is there something else that needs to happen to  
> remove this in Yast? I am running SLES 11sp3 and like the original  
> poster have several servers which I need to disable this on. Just want  
> to do it right the first time and the correct way.[/color]

Unfortunately YaST not correctly reflecting IPv6 being disabled is a  
cosmetic defect - please see TID 7015035[1] which was recently published.

HTH.

## [1] [https://www.suse.com/support/kb/doc.php?id=7015035](https://www.suse.com/support/kb/doc.php?id=7015035)

Simon  
SUSE Knowledge Partner

* * *

## If you find this post helpful and are logged into the web interface, please show your appreciation and click on the star below. Thanks.
