Note: This article is not about 6-to-4 tunneling. This is about carrying IPv4 and IPv6 at the same time (aka Dual Stack) over a GRE tunnel in RHEL/CentOS
I was configuring an existing GRE tunnel on my Linux router when I found that the initscripts in CentOS 5.5 didn’t support IPv6 for the tunnel devices.
The quick hack was to edit /etc/sysconfig/network-scripts/ifup-tunnel
and look for this line:
/sbin/ip link set dev "$DEVICE" up
Add these lines just after the line above:
# Added to accomodate IPv6 in tunnel
/sbin/ip addr add "$IPV6ADDR" dev "$DEVICE"
Then modify /etc/sysconfig/network-scripts/ifcfg-tun0
(or whatever your device name is) and add the following lines to run dual stack over GRE:
IPV6ADDR=2001:abcd:1a2b:3c4d::2/64
If you need to use the tunnel as an IPv6 default gateway, create /etc/sysconfig/network-scripts/route-tun0
and add an entry
::/0 via 2001:abcd:1a2b:3c4d::1/64
Then just restart the interface and bingo IPv6 and IPv4 dual stack on a GRE tunnel.