1 / 28

IPv6 Application Development

IPv6 Application Development. Yukwen Hsu Group Manager Windows Division Microsoft Corporation TANET 2002 Taiwan Area Network Conference. Outline. Why IPv6 ? Technology Highlights Porting Applications Demo Q&A. Key Problems. Address Shortage Not enough IPv4 addresses available

warner
Download Presentation

IPv6 Application Development

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. IPv6 Application Development Yukwen Hsu Group Manager Windows Division Microsoft Corporation TANET 2002 Taiwan Area Network Conference

  2. Outline • Why IPv6 ? • Technology Highlights • Porting Applications • Demo • Q&A

  3. Key Problems • Address Shortage • Not enough IPv4 addresses available • Disproportionate allocation • Increasing number of devices and Always On experience exacerbate the problem • Lack of Mobility • Applications and network protocols break in mobile scenarios • Network Security • Always On == Always attacked!

  4. IPv6 – Key advantages • Global addressing: • Scaling well beyond 4 trillion public endpoints • Stateless address auto-configuration • Plug and play: • Simple instant-on ad-hoc networking • Efficient mobility: • Mobile IPv6, unlike IPv4, does not need the Foreign Agent • Secure • IPSec is a requirement and integral part of the IP layer • Link/Site Local addresses allow partitioning • Anonymous addresses ensure privacy

  5. What does it take to deploy IPv6 Platform and Infrastructure Applications Application Development Tool Support Network Infrastructure

  6. What is Microsoft Doing ? • Platform and Infrastructure • Windows XP SP1, Windows CE.NET 4.1, Windows.NET server has deployment quality IPv6 implementation • Application Development Tools • Support for native Winsock layer • RPC • .NET Frameworks and VS.NET • Applications • IE, IIS, File and Print, Media Server … • Working with 3rd party ISVs • Network Infrastructure • IPv6 islands connected to IPv4 internet (6to4, Teredo) • Gradual Migration in the enterprise (ISATAP)

  7. Key Deployment Scenarios Windows XP will automatically configure itself to handle different situations: • Internet • Native IPv6 connection from ISP • 6to4 (automatic inter-site tunnels) • Intranet • Native IPv6 routing • ISATAP (Intra-Site Automatic Tunnel Addressing Protocol) Key points: IPv6 deployment by ISPs is not required! Apps can benefit NOW

  8. IPv6 In Windows .NET Server 2003 • Easy to enable • From UI or command line (“netsh int ipv6 install”) • Support for application developers: • Provides APIs for protocol agnostic network applications • System.Net, RPC, wininet, sockets • Agnostic apps will run on legacy platforms • Developer PSS support available • Many services and applications IPv6 aware: • IE, IIS, WMS, file sharing, etc.

  9. Link-Local Global Site-Local Addressing Model • Addresses are assigned to interfaces • No change from IPv4 Model • Interface can have multiple addresses • Addresses have scope • Link Local • Site Local • Global

  10. Differences Between IPv4 and IPv6 Feature IPv4 IPv6 Address length 32 bits 128 bits IPSec support Optional Required QoS support Some Better Fragmentation Hosts and routers Hosts only Checksum in header Yes No Options in header Yes No Link-layer address resolution ARP Multicast Neighbor Discovery Messages Uses broadcasts Yes No Configuration Manual, DHCP Automatic, DHCP DNS name queries Uses A records Uses AAAA or A6 records DNS reverse queries Uses IN-ADDR.ARPA Uses IP6.INT or IP6.ARPA Minimum MTU 576 bytes 1280 bytes

  11. Porting Applications • Most applications can be written in a protocol-independent fashion • E.g., telnet client took < 2 hours to port to be protocol-independent • Use protocol-independent APIs wherever possible • System.Net, Winsock, RPC, DPlay, etc. • Upper-layer APIs/classes which don’t deal with addresses are not affected • E.g., HttpWebRequest, WebClient, etc. • ASP.NET, XML Web Services get support for free as a result

  12. The Checkv4 Utility • Parses Winsock Code for IPv4 Specific Usages • Finds Problem Areas and Suggests Changes: test.c(35) : gethostbyname : use getaddrinfo instead test.c(48) : SOCKADDR_IN : use SOCKADDR_STORAGE instead, or use SOCKADDR_IN6 in addition for IPv6 support • Located: • Platform SDK

  13. Specific things to look for • Storing IP address in Dword or 4 bytes of an array. • Use of explicit dotted decimal format in UI. • Obsolete / New: • AF_INET – replaced by AF_INET6 • SOCKADDR_IN – replaced by SOCKADDR_STORAGE • IPPROTO_IP – replaced by IPPROTO_IPV6 • IP_MULTICAST_LOOP – replaced by SIO_MULTIPOINT_LOOPBACK • gethostbyname – replaced by getaddrinfo • gethostbyaddr – replaced by getnameinfo

  14. Client apps • Resolve names before opening socket getaddrinfo(...) s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); connect(...) NOT s = socket(AF_INET, SOCK_xxx, 0); gethostbyname(...) connect(...)

  15. Using getaddrinfo() Client Side… if (getaddrinfo(server_name, port, NULL, &ai) != 0) {/* Error Handling */ } conn_socket = socket(ai->ai_family, ai->ai_socktype,0); if (conn_socket <0 ) {/* Error Handling */ } if (connect(conn_socket,ai->ai_addr,ai->ai_addrlen) == SOCKET_ERROR) {/* Error Handling */ } freeaddrinfo(ai); Server Side… hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE; retval = getaddrinfo(interface, port, &hints, &ai); if (retval != 0) { /* Error Handling */ } listen_socket = socket(ai->ai_family, ai->ai_socktype, 0); if (listen_socket == INVALID_SOCKET){/* Error Handling */ } if (bind(listen_socket,ai->ai_addr,ai->ai_addrlen )== SOCKET_ERROR) {/* Error Handling */ } freeaddrinfo(ai);

  16. IPv6 and the .NET Framework • What runs over IPv6 in the next release (1.1) ? • Sockets • DNS • HTTP • XML Web Services • Most managed apps (incl. ASP.NET, XML Web services) just work over IPv6

  17. Enabling IPv6 In The .NET Framework • After installing protocol, need to enable IPv6 for managed code through config file • Machine-wide or per-app basis <system.net> <settings> <ipv6 enabled=true/> </settings> </system.net> • Config files are in %Windir%\Framework\version\CONFIG

  18. Core Sockets Functions • Core APIs Don’t Change • Use IPv6 Family and Address Structures • .NET Socket() uses AddressFamily.InterNetwork6 • Winsock socket() Uses PF_INET6 • Functions that pass addresses, e.g.: • Socket.Bind(), bind() • Socket.Connect(), connect() • Socket.SendTo(), sendto() • Functions that return addresses, e.g.: • Socket.RecvFrom() • Socket.RemoteEndpoint, getpeername() • Socket.LocalEndpoint, getsockname()

  19. Client Apps (.NET classes) • Name Resolution - Just use Dns.Resolve(), no change • Resolve names before opening socket Dns.Resolve(...) Socket s = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp); Connect(...) NOT: Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Dns.Resolve(...) connect(...)

  20. Example Client Code – C# public Socket GetSocket(string host, int port) { Socket s = null; IPHostEntry iphe = Dns.Resolve(host); foreach(IPAddress ipa in iphe.AddressList) { IPEndPoint ipe = new IPEndPoint(ipa, port); Socket tmp = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { tmp.Connect(ipe); s = tmp; break; } catch (Exception ae) { Console.WriteLine(“Connection failed: “ + ae.ToString()); } } return s; }

  21. Other Hints • Don’t reorder addresses yourself • Dns.Resolve / getaddrinfo orders them for you • Don’t just try the first address and throw out the rest • Use/store names not addresses

  22. Server Apps • Use two listening sockets, one for IPv4, one for IPv6 • In the future, will be possible with just one • Service should start as long as either socket can be opened • Can use getaddrinfo() or WSAEnumProtocols() to enumerate

  23. IPv6 Demo Windows XP SP1 Media Series 9 (IPv6/IPv4 Host) Tablet PC, Media Series 9 (IPv6/IPv4 Host) • Win32 WinSock App • .NET Framework – Managed Socket App • .NET Framework - ASP.NET, XML Web Service • On-Demand – IIS6, Windows Media Service & Media Series 9 • Live – IIS6, Windows Media Service & Media Series 9 802.11 802.11 802.11 Ad-Hoc Network (Wireless) Windows .NET Server 2003 DNS, IIS6, Media Service, Media Series 9 (IPv6/IPv4 Host)

  24. More Resources • .NET • http://www.microsoft.com/net/ • http://www.microsoft.com/net/develop/ • http://msdn.microsoft.com/netframework/ • http://msdn.microsoft.com/vstudio/ • http://msdn.microsoft.com/newsgroups/managed/ • Win32 API • Porting Guide via MSDN or http://www.microsoft.com/ipv6 • Checkv4.exe is in MSDN • Try compiling with –DIPV6STRICT • IPv4-specific structs and apis cause errors • Public newsgroup: microsoft.public.platformsdk.networking.ipv6

  25. More Information On IPv6 • Microsoft IPv6 Web site: • http://www.microsoft.com/ipv6/ • IETF standards • IPv6 specification (ipngwg) • RFC 2460 - IPv6 protocol ftp://ftp.isi.edu/in-notes/rfc2460.txt • RFC 2463 - ICMPv6 protocol ftp://ftp.isi.edu/in-notes/rfc2463.txt • RFC 2373 - Addressing Architecture ftp://ftp.isi.edu/in-notes/rfc2373.txt • IPv6 transition tools (ipngtrans) • RFC 3056 - Connection of IPv6 Domains via IPv4 Clouds (6to4) ftp://ftp.isi.edu/in-notes/rfc3056.txt • Internet Draft - Tunneling IPv6 over UDP through NATs (Teredo) ftp://ftp.isi.edu/internet-drafts/draft-ietf-ngtrans-shipworm-05.txt • Internet Draft - Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) ftp://ftp.isi.edu/internet-drafts/draft-ietf-ngtrans-isatap-03.txt • Send feedback on Microsoft IPv6 implementation • ipv6-fb@microsoft.com

  26. Call For Action • 2003 will be a big year for IPv6! • Now is the time to • Use managed code for new applications • Port existing tools where needed • Port existing applications where needed • Plan deployments • Prepare for native IPv6 networks http://www.microsoft.com/ipv6

  27. Questions and Answers

  28. © 2002 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

More Related