Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to avoid my Mac OS X machine from using ipv6 at all.

I'm looking for a programmatic way to disable ipv6 on every network interface and, possibly, to avoid ipv6 support by the kernel at all.

As an explanation, I need the equivalent of adding "alias ipv6 off" to modprobe.conf in linux.

The "it's impossible" answer is welcome, being supported by some kind of official source, of course.

EDIT:

I want to remove ipv6 from logs, from ipfw, from everywhere. Even for the satisfaction of knowing if and how it is possible. It is is right to do it is another issue :)

share|improve this question
2  
Entirely your choice of course, but I'm just curious as to why you would want to do this? –  Steve Folly Oct 2 '09 at 13:15
2  
For the sake of clearness. Since in my LAN there is no need for IPV6, my policy is to remove everything not necessary, as the only thing secure by default is the one not existing :) –  AlberT Oct 2 '09 at 13:34

6 Answers 6

As already mentioned by neoice the 'ip6' tool is useful here. This allows you to disable IPv6 per interface, or 'ip6 -x' disables all but the loopback interface.

You can disable IPv6 on the loopback interface with

ip6 -d lo0

When I tried this though, DNS resolution stopped working.

So: Yes you can completely disable IPv6, but you'll get a seriously impaired system.

share|improve this answer

You can disable IP6 for a specific device with

networksetup -setv6off Service name
(i.e  networksetup -setv6off "Ethernet 1")

and get the list of all possible services with

networksetup -listallnetworkservices

See man networksetup for more info.

I don't know if you can tell networksetup to perform the command for every interface at once, but it shouldn't be too hard to write a short script that iterates over the output of the list command and disable IP6 on all devices.

share|improve this answer
    
Yes, I have done the script and I'm able to turn ipv6 off on every device. The point is that the system itself still has ipv6 support, so ipfw takes ipv6 rules into account and so on. My goal is to make my systems totally IPV6 ignorant, is it possible? –  AlberT Oct 2 '09 at 12:23

This will disable ipv6 on all network adapters:

#!/bin/sh
IFS=$'\n'
net=`networksetup -listallnetworkservices | grep -v asterisk`

for i in $net
do
    networksetup -setv6off "$i"
done
exit 0
share|improve this answer
    
As said, I already have a script for this quite identical to the one you proposed, just more compact. Thanks –  AlberT Oct 2 '09 at 12:44
1  
Not that I know of. The kernel settings are pretty much set in stone in OS X-and even if they weren't, ipfw has ipv6 support compiled in so I don't see how you can disable it short of a recompile. –  Josh Budde Oct 2 '09 at 13:05

In reply to your comment on SvenW's answer:

My goal is to make my systems totally IPV6 ignorant, is it possible?

While IPv6 isn't used everywhere yet, it will be - maybe after a few years. So I'm guessing, and it would make sense, that IPv6 is as integrated to OS X as IPv4 was, and you would need to rebuild the kernel (and probably some applications) to remove any of them. (I don't have any sources though.)

share|improve this answer

this page looks informative. it looks like it does work if run as root. I dont feel like disabling it permanently, so I cant confirm the sysctl command.

root@Shambhala:~# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet 127.0.0.1 netmask 0xff000000 
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::21b:63ff:fea5:de87%en0 prefixlen 64 tentative scopeid 0x4 
    media: autoselect status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet 172.16.11.98 netmask 0xffffff00 broadcast 172.16.11.255
    inet6 fe80::21c:b3ff:fe77:c434%en1 prefixlen 64 tentative scopeid 0x5  
    media: autoselect status: active
    supported media: autoselect
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::276:62ff:fe00:0%vboxnet0 prefixlen 64 scopeid 0x7 
    ether 00:76:62:00:00:00 

root@Shambhala:~# ip6 -x
root@Shambhala:~# ifconfig 
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet 127.0.0.1 netmask 0xff000000 
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    media: autoselect status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet 172.16.11.98 netmask 0xffffff00 broadcast 172.16.11.255
    media: autoselect status: active
    supported media: autoselect
vboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 00:76:62:00:00:00

it looks like ipv6 stays enabled on the loopback device though...

share|improve this answer

You said ipfw takes ipv6 rules. So you can simply block ipv6 there, this happens in kernel and nothing ipv6-related will work.

share|improve this answer
    
Almost what you wanted ;) –  Gleb Oct 3 '09 at 13:38
    
I want to remove ipv6 from logs, from ipfw, from everywhere. Even for the satisfaction of knowing if and how it is possible. It is is right to do it is another issue :) –  AlberT Oct 5 '09 at 9:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.