IPv6 On Linux

OS: 
Function: 

 

 

Description

On some Linux distribution, IPv6 networking may be enabled by default, however, if IPv6 networking is not enabled by default the following configuration is needed to enable IPv6 networking.

Example Configurations

Enabling IPv6 on a Linux host(CentOS)

To enable IPv6 networking, the host's network configuration file needs to be edited and a network restart must be administered.

pc#vi /etc/sysconfig/network                                                 //edit network file on the host machine

NETWORKING_IPV6=yes                                              //change the  networking field from "no" to "yes"

pc#service network restart                                                    // Restart the network on the host

 

Note: When IPv6 networking is enabled IPv6, autoconfiguration is enabled by default. If you do not wish to use autoconfiguration, append the following like to /etc/sysconfig/network :

IPV6_AUTOCONF=no

Configuring Linux to forward IPv6 packets 

To configure Linux to forward IPv6 traffic issue the following commands:

sysctl -w net.ipv6.conf.all.forwarding=1
sysctl -w net.ipv6.conf.default.forwarding=1

Configuring IPv6 routing table on Linux

Adding routes:

route -A inet6 add <prefix> gw <next hop>

ip -6 route add <prefix> via <next hop>

route -A inet6 add ::/0 gw <next hop>        // Add a default (::/0) route.

ip -6 route add ::/0 via <next hop>

Showing routes:

route -A inet6

ip -6 route show dev eth0

Assigning IPv6 temporary address(privacy extensions) on a Linux host(CentOS)

To generate a privacy address and not use it as the preferred address do the following:

pc#sysctl net.ipv6.conf.all.use_tempaddr=1

pc#sysctl  net.ipv6.conf.default.use_tempaddr=1

pc#service network restart

 

To generate a privacy address and use it as the preferred address do the following: 

pc#sysctl net.ipv6.conf.all.use_tempaddr=2

pc#sysctl  net.ipv6.conf.default.use_tempaddr=2

pc#service network restart

Displaying neighbor tables 

To display neighbor tables (equivalent of IPv4 ARP tables):

ip -6 neigh show [dev <device>]