How do I configure a network interface for IPv6?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6
  • IPv6

Issue

  • How do I configure a network interface for IPv6?
  • How do I configure IPv6 IP addressing?
  • How do I do basic IPv6 setup?

Resolution

  • You can configure an IPv6 interface with the /etc/sysconfig/network-scripts/ifcfg-* files just like IPv4 addresses.

  • The following parameter is needed when configuring IPv6:

IPV6INIT=yes

Address

You can add an IPv6 address with:

IPV6ADDR=<IPv6 address>[/<prefix length>]

For example:
IPV6ADDR=fe80::2/64
  • The prefix is optional.

Gateway

You can add the IPv6 gateway with:

IPV6_DEFAULTGW=<IPv6 address[%interface]>

For example:
IPV6_DEFAULTGW=fe80::1/64

Or if you want to specify the gateway interfaces as well, you can add it:

IPV6_DEFAULTGW=fe80::1/64%eth0

DNS

You add a DNS server like normal:

DNS{1,2}=<ip address>

For example:
DNS1=fe80::1/64

Further reading

These options are described in /usr/share/doc/initscripts-*/sysconfig.txt, you can search for "IPV6" to see the relevant options.

Note

We can not set the link local address of IPv6 manually.

Diagnostic Steps

  • Example of ipv6 working with ipv4 in Red Hat Enterprise Linux 7 with NetworkManager.
[root@XXXXX network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=XXXXX
DEVICE=eth0
ONBOOT=yes
DNS1=127.0.0.1
DOMAIN=XXXXX
IPV6ADDR=XXXXX
IPV6_DEFAULTGW=XXXXX
ZONE=
IPADDR=XXXXX
PREFIX=24
GATEWAY=XXXXX
IPV6_PRIVACY=no

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments