Brian Coleman

  • Home
  • ABOUT
  • SERVICES
  • PORTFOLIO
  • BLOG
  • Contact

Tutorial: How to test your app for IPv6 compatibility

At WWDC 2015 Apple announced the transition to IPv6-only network services in iOS 9. Starting June 1, 2016 all apps submitted to the App Store must support IPv6-only networking. Most apps will not require any changes because IPv6 is already supported by NSURLSession and CFNetwork APIs.

If your app uses IPv4-specific APIs or hard-coded IP addresses, you will need to make some changes.

What is IPv6?

IPv6 is short for “Internet Protocol Version 6”. IPv6 is the Internet’s next-generation protocol, designed to replace the current Internet Protocol, IP Version 4.
In order to communicate over the Internet, computers and other devices must have sender and receiver addresses. These numeric addresses are known as Internet Protocol addresses. As the Internet and the number of people using it grows exponentially, so does the need for IP addresses.

IPv6 allows more users and devices to communicate on the Internet by using bigger numbers to create IP addresses. Under IPv4, every IP address is 32 bits long, which allows 4.3 billion unique addresses. An example IPv4 address is:

172.16.254.1

In comparison, IPv6 addresses are 128 bits, which allow for approximately three hundred and forty trillion, trillion unique IP addresses. An example IPv6 address is:

2001:db8:ffff:1:201:02ff:fe03:0405

Enabling IPv6 test network from your Mac

One of the hidden features of OS X El Capitan is the ability to enable Internet Sharing to provide only IPv6 addresses. This feature was added to El Capitan to help developers ensure their apps are ready to work with IPv6. It uses NAT64, which facilitates communication between IPv6 and IPv4 hosts by using a form of NAT.

  1. Boot OS X 10.11
  2. Make sure your Mac is connected to the Internet, but not through Wi-Fi.
  3. Launch System Preferences from your Dock, LaunchPad, or the Apple menu.
  4. Press the Option key and click Sharing. Don’t release the Option key yet.
    systempreferences_sharing_2x

  5. Select Internet Sharing in the list of sharing services.
    systempreferences_sharing_internetsharing_2x

  6. Release the Option key.
  7. Select the Create NAT64 Network checkbox.
    systempreferences_sharing_internetsharing_ipv6_2x

  8. Choose the network interface that provides your Internet connection, such as Thunderbolt Ethernet.
    systempreferences_sharing_internetsharing_connection_2x

  9. Select the Wi-Fi checkbox.
    systempreferences_sharing_internetsharing_ports_2x

  10. Click Wi-Fi Options, and configure the network name and security options for your network.
    systempreferences_sharing_internetsharing_wi-fioptions_button_2x

  11. Setting up local Wi-Fi network options
    systempreferences_sharing_internetsharing_wi-fioptions

  12. Select the Internet Sharing checkbox to enable your local network.
    systempreferences_sharing_internetsharing_sharingenabled_2x

  13. When prompted to confirm you want to begin sharing, click Start.
    systempreferences_sharing_internetsharing_enabledconfirmation

  14. Once sharing is active, you should see a green status light and a label that says Internet Sharing: On. In the Wi-Fi menu, you will also see a small, faint arrow pointing up, indicating that Internet Sharing is enabled. You now have an IPv6 NAT64 network and can connect to it from other devices in order to test your app.
    internet_sharing_wi-fi_menu_2x

Important: To ensure that testing takes place strictly on the local IPv6 network, make sure your test devices don’t have other active network interfaces. For example, if you are testing with an iOS device, make sure cellular service is disabled so you are only testing over Wi-Fi.

To test your IPv6 connectivity, you can visit Test your IPv6.

Testing Your App on the IPv6 Network

By enabling Create IPv6 Only Network, Internet Sharing will set up the following:

DNS64
NAT64

Use the NAT64 Network for app testing.

Make NAT64 testing part of your regular development process.

What breaks?

IPv4-only storage objects
IPv4-only APIs
IPv4-only usage of an API

Pre-Flight checks before connecting

– Checking to see if a device has an IPv4 address
– Checking to see if a device has a 0.0.0.0 address

Address-family agnostic code

Connect without preflight
– If connection succeeds, great
– If connection doesn’t succeed, handle the failure gracefully

Use higher-level networking frameworks
– NSURLSession and CFNetwork-layer APIs

RFC 4038 “Application Aspects of IPv6 Transition”
Connect-by-name APIs – Use DNS hostnames wherever possible instead of IP addresses.

IPv4 literals in NAT64+DNS64 networks

New for 10.11 and iOS 9

Use higher-level networking frameworks
– NSURLSession and CFNetwork-layer APIs

Client supplies IPv4 address Literal
– OS synthesizes IPv6 address

Tutorial: Testing SSL using Charles Proxy on an iOS DeviceClassix for iPhone, iPad & Apple TV
Brian Coleman

Manager, Mobile Development at Rogers Communications with over 15 years of multifaceted experience including development, design, business analysis and project management working directly with clients in a consulting capacity throughout the full software life cycle.

May 6, 2016 News, Tutorialsios9, IPv6, tutorial
Follow Me
    
Categories
  • About Me
  • Frameworks
  • My Apps
  • News
  • Strategy
  • Swift
  • Tools
  • Tutorials
  • tvOS
  • Uncategorized
  • Videos
  • Watch
Archives
  • May 2016
  • January 2016
  • October 2015
  • July 2015
  • May 2015
  • April 2015
  • March 2015
  • November 2014
  • October 2014
  • September 2014
  • July 2014
  • June 2014
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
Recent Posts
  • Classix for iPhone, iPad & Apple TV
  • Tutorial: How to test your app for IPv6 compatibility
  • Tutorial: Testing SSL using Charles Proxy on an iOS Device
  • Tutorial: 3D Touch – Quick Actions in Swift
  • tvOS Tutorial: Top Shelf in Swift
Featured Apps
Classix
Sportsnet
TAGS
tutorialswiftios8iosobjective-cvideogamesstrategynewsframeworkappsmonitizefacebookwatchappleios7toolstvosios9apiprovisionsocialtutorialsbooksdesignbookiapIPv6iTunes Connect
Search
TAGS
tutorialswiftios8iosobjective-cvideogamesstrategynewsframeworkappsmonitizefacebookwatchappleios7toolstvosios9apiprovisionsocialtutorialsbooksdesignbookiapIPv6iTunes Connect
ABOUT
Brian is a Lead iOS/tvOS Developer from Toronto with over 18 years of multifaceted experience including development, design, business analysis and project management.

FOLLOW ME
    
Email Subscription
Sign up for my newsletter to receive the latest news and tutorials posted.

Enter your email address:

2023 © Brian Coleman