# Disable IPv6 (globally and on an interface)



## norswap (Feb 29, 2012)

I'm running FreeBSD 9.0-RELEASE as a VirtualBox guest inside a Windows 7 host.

My network is currently configured in rc.conf as:


```
ifconfig_em0="DHCP"
ifconfig_em1="10.0.0.1 netmask 255.255.255.0"
```

em0 is a VirtualBox bridged adapter (connected to my home LAN), while em1 is a VirtualBox host-only adapter. em1 receives a link-local IPv6 address, while em0 does not.

I tried the solutions proposed in the following threads, to no avail:
http://forums.freebsd.org/showthread.php?t=29042
http://forums.freebsd.org/showthread.php?t=24326

1) How do I disable IPv6 on em1?
2) How do I disable IPv6 globally? Recompiling the kernel is not an option.
3) Why does em0 not receive a IPv6 link-local address? Does DHCP on Ipv4 disables IPv6 by default?

To give some background, I started investigating this because I received warnings at startup about ntpd which could not bind a socket on the IPv6 IP of em1. The problem seems to be gone now (I guess rebooting Windows was the cure).


----------



## OH (Mar 1, 2012)

First off, be aware that the ipv6 configuration syntax changed for 9.0, so you can't blindly apply suggestions from threads that were written for 8.x.

Second, a lot of people* prefer net/openntpd over the one that comes with the FreeBSD base, because it allows you to bind to (a) specific address(es).

*citation needed


----------



## SirDice (Mar 1, 2012)

norswap said:
			
		

> 1) How do I disable IPv6 on em1?


If it's not configured it shouldn't be enabled.


> 2) How do I disable IPv6 globally? Recompiling the kernel is not an option.




```
ipv6_network_interfaces="none"
```



> 3) Why does em0 not receive a IPv6 link-local address?


Because it's not configured.



> Does DHCP on Ipv4 disables IPv6 by default?


No, DHCP on IPv4 has nothing to do with IPv6.


----------



## norswap (Mar 1, 2012)

SirDice said:
			
		

> If it's not configured it shouldn't be enabled.



Yet, em1 is not configured to have IPv6. Or do you mean to say that "having an IPv6 link-local address" is not the same thing as "having IPv6 enabled".



			
				SirDice said:
			
		

> ```
> ipv6_network_interfaces="none"
> [/quote]
> ```
> ...


----------



## kpa (Mar 1, 2012)

Don't worry about the link local addresses. Look at the output of ifconfig(8), the IFDISABLED flag tells you that IPv6 is disabled completely on the interface.


----------



## SirDice (Mar 1, 2012)

Can you post your entire rc.conf?

If I read the scripts correctly your interface should not receive a link-local address.


----------



## norswap (Mar 1, 2012)

rc.conf

```
hostname="baalzamon"
keymap="be.iso.acc.kbd"

sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
dumpdev="AUTO"
hald_enable="YES"
dbus_enable="YES"
vboxguest_enable="YES"
vboxservice_enable="YES"

ipv6_network_interfaces="none"
ifconfig_em0="DHCP"
ifconfig_em1="10.0.0.1 netmask 255.255.255.0"
```


----------



## SirDice (Mar 2, 2012)

I'm not sure it'll work but could you try:

```
ifconfig_em1="inet 10.0.0.1 netmask 255.255.255.0"
```

Note the keyword inet.


----------



## norswap (Mar 2, 2012)

kpa said:
			
		

> Don't worry about the link local addresses. Look at the output of ifconfig(8), the IFDISABLED flag tells you that IPv6 is disabled completely on the interface.



Whoops, missed this. I do have this flag indeed. One thing puzzle me tough. Why do I get a link-local address on em1 but not on em0 ?



			
				SirDice said:
			
		

> Note the keyword inet.



Actually that's what I had before, but I changed it because I saw the form without inet online. Re-tried to make sure, but the address is still there.


----------

