Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 68 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here




       #include <sys/socket.h>
       #include <netinet/in.h>

       tcp6_socket = socket(PF_INET6, SOCK_STREAM, 0);
       raw6_socket = socket(PF_INET6, SOCK_RAW, protocol);
       udp6_socket = socket(PF_INET6, SOCK_DGRAM, protocol);


       Linux  2.2  optionally  implements  the Internet Protocol,
       version 6.  This man page contains a  description  of  the
       IPv6  basic  API  as  implemented  by the Linux kernel and
       glibc 2.1. The interface  is  based  on  the  BSD  sockets
       interface; see socket(7).

       The  IPv6  API aims to be mostly compatible with the ip(7)
       v4 API. Only differences are described in this man page.

       To bind an  AF_INET6  socket  to  any  process  the  local
       address  should  be  copied  from the in6addr_any variable
       which  has  in6_addr  type.   In  static   initializations
       IN6ADDR_ANY_INIT may also be used, which expands to a con­
       stant expression.  Both of them are in network order.

       The IPv6 loopback address (::1) is available in the global
       in6addr_loopback     variable.     For     initializations
       IN6ADDR_LOOPBACK_INIT should be used.

       IPv4 connections can be handled with the v6 API  by  using
       the  v4-mapped-on-v6  address  type;  thus  a program only
       needs only to support this API type to support both proto­
       cols.  This  is  handled transparently by the address han­
       dling functions in libc.

       IPv4 and IPv6 share the local port space. When you get  an
       IPv4  connection  or  packet  to  a IPv6 socket its source
       address will be mapped to v6 and it'll be mapped to v6.


              struct sockaddr_in6 {
                  u_int16_t       sin6_family;/* AF_INET6 */
                  u_int16_t       sin6_port;/* port number */
                  u_int32_t       sin6_flowinfo;/* IPv6 flow information */
                  struct in6_addr sin6_addr;/* IPv6 address */
                  u_int32_t   sin6_scope_id;  /* Scope id (new in 2.4) */

              struct in6_addr {
                  unsigned char   s6_addr[16];/* IPv6 address */

       The  address  notation  for  IPv6 is a group of 16 2 digit
       hexadecimal numbers, separated with a ':'. '::' stands for
       a  string  of 0 bits.  Special addresses are ::1 for loop­
       back and ::FFFF:<IPv4 address> for IPv4-mapped-on-IPv6.

       The port space of IPv6 is shared with IPv4.


       IPv6 supports some protocol specific socket  options  that
       can be set with setsockopt(2) and read with getsockopt(2).
       The socket option  level  for  IPv6  is  IPPROTO_IPV6.   A
       boolean  integer  flag is zero when it is false, otherwise

              Set the unicast hop limit for the socket.  Argument
              is  an pointer to an integer. -1 in the value means
              use the  route  default,  otherwise  it  should  be
              between 0 and 255.

              Set  the  multicast hop limit for the socket. Argu­
              ment is a pointer to an integer. -1  in  the  value
              means use the route default, otherwise it should be
              between 0 and 255.

              Set the device for outgoing  multicast  packets  on
              the  socket.   This  is only allowed for SOCK_DGRAM
              and SOCK_RAW socket.  The argument is an pointer to
              an  interface  index (see netdevice(7)) in an inte­

              Turn an AF_INET6 socket into a socket of a  differ­
              ent  address family. Only AF_INET is currently sup­
              ported for that. It is only allowed for IPv6  sock­
              ets that are connected and bound to a v4-mapped-on-
              v6 address. The argument is a pointer to a  integer
              containing   AF_INET.    This  is  useful  to  pass
              v4-mapped sockets as  filedescriptors  to  programs
              that don't know how to deal with the IPv6 API.

              Set delivery of the IPV6_PKTINFO control message on
              incoming datagrams. Only allowed for SOCK_DGRAM  or
              SOCK_RAW  sockets.  Argument  is  a  pointer  to  a
              boolean value in an integer.

              is a pointer to a boolean value.

              Control whether the socket sees  multicast  packets
              that  is has send itself.  Argument is a pointer to

              Control membership in multicast groups. Argument is
              a pointer to a struct ipv6_mreq structure.

              Set  the  MTU to be used for the socket. The MTU is
              limited by the device MTU or the path mtu when path
              mtu discovery is enabled.  Argument is a pointer to

              Control path  mtu  discovery  on  the  socket.  See
              IP_MTU_DISCOVER in ip(7) for details.

              Control  receiving  of  asynchronous error options.
              See IP_RECVERR in ip(7) for details.  Argument is a
              pointer to boolean.

              Pass  all  forwarded  packets  containing an router
              alert option to  this  socket.   Only  allowed  for
              datagram sockets and for root. Argument is a point­
              er to boolean.


       The older libinet6 libc5 based IPv6 API implementation for
       Linux is not described here and may vary in details.

       Linux  2.4 will break binary compatibility for the sockad­
       dr_in6 for  64bit  hosts  by  changing  the  alignment  of
       in6_addr and adding an additional sin6_scope_id field. The
       kernel interfaces stay compatible, but a program including
       sockaddr_in6 or in6_addr into other structures may not be.
       This is not a problem for 32bit hosts like i386.

       The sin6_flowinfo field is new in Linux 2.4. It is  trans­
       parently passed/read by the kernel when the passed address
       length contains it. Some programs that pass a  longer  ad­
       dress  buffer  and  then check the outgoing address length
       may break.


       The sockaddr_in6 structure  is  bigger  than  the  generic
       sockaddr.  Programs that assume that all address types can
       This man page is not complete.


       ip(7), cmsg(3)

       RFC2553:  IPv6  BASIC  API. Linux tries to be compliant to

       RFC2460: IPv6 specification.

Linux Man Page              1999-06-29                    IPV6(7)



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial can use your help.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.04 Seconds