IP v6 on RHEL5

Monday, November 22, 2010 |


Yes..! We are running short in V4 IP addresses. Here explains a way to configure ipv6 on your RHEL box.

1. Operating System Version should be RHEL 5 or higher

[bbaby@blackbox ~]$ more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
[bbaby@basilvm ~]$ uname -r
2.6.18-164.11.1.el5
[bbaby@blackbox ~]$

(kernel subversion (3rd field) must be 15 or higher)

2. Confirm IPv6 is running

modprobe will check whether ipv6 module is loaded to kernel or not. FATAL error is expected.

[root@blackbox ~]# modprobe --dry-run --first-time ipv6
FATAL: Module ipv6 already in kernel.
[root@blackbox ~]#

Make sure that interface is enabled with ipv6

[root@blackbox ~]# cat /proc/net/if_inet6
00000000000000000000000000000001 01 80 10 80 lo
fe8000000000000002163efffe528f78 03 40 20 80 eth0

[root@blackbox ~]# grep NETWORKING_IPV6 /etc/sysconfig/network
NETWORKING_IPV6=yes
[root@blackbox ~]#


2a. Check interfaces

# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:16:3E:52:8F:78
inet addr:192.168.200.206 Bcast:192.168.200.255 Mask:255.255.255.0 inet6 addr: Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:14363 errors:0 dropped:0 overruns:0 frame:0
TX packets:1302 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21384433 (20.3 MiB) TX bytes:118347 (115.5 KiB)
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)
sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)


In this example, there is only one physical interface, eth0. In Red Hat Linux, there will be a file /etc/sysconfig/networking-scripts/ifcfg- for each interface. This file will have directives that control the interface configuration:

3. Determine the IPv6 subnet address based on the router advertisement


The router advertisement on this segment is 2001:558:ff40::. This information will be used to compose the static IPv6 address. The algorithm to create an IPv6 address from an IPv4 address is simple (in my network). Take the currently assigned IPv4 address for the device in question and make them the last four entries of the IPv6 address.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BROADCAST=192.168.200.255
HWADDR=00:16:3E:52:8F:78
IPADDR=192.168.200.206
NETMASK=255.255.255.0
NETWORK=192.168.200.0
ONBOOT=yes

3. Determine the IPv6 subnet address based on the router advertisement


# netstat -A inet6 -rn





The router advertisement on this segment is 2001:558:ff40::. This information will be used to compose the static IPv6 address. The  algorithm used here to create an IPv6 address from an IPv4 address is simple. Take the currently assigned IPv4 address for the device in question and make them the last four entries of the IPv6 address.

If there is no IPv6 router advertisement on the segment, there is no way to guarantee what the specific subnet will be. The global IPv6 address prefix for my network  is 2001:558. The next two groups of the IPv6 address are the subnet prefix and are completely dependent on the router configuration. If this command reveals no IPv6 router advertisement, there is no mechanized way to create the IPv6 address.

 

4. Confirm the IPv4 address of the interface that will have a static IPv6 address
 
From the output in step 2, the IPv4 address of eth0 is 192.168.200.206

5. Construct the basic IPv6 address from the router advertisement and the IPv4 address

 
A full static IPv6 address is now created by putting the global address, subnet, and IPv4 address together. Our guideline for creating an IPv6 address from an IPv4 address is very mechanical. Recall that an IPv6 address consists of eight groups of four hexidecimal digits. The eight groups are populated from left to right as follows. The first two groups of four are the  global IPv6 address (2001:0558). The next two groups of four digits are created from the router advertisement determined in section 3. The final four groups of four digits are populated directly from the IPv4 address as straight numbers.
 

Please note that there is no direct binary or decimal or hexidecimal translation involved in this population. Each one of the four IPv4 address numbers becomes one of the final four groups of the IPv6 address in decending order. In this example, the IPv4 address of 192.168.200.206 transposes into the full IPv6 address of:2001:558:ff40::192:168:200:206
The subnet length should always be a /64, so the full IPv6 address becomes: 2001:558:ff40::192:168:200:206/64


This will become the static IPv6 address assigned to the chosen interface. See RFC4291 for full details on IPv6 address formats. One might note that the IPv4 address numbers are decimal representations of hexidecimal digits and that the IPv6 address numbers are actual hexidecimal digits.

6. Assign the IPv6 address to the chosen interface.


The static IPv6 information needs to be added to the file ifcfg-. The address composed in step 5 must be added as "IPV6ADDR=". Further, the directive "IPV6INIT=yes" must be added to the file to ensure the This may be manually edited or executed from the command line:

echo 'IPV6ADDR=2001:558:FF40::192:168:200:206/64'  >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo 'IPV6INIT=yes' >> /etc/sysconfig/network-scripts/ifcfg-eth0


6.a. Confirm the contents of the ifcfg- file

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 

BROADCAST=192.168.200.255
HWADDR=00:16:3E:52:8F:78
IPADDR=192.168.200.206
NETMASK=255.255.255.0
NETWORK=192.168.200.0
ONBOOT=yes
IPV6ADDR=2001:558:FF40::192:168:200:206/64
IPV6INIT=yes


7. Bringing up the static IPv6 address without rebooting

 
Since Red Hat should already have IPv6 services running, adding the static IPv6 interface without rebooting is straightforward

# ifconfig eth0 inet6 add 2001:558:FF40::192:168:200:206/64
# ifconfig eth0 eth0
Link encap:Ethernet HWaddr 00:16:3E:52:8F:78
inet addr:192.168.200.206 Bcast:192.168.200.255 Mask:255.255.255.0 inet6 addr: 2001:558:ff40:0:192:168:200:206/64 Scope:Global inet6 addr: fe80::216:3eff:fe52:8f78/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:827 errors:0 dropped:0 overruns:0 frame:0 TX packets:677 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:86866 (84.8 KiB) TX bytes:92325 (90.1 KiB)


8. Confirmation of IPv6 connectivity

 
A simple IPv6 ping test of a valid IPv6 address will confirm whether IPv6 is working; e.g.

# ping6 -c 1 2001:558:ff40::192:168:200:200 

PING 2001:558:ff40::192:168:200:200(2001:558:ff40:0:192:168:200:200) 56 data bytes 64 bytes from 2001:558:ff40:0:192:168:200:200: icmp_seq=0 ttl=255 time=0.614 ms
--- 2001:558:ff40::192:168:200:200 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.614/0.614/0.614/0.000 ms, pipe 2







Image Courtesy           : http://isoc.org/wp/ietfjournal/?p=151
ipv6 training courtesy         : Tom Creighton  

0 comments:

Post a Comment