1 / 34

Socket Programming with IPv6

Socket Programming with IPv6. Why IPv6?. Addressing and routing scalability Address space exhaustion Host autoconfiguration QoS of flow using flowlabel Mobile IP Multicast routing IP Security End to end semantics. IPv6 Design Issues. Overcome IPv4 scaling problem

oki
Download Presentation

Socket Programming with IPv6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Socket Programming with IPv6

  2. Why IPv6? • Addressing and routing scalability • Address space exhaustion • Host autoconfiguration • QoS of flow using flowlabel • Mobile IP • Multicast routing • IP Security • End to end semantics

  3. IPv6 Design Issues • Overcome IPv4 scaling problem • lack of address space. • Flexible transition mechanism. • New routing capabilities. • Quality of service. • Security. • Ability to add features in the future.

  4. IPv6 Headers • Simpler header - faster processing by routers. • No optional fields - fixed size (40 bytes) • No fragmentation fields. • No checksum • Support for multiple headers • more flexible than simple “protocol” field.

  5. VERS HL Service Fragment Length Datagram ID FLAG Fragment Offset TTL Protocol Header Checksum Source Address Destination Address Options (if any) Data IPv4 Header 1 byte 1 byte 1 byte 1 byte

  6. Source Address (128 bits - 16 bytes) Dest. Address (128 bits - 16 bytes) IPv6 Header 1 byte 1 byte 1 byte 1 byte VERS PRIO Flow Label Payload Length Next Header Hop Limit

  7. IPv6 Header Fields • VERS: 6 (IP version number) • Priority: will be used in congestion control • Flow Label: experimental - sender can label a sequence of packets as being in the same flow. • Payload Length: number of bytes in everything following the 40 byte header, or 0 for a Jumbogram.

  8. IPv6 Header Fields • Next Header is similar to the IPv4 “protocol” field - indicates what type of header follows the IPv6 header. • Hop Limit is similar to the IPv4 TTL. Netprog: IPv6

  9. Extension Headers • Routing Header - source routing • Fragmentation Header - supports fragmentation of IPv6 datagrams. • Authentication Header • Encapsulating Security Payload Header

  10. IPv6 Addresses • 128 bits - written as eight 16-bit hex numbers. 5f1b:df00:ce3e:e200:0020:0800:2078:e3e3 • High order bits determine the type of address. Netprog: IPv6

  11. IPv6 Addressing • The following address classes are defined • Unspecified: :: • Loopback: :1 • Multicast: FF0x: • Link-local: FE80: • Site-local: FE40: • Rest are Unicast and anycast addresses • Unicast address composed of prefix and MAC address

  12. IPv6 Addressing

  13. 3 13 32 16 64 IPv6 Aggregate Global Unicast Address 001 TLA ID NLA ID SLA ID Interface ID TLA: top-level aggregation NLA: next-level SLA: site-level Interface ID is (typically) based on hardware MAC address

  14. IPv4-Mapped IPv6 Address • IPv4-Mapped addresses allow a host that support both IPv4 and IPv6 to communicate with a host that supports only IPv4. • The IPv6 address is based completely on the IPv4 address. Netprog: IPv6

  15. IPv4-Mapped IPv6 Address • 80 bits of 0s followed by 16 bits of ones, followed by a 32 bit IPv4 Address: 0000 . . . 0000 FFFF IPv4 Address 80 bits 16 bits 32 bits Netprog: IPv6

  16. Works with DNS • An IPv6 application asks DNS for the address of a host, but the host only has an IPv4 address. • DNS creates the IPv4-Mapped IPv6 address automatically. • Kernel understands this is a special address and really uses IPv4 communication. Netprog: IPv6

  17. IPv4-Compatible IPv6 Address • An IPv4 compatible address allows a host supporting IPv6 to talk IPv6 even if the local router(s) don’t talk IPv6. • IPv4 compatible addresses tell endpoint software to create a tunnel by encapsulating the IPv6 packet in an IPv4 packet. • No longer in use. Deprecated. Netprog: IPv6

  18. IPv4-Compatible IPv6 Address • 80 bits of 0s followed by 16 bits of 0s, followed by a 32 bit IPv4 Address: 0000 . . . 0000 0000 IPv4 Address 80 bits 16 bits 32 bits Netprog: IPv6

  19. Tunneling(done automatically by kernel when IPv4-Compatible IPv6 addresses used) IPv6 Host IPv6 Host IPv4 Routers IPv4 Datagram IPv6 Datagram

  20. IPv6 Sockets programming • New address family: AF_INET6 • New address data type: in6_addr • New address structure: sockaddr_in6 • DNS lookup: getaddrinfo()

  21. in6_addr struct in6_addr { uint8_t s6_addr[16]; }; Netprog: IPv6

  22. sockaddr_in6 struct sockaddr_in6 { uint8_t sin6_len; sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; }; Netprog: IPv6

  23. Dual Server • In the future it will be important to create servers that handle both IPv4 and IPv6. • The work is handled by the O.S. (which contains protocol stacks for both v4 and v6): • automatic creation of IPv6 address from an IPv4 client (IPv4-mapped IPv6 address). Netprog: IPv6

  24. IPv4 client IPv6 client TCP TCP IPv4 IPv4 IPv6 IPv6 Datalink Datalink IPv6 server IPv4-mapped IPv6 address TCP Datalink Netprog: IPv6

  25. IPv6 Clients • If an IPv6 client specifies an IPv4 address for the server, the kernel detects and talks IPv4 to the server. • DNS support for IPv6 addresses can make everything work. • getaddrinfo() returns an IPv4 mapped IPv6 address for hosts that only support IPv4.

  26. IPv6 - IPv4 Programming • The kernel does the work, we can assume we are talking IPv6 to everyone! • In case we really want to know, there are some macros that determine the type of an IPv6 address. • We can find out if we are talking to an IPv4 client or server by checking whether the address is an IPv4 mapped address.

  27. Ipv4, Ipv6 Compatibility • Introduction • IPv4 Client, IPv6 Server • IPv6 Client, IPv4 Server

  28. Introduction • Server and client combination • IPv4 <=> IPv4(most server and client) • IPv4 <=> IPv6 • IPv6 <=> IPv4 • IPv6 <=> IPv6 • How IPv4 application and IPv6 application can communicate with each other. • Host are running dual stacks, both an IPv4 protocol stack and IPv6 protocol stack

  29. IPv4 Client , IPv6 Server • IPv6 dual stack server can handle both IPv4 and IPv6 clients. • This is done using IPv4-mapped IPv6 address • server create an IPv6 listening socket that is bound to the IPv6 wildcard address

  30. IPv6 server IPv6 client IPv4 client IPv6 listening socket, bound to 0::0, port 8888 TCP TCP TCP IPv6 address IPv4 mapped IPv6 address IPv6 IPv4 IPv4 IPv6 206.62.226.42 5flb:df00:ce3e:e200:20:800:2b37:6426 Data link Data link Data link Enet hdr IPv4 hdr TCP hdr TCP data Type0800 Dport 8888 TCP hdr TCP data Enet hdr IPv4 hdr Type0800 Dport 8888

  31. AF_INET SOCK_DGRAM sockaddr_in AF_INET SOCK_STREAM sockaddr_in IPv4 sockets AF_INET6 SOCK_DGRAM sockaddr_in6 AF_INET6 SOCK_DGRAM sockaddr_in6 IPv6 sockets UDP TCP IPv4 mapped IPv4 IPv6 Address returned by accept or recvfrom IPv4 IPv6 IPv4 datagram IPv6 datagram

  32. IPv6 client, IPv4 server • IPv4 server start on an IPv4 only host and create an IPv4 listening socket • IPv6 client start, call gethostbyname. IPv4 mapped IPv6 address is returned. • Using IPv4 datagram

  33. AF_INET SOCK_DGRAM sockaddr_in AF_INET SOCK_STREAM sockaddr_in IPv4 sockets AF_INET6 SOCK_DGRAM sockaddr_in6 AF_INET6 SOCK_DGRAM sockaddr_in6 IPv6 sockets UDP TCP IPv6 IPv4 mapped IPv4 IPv6 Address for connect or sendto IPv4 IPv6 IPv4 datagram IPv6 datagram

  34. Summary of interoperability between IPv4 and IPv6 clients and servers.

More Related