PDA

View Full Version : Disable IPv6 from a script



mrmcginnt
06-Jun-2013, 15:32
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

ab
06-Jun-2013, 17:01
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.

Magic31
06-Jun-2013, 22:05
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

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

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

smflood
07-Jun-2013, 10:40
On 06/06/2013 22:14, Magic31 wrote:

> 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
>
> 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

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 for more details.
------------------------------------------------------------------------

jkinning
06-May-2014, 18:50
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.

smflood
13-May-2014, 12:45
On 06/05/2014 18:54, jkinning wrote:

> 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.

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
--
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.
------------------------------------------------------------------------