Cannot create an IPv6 (alias IP) using ifconfig RHEL 4 AS/ES
Hello there,
Thank you very much for viewing this thread.
Currently I'm porting my application from Solaris 10 to RHEL 4 AS.
I'm having a problem in creating an IPv6 alias interface in the RHEL4 environment.
# uname -a
Linux harrier 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
Kernel \r on an \m
Question 1:
Why is it when using the "ifconfig" command you can successfully
create an IPv4 alias interface (Ex. eth0:1). But, when it comes to creating an IPv6 alias interface, the logical interface (Ex. eth0:10)
specified with the ifconfig command is not created.
Kindly view the execution below.
*****************************************************************
When creating an IPv4 alias IP using ifconfig
- Here the eth0:1 logical interface with the IPv4 address
192.168.30.128 is successfully created.
*****************************************************************
# ifconfig eth0:1 192.168.30.128
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:15:17:35:55:F4
inet addr:192.168.136.127 Bcast:192.168.137.255 Mask:255.255.254.0
inet6 addr: fe80::215:17ff:fe35:55f4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1071513 errors:0 dropped:0 overruns:0 frame:0
TX packets:562793 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:367872667 (350.8 MiB) TX bytes:381006432 (363.3 MiB)
Base address:0x2000 Memory:88180000-881a0000
eth0:1 Link encap:Ethernet HWaddr 00:15:17:35:55:F4
inet addr:192.168.30.128 Bcast:192.168.30.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2000 Memory:88180000-881a0000
*****************************************************************
When creating an IPv6 alias IP using ifconfig
- Here the logical interface eth0:10 is not created.
Instead the IPv6 2001:470:1f01:115::4 address is directly bounded
to eth0.
*****************************************************************
# ifconfig eth0:10 inet6 add 2001:470:1f01:115::4
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:15:17:35:55:F4
inet addr:192.168.136.127 Bcast:192.168.137.255 Mask:255.255.254.0
inet6 addr: 2001:470:1f01:115::4/0 Scope:Global
inet6 addr: fe80::215:17ff:fe35:55f4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1072665 errors:0 dropped:0 overruns:0 frame:0
TX packets:563211 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:368000764 (350.9 MiB) TX bytes:381047116 (363.3 MiB)
Base address:0x2000 Memory:88180000-881a0000
Question 2:
Are there other ways to create the logical interface for
IPv6. The way it did with ifconfig IPv4?
I also tried programming using the ioctl() with the SIOCSIFADDR request. But, the ioctl() failed and returned a perror "No such device"
************************ Code snippet ************************
int cli_LIFsd;
struct sockaddr_in6 *stSockAddr6;
cli_LIFsd = socket(AF_INET6, SOCK_STREAM, 0);
// set the logical interface name
memset (&stLIF, 0x00, sizeof (struct ifreq));
strncpy( stLIF.ifr_name, "eth0:10", sizeof( stLIF.ifr_name )); stLIF.ifr_addr.sa_family = AF_INET6;
stSockAddr6 = (struct sockaddr_in6 *)&(stLIF.ifr_addr);
inet_pton(AF_INET6, argv[1], &(stSockAddr6->sin6_addr));
rtnval = ioctl (cli_LIFsd, SIOCSIFADDR, &stLIF);
if (rtnval < 0)
{
perror("Perror message " );
printf ("Errno: %s [%d] \n", strerror( errno ), errno );
close (cli_LIFsd);
exit (1);
}
Output:
#./cli 2001:470:1f01:115::55
Perror message : No such device
Errno: Illegal seek [29]
#
Any comment or help is greatly appreciated.
Thank you very much.
Last edited by the_rock; 02-27-2008 at 01:32 AM.
Reason: Added RHEL4 version
|