Ubuntu Linux Add Static IPv6 Address Network Configuration

How do I configure static IPv6 networking under Ubuntu Linux server operating systems? How to enable IPv6 for Ubuntu Linux version 14.04 or 16.04 LTS server?

You need to simply edit /etc/network/interfaces file and add the IPv6 networking configuration. Here is our sample setup:
  • Ipv6 Address IP: 2607:f0d0:2001:000a:0000:0000:0000:0010/64
  • Ipv6 Gateway IP: 2607:f0d0:2001:000a:0000:0000:0000:0001
  • Interface name: eth0
  • IPv6 Type: Static
WARNING! These examples are not about an IPv6 tunnel broker. This tutorial requires static IPv6 address which can be obtained from your network admin or ISP. For desktop usage and testing purpose see how to setup a tunnel broker (a network tunnel over IPv4) which can encapsulated connectivity over existing IPv4 infrastructure.

Adding IPv6 To Ubuntu Systems

Open /etc/network/interfaces file, enter (first login as root):
$ sudo -s
Make a backup and edit the file:
# cp /etc/network/interfaces /etc/network/interfaces.backup
# vi /etc/network/interfaces

Append configuration as follows:

### Start IPV6 static configuration
iface eth0 inet6 static
address 2607:f0d0:2001:000a:0000:0000:0000:0010
netmask 64
gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
### END IPV6 configuration

Save and close the file. You can reboot the server or restart networking (Ubuntu server without systemd) service:
# /etc/init.d/networking restart
If you are using systemd (Ubuntu Linux 16.04 LTS server and above), enter:
# systemctl restart networking

Test IPv6 Configuration

To see your IPv6 address, enter:
# ifconfig eth0
# ip -6 address show eth0

Display kernel IPv6 routing table:
# netstat -nr -6
Ping to ipv6 enabled site such as cyberciti.biz (or ipv6.google.com):
# ping6 cyberciti.biz
Sample Output

PING cyberciti.biz(www.cyberciti.biz) 56 data bytes
64 bytes from www.cyberciti.biz: icmp_seq=1 ttl=60 time=65.3 ms
64 bytes from www.cyberciti.biz: icmp_seq=2 ttl=60 time=64.2 ms
64 bytes from www.cyberciti.biz: icmp_seq=3 ttl=60 time=63.9 ms
64 bytes from www.cyberciti.biz: icmp_seq=4 ttl=60 time=63.9 ms
64 bytes from www.cyberciti.biz: icmp_seq=5 ttl=60 time=64.1 ms
64 bytes from www.cyberciti.biz: icmp_seq=6 ttl=60 time=64.0 ms
64 bytes from www.cyberciti.biz: icmp_seq=7 ttl=60 time=64.0 ms

You can also run a traceroute:
# traceroute6 cyberciti.biz
Sample Output:

traceroute to cyberciti.biz (2607:f0d0:1002:11::4), 30 hops max, 40 byte packets
 1  ivp6gw.rose.simplyguide.org (2607:f0d0:2001:a::1)  0.739 ms  0.847 ms  0.962 ms
 2  2607.f0d0.2000.0001.0000.0000.0000.0005-static.v6reverse.softlayer.com (2607:f0d0:2000:1::5)  1.079 ms  1.197 ms  1.313 ms
 3  2607.f0d0.1000.0001.0000.0000.0000.0105-static.v6reverse.softlayer.com (2607:f0d0:1000:1::105)  64.457 ms  64.575 ms  64.691 ms
 4  2607.f0d0.1000.0001.0000.0000.0000.0056-static.v6reverse.softlayer.com (2607:f0d0:1000:1::56)  64.810 ms  64.925 ms  65.045 ms
 5  www.cyberciti.biz (2607:f0d0:1002:11::4)  67.486 ms  67.604 ms  67.719 ms

A note about IPv6 based DNS server

Edit /etc/network/interface file using a text editor and add the following line:

dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844

The Google Public DNS IPv6 addresses are used in above config file. Here is my complete listing:

Fig.01 Enable IPv6 for Ubuntu Server

Further Readings:

  1. See sample IPv6 Firewall Script for Linux iptables.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • tagno25 Jun 19, 2009 @ 3:50

    instead of typing
    ### Start IPV6 static configuration
    iface eth0 inet6 static
    pre-up modprobe ipv6
    address 2607:f0d0:2001:000a:0000:0000:0000:0010
    netmask 64
    gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
    ### END IPV6 configuration
    ### Start IPV6 static configuration
    iface eth0 inet6 static
    pre-up modprobe ipv6
    address 2607:f0d0:2001:a::10
    netmask 64
    gateway 2607:f0d0:2001:a::1
    ### END IPV6 configuration

  • Norman Apr 22, 2010 @ 7:58

    hi, after following your tutorial, this is the output that I get when I restart networking

    *Reconfiguring network interfaces…
    FATAL: Module ipv6 not found.
    Failed to bring up eth0. [OK]

    IPv4 still works fine but not v6. I have been able to add and use an IPv6 address with the ifconfig command. Also when do “lsmod | grep ip” – nothing with IPv6 is displayed. Any idea what the problem is? Using Ubuntu 9.10 Server

  • Giedrius Sep 18, 2010 @ 23:19

    IPv6 module is already built-in to kernel, no need to use modprobe ipv6 command on Ubuntu 10 anymore (probably since version 9)

  • JP Jan 21, 2011 @ 6:59

    I was getting the error “SIOCADDRT: File exists” when I tried to do a ‘networking restart’. Had to reboot the box for it to enable the static IPv6 address.

    • muruli Jun 15, 2011 @ 10:04

      please let me know, what is the configutration for dhcp ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz