IPv6 configuration on Ubuntu (dapper) systems

How can I enable/disable IPv6 globally?

Ubuntu dapper default supports IPv6, so you have to do nothing to enable IPv6. If you want do disable IPv6 globally, please read our section on how to do it.

How can I enable forwarding between IPv6 enabled interfaces?

In /etc/sysctl.conf add the line

net/ipv6/conf/all/forwarding=1

and run

# sysctl -p /etc/sysctl.conf

Please note, you cannot enable/disable IPv6 forwarding per interface as in the IPv4 case. If you want to disable IPv6 forwarding for some interfaces, use netfilter/p6tables.

How can I enable/disable autoconfiguration on all interfaces?

Autoconfiguration is enabled by default. If you want to disable it for all interfaces, add the line

net/ipv6/conf/all/autoconf=0

to /etc/sysctl.conf and reload the file by sysctl as it is shown above.

How can I enable/disable router behaviour (i.e not to accept router advertisements) on all devices?

The kernel default accepts router advertisements. You can disable it on all interfaces by adding the line

net/ipv6/conf/all/accept_ra=0

to /etc/sysctl.conf and reloading it by sysctl.

How can I configure an interface statically with global IPv6 address?

Use the standard /etc/network/interfaces file on Debian/Ubuntu systems:

    iface eth0 inet6 static
        address dead:beef::1
        netmask 64

If you set your system to ignore router advertisements then you have to add a static default gateway as well:

    iface eth0 inet6 static
        address dead:beef::1
        netmask 64
        gateway dead:beef::

Please note, you cannot bring up just the IPv6 settings of an interface, so in order your changes take effect you have to issue the commands

# ifdown eth0
# ifup eth0

which first brings down IPv4 on your interface.

How can I set up a default gateway via an interface instead of an IPv6 address?

You can use the post-up and pre-down options to call ip and set the default gateway in /etc/network/interfaces:

    iface eth0 inet6 static
        address dead:beef::1
        netmask 64
        post-up ip -6 route add ::/0 dev eth0
        pre-down ip -6 route del ::/0 dev eth0

How can I setup an IPv6 over IPv4 tunnel?

This is also quite simple. In /etc/network/interfaces write

    iface eth0 inet6 v4tunnel
        address dead:beef::1
        netmask 64
        endpoint 192.168.0.1    # Address of other tunnel endpoint

Campus6: IPv6hostslinux_ubuntu (last edited 2008-04-10 15:29:34 by localhost)