Red Hat Networking - Can't send IPv6 packets over local n/w

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat Networking > July 2005 > Can't send IPv6 packets over local n/w





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Can't send IPv6 packets over local n/w
vinod.k.d

2005-07-21, 2:52 am

Hi,
This this my first time with IPv6 programming. I connected two
linux PCs using UTP cables and configured IPv4 and IPv6 on both
machines. The ip settings are:

ifconfig on Machine 1:

eth0 Link encap:Ethernet HWaddr 00:B0:D0:48:D9:71
inet addr:10.232.40.51 Bcast:10.232.40.255
Mask:255.255.255.0
inet6 addr: fe80::2b0:d0ff:fe48:d971/64 Scope:Link

Machine 2:

eth0 Link encap:Ethernet HWaddr 00:0D:56:07:4C:64
inet addr:10.232.40.153 Bcast:10.232.40.255
Mask:255.255.255.0
inet6 addr: fe80::20d:56ff:fe07:4c64/64 Scope:Link

IPv4 working perfectly but there are some problems with IPv6.
I can ping the machine 1 from 2 using "ping6 -I eth0
fe80::2b0:d0ff:fe48:d971" . But, when writing programs I can't
connect to server on machine 1 using IPv6 socket. AF_INET6 socket
creation is OK. But connect method fails and returns error "Network
is unreachable" . IPv4 mapped IPv6 address of machine 1 and Loopback
addresses (both IPv4 & IPv4 mapped IPv6) are working fine. The
problem is "I can't sent IPv6 packets over the network".

(my code, with minimum set of statements, is given below. I used
getaddrinfo also. It is also giving same result.)


struct sockaddr_in6 ai_addr;
int sockfd=-1;
char *hostname;

hostname=argv[1];

inet_pton(AF_INET6,hostname,&ai_addr.sin6_addr);
ai_addr.sin6_port = htons(5555);
ai_addr.sin6_family = AF_INET6;

sockfd = socket(AF_INET6,SOCK_STREAM,IPPROTO_TCP)
;

if (!(sockfd < 0))
if (connect(sockfd,(struct sockaddr
*)&ai_addr,sizeof(struct sockaddr_in6) ) ==
0)
printf("\nsuccess\n");
else
{
perror("connect");
close(sockfd);
sockfd=-1;
}


The execution instances and their results are:

[root@pc4051 dt6]# ./myclient ::ffff:127.0.0.1
success

[root@pc4051 dt6]# ./myclient ::1
success

[root@localhost dt6]# ./myclient ::ffff:10.232.40.51
success

[root@localhost dt6]# ./myclient fe80::2b0:d0ff:fe48:d971
connect: Network is unreachable

Please help me?

vinod.k.d

2005-07-21, 2:52 am

Hello all,
I found out the problem... lack of global IPv6 address..
u can set it by using
ifconfig <interface> inet6 add <ipv6 address>

example:
ifconfig eth0 inet6 add 3ffe:ffff:0:f101::1/64

Thanks
Vinod

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com