I have configured Ubuntu Linux system with the following interfaces & assigned IPV6 addresses as follows:
Eth0: Link encap:Ethernet HWaddr 00:50:56:8d:57:64
inet addr:192.168.254.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe8d:5764/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:74231424 errors:0 dropped:1 overruns:0 frame:0
TX packets:400372550 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:24514286488 (24.5 GB) TX bytes:115992171490 (115.9 GB)Eth1: Link encap:Ethernet HWaddr 00:50:56:8d:7c:4c
inet addr:192.168.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe8d:7c4c/64 Scope:Link
inet6 addr: fc00:1234:1::10/120 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:434933479 errors:0 dropped:1 overruns:0 frame:0
TX packets:39666183 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:126065364448 (126.0 GB) TX bytes:14437801257 (14.4 GB)Eth2: Link encap:Ethernet HWaddr 00:50:56:8d:56:14
inet addr:192.168.2.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fc00:1234:2::10/120 Scope:Global
inet6 addr: fe80::250:56ff:fe8d:5614/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:480068741 errors:0 dropped:0 overruns:0 frame:0
TX packets:34145702 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:146795537550 (146.7 GB) TX bytes:10045338657 (10.0 GB)I wanted to do Socket programming using IPV6 sockets. The code snippet that I have written is as follows:
struct sockaddr_in6 sin
Ipv6_fdr = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)bzero(&sin, sizeof(sin));
sin.sin6_family = AF_INET6;
sin.sin6_port = htons(2152);
if ((setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(int))) < 0)
memcpy(&(sin.sin6_addr), "fc00:1234:1::10",sizeof(sin.sin6_addr));
if ((bind(sock, (struct sockaddr*)&sin, sizeof(sin)))< 0)After successful compilation, I’m getting IPV6 bind failure Error with the following error number & name:
EADDRNOTAVAIL 99 /* Cannot assign requested address.
After certain number of attempts for IPV6 Binding it throws Segmentation Fault error.
It would be great if someone could help me on what mistake I’m doing here & why IPV6 binding is failing?
fc00:1234:1::10
, is in a reserved range that you are not allowed to use. ULA addressing is in thefc00::/7
range, but thefc00::/8
half of the range is reserved for a yet-to-be-named global authority to assign. Thefd00::/8
half of the range is open for local assignment, but you MUST use a random number generator to assign the next 40 bits in the address. You also seem to have a problem that you are not using/64
as the network size. Many things in IPv6 can fail if you use a different network size. With only a couple of exceptions, you should use/64
networks. – Ron Maupin