1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597
|
<pre>Internet Engineering Task Force (IETF) A. Keranen
Request for Comments: 8445 C. Holmberg
Obsoletes: <a href="./rfc5245">5245</a> Ericsson
Category: Standards Track J. Rosenberg
ISSN: 2070-1721 jdrosen.net
July 2018
<span class="h1">Interactive Connectivity Establishment (ICE):</span>
<span class="h1">A Protocol for Network Address Translator (NAT) Traversal</span>
Abstract
This document describes a protocol for Network Address Translator
(NAT) traversal for UDP-based communication. This protocol is called
Interactive Connectivity Establishment (ICE). ICE makes use of the
Session Traversal Utilities for NAT (STUN) protocol and its
extension, Traversal Using Relay NAT (TURN).
This document obsoletes <a href="./rfc5245">RFC 5245</a>.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc7841#section-2">Section 2 of RFC 7841</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc8445">https://www.rfc-editor.org/info/rfc8445</a>.
<span class="grey">Keranen, et al. Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
This document may contain material from IETF Documents or IETF
Contributions published or made publicly available before November
10, 2008. The person(s) controlling the copyright in some of this
material may not have granted the IETF Trust the right to allow
modifications of such material outside the IETF Standards Process.
Without obtaining an adequate license from the person(s) controlling
the copyright in such materials, this document may not be modified
outside the IETF Standards Process, and derivative works of it may
not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other
than English.
<span class="grey">Keranen, et al. Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-2">2</a>. Overview of ICE . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<a href="#section-2.1">2.1</a>. Gathering Candidates . . . . . . . . . . . . . . . . . . <a href="#page-8">8</a>
<a href="#section-2.2">2.2</a>. Connectivity Checks . . . . . . . . . . . . . . . . . . . <a href="#page-10">10</a>
<a href="#section-2.3">2.3</a>. Nominating Candidate Pairs and Concluding ICE . . . . . . <a href="#page-12">12</a>
<a href="#section-2.4">2.4</a>. ICE Restart . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-2.5">2.5</a>. Lite Implementations . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-3">3</a>. ICE Usage . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-4">4</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-13">13</a>
<a href="#section-5">5</a>. ICE Candidate Gathering and Exchange . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-5.1">5.1</a>. Full Implementation . . . . . . . . . . . . . . . . . . . <a href="#page-17">17</a>
<a href="#section-5.1.1">5.1.1</a>. Gathering Candidates . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-5.1.1.1">5.1.1.1</a>. Host Candidates . . . . . . . . . . . . . . . . . <a href="#page-18">18</a>
<a href="#section-5.1.1.2">5.1.1.2</a>. Server-Reflexive and Relayed Candidates . . . . . <a href="#page-20">20</a>
<a href="#section-5.1.1.3">5.1.1.3</a>. Computing Foundations . . . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-5.1.1.4">5.1.1.4</a>. Keeping Candidates Alive . . . . . . . . . . . . <a href="#page-21">21</a>
<a href="#section-5.1.2">5.1.2</a>. Prioritizing Candidates . . . . . . . . . . . . . . . <a href="#page-22">22</a>
<a href="#section-5.1.2.1">5.1.2.1</a>. Recommended Formula . . . . . . . . . . . . . . . <a href="#page-22">22</a>
5.1.2.2. Guidelines for Choosing Type and Local
Preferences . . . . . . . . . . . . . . . . . . . <a href="#page-23">23</a>
<a href="#section-5.1.3">5.1.3</a>. Eliminating Redundant Candidates . . . . . . . . . . <a href="#page-23">23</a>
<a href="#section-5.2">5.2</a>. Lite Implementation Procedures . . . . . . . . . . . . . <a href="#page-23">23</a>
<a href="#section-5.3">5.3</a>. Exchanging Candidate Information . . . . . . . . . . . . <a href="#page-24">24</a>
<a href="#section-5.4">5.4</a>. ICE Mismatch . . . . . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#section-6">6</a>. ICE Candidate Processing . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#section-6.1">6.1</a>. Procedures for Full Implementation . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#section-6.1.1">6.1.1</a>. Determining Role . . . . . . . . . . . . . . . . . . <a href="#page-26">26</a>
<a href="#section-6.1.2">6.1.2</a>. Forming the Checklists . . . . . . . . . . . . . . . <a href="#page-28">28</a>
<a href="#section-6.1.2.1">6.1.2.1</a>. Checklist State . . . . . . . . . . . . . . . . . <a href="#page-28">28</a>
<a href="#section-6.1.2.2">6.1.2.2</a>. Forming Candidate Pairs . . . . . . . . . . . . . <a href="#page-28">28</a>
<a href="#section-6.1.2.3">6.1.2.3</a>. Computing Pair Priority and Ordering Pairs . . . <a href="#page-31">31</a>
<a href="#section-6.1.2.4">6.1.2.4</a>. Pruning the Pairs . . . . . . . . . . . . . . . . <a href="#page-31">31</a>
<a href="#section-6.1.2.5">6.1.2.5</a>. Removing Lower-Priority Pairs . . . . . . . . . . <a href="#page-31">31</a>
<a href="#section-6.1.2.6">6.1.2.6</a>. Computing Candidate Pair States . . . . . . . . . <a href="#page-32">32</a>
<a href="#section-6.1.3">6.1.3</a>. ICE State . . . . . . . . . . . . . . . . . . . . . . <a href="#page-36">36</a>
<a href="#section-6.1.4">6.1.4</a>. Scheduling Checks . . . . . . . . . . . . . . . . . . <a href="#page-36">36</a>
<a href="#section-6.1.4.1">6.1.4.1</a>. Triggered-Check Queue . . . . . . . . . . . . . . <a href="#page-36">36</a>
<a href="#section-6.1.4.2">6.1.4.2</a>. Performing Connectivity Checks . . . . . . . . . <a href="#page-36">36</a>
<a href="#section-6.2">6.2</a>. Lite Implementation Procedures . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7">7</a>. Performing Connectivity Checks . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7.1">7.1</a>. STUN Extensions . . . . . . . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7.1.1">7.1.1</a>. PRIORITY . . . . . . . . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7.1.2">7.1.2</a>. USE-CANDIDATE . . . . . . . . . . . . . . . . . . . . <a href="#page-38">38</a>
<a href="#section-7.1.3">7.1.3</a>. ICE-CONTROLLED and ICE-CONTROLLING . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-7.2">7.2</a>. STUN Client Procedures . . . . . . . . . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-7.2.1">7.2.1</a>. Creating Permissions for Relayed Candidates . . . . . <a href="#page-39">39</a>
<span class="grey">Keranen, et al. Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<a href="#section-7.2.2">7.2.2</a>. Forming Credentials . . . . . . . . . . . . . . . . . <a href="#page-39">39</a>
<a href="#section-7.2.3">7.2.3</a>. Diffserv Treatment . . . . . . . . . . . . . . . . . <a href="#page-40">40</a>
<a href="#section-7.2.4">7.2.4</a>. Sending the Request . . . . . . . . . . . . . . . . . <a href="#page-40">40</a>
<a href="#section-7.2.5">7.2.5</a>. Processing the Response . . . . . . . . . . . . . . . <a href="#page-40">40</a>
<a href="#section-7.2.5.1">7.2.5.1</a>. Role Conflict . . . . . . . . . . . . . . . . . . <a href="#page-40">40</a>
<a href="#section-7.2.5.2">7.2.5.2</a>. Failure . . . . . . . . . . . . . . . . . . . . . <a href="#page-41">41</a>
<a href="#section-7.2.5.2.1">7.2.5.2.1</a>. Non-Symmetric Transport Addresses . . . . . . <a href="#page-41">41</a>
<a href="#section-7.2.5.2.2">7.2.5.2.2</a>. ICMP Error . . . . . . . . . . . . . . . . . <a href="#page-41">41</a>
<a href="#section-7.2.5.2.3">7.2.5.2.3</a>. Timeout . . . . . . . . . . . . . . . . . . . <a href="#page-41">41</a>
<a href="#section-7.2.5.2.4">7.2.5.2.4</a>. Unrecoverable STUN Response . . . . . . . . . <a href="#page-41">41</a>
<a href="#section-7.2.5.3">7.2.5.3</a>. Success . . . . . . . . . . . . . . . . . . . . . <a href="#page-42">42</a>
<a href="#section-7.2.5.3.1">7.2.5.3.1</a>. Discovering Peer-Reflexive Candidates . . . . <a href="#page-42">42</a>
<a href="#section-7.2.5.3.2">7.2.5.3.2</a>. Constructing a Valid Pair . . . . . . . . . . <a href="#page-43">43</a>
<a href="#section-7.2.5.3.3">7.2.5.3.3</a>. Updating Candidate Pair States . . . . . . . <a href="#page-44">44</a>
<a href="#section-7.2.5.3.4">7.2.5.3.4</a>. Updating the Nominated Flag . . . . . . . . . <a href="#page-44">44</a>
<a href="#section-7.2.5.4">7.2.5.4</a>. Checklist State Updates . . . . . . . . . . . . . <a href="#page-44">44</a>
<a href="#section-7.3">7.3</a>. STUN Server Procedures . . . . . . . . . . . . . . . . . <a href="#page-45">45</a>
<a href="#section-7.3.1">7.3.1</a>. Additional Procedures for Full Implementations . . . <a href="#page-45">45</a>
<a href="#section-7.3.1.1">7.3.1.1</a>. Detecting and Repairing Role Conflicts . . . . . <a href="#page-46">46</a>
<a href="#section-7.3.1.2">7.3.1.2</a>. Computing Mapped Addresses . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-7.3.1.3">7.3.1.3</a>. Learning Peer-Reflexive Candidates . . . . . . . <a href="#page-47">47</a>
<a href="#section-7.3.1.4">7.3.1.4</a>. Triggered Checks . . . . . . . . . . . . . . . . <a href="#page-47">47</a>
<a href="#section-7.3.1.5">7.3.1.5</a>. Updating the Nominated Flag . . . . . . . . . . . <a href="#page-49">49</a>
<a href="#section-7.3.2">7.3.2</a>. Additional Procedures for Lite Implementations . . . <a href="#page-49">49</a>
<a href="#section-8">8</a>. Concluding ICE Processing . . . . . . . . . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-8.1">8.1</a>. Procedures for Full Implementations . . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-8.1.1">8.1.1</a>. Nominating Pairs . . . . . . . . . . . . . . . . . . <a href="#page-50">50</a>
<a href="#section-8.1.2">8.1.2</a>. Updating Checklist and ICE States . . . . . . . . . . <a href="#page-51">51</a>
<a href="#section-8.2">8.2</a>. Procedures for Lite Implementations . . . . . . . . . . . <a href="#page-52">52</a>
<a href="#section-8.3">8.3</a>. Freeing Candidates . . . . . . . . . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-8.3.1">8.3.1</a>. Full Implementation Procedures . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-8.3.2">8.3.2</a>. Lite Implementation Procedures . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-9">9</a>. ICE Restarts . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-53">53</a>
<a href="#section-10">10</a>. ICE Option . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-54">54</a>
<a href="#section-11">11</a>. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-54">54</a>
<a href="#section-12">12</a>. Data Handling . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-55">55</a>
<a href="#section-12.1">12.1</a>. Sending Data . . . . . . . . . . . . . . . . . . . . . . <a href="#page-55">55</a>
<a href="#section-12.1.1">12.1.1</a>. Procedures for Lite Implementations . . . . . . . . <a href="#page-56">56</a>
<a href="#section-12.2">12.2</a>. Receiving Data . . . . . . . . . . . . . . . . . . . . . <a href="#page-56">56</a>
<a href="#section-13">13</a>. Extensibility Considerations . . . . . . . . . . . . . . . . <a href="#page-57">57</a>
<a href="#section-14">14</a>. Setting Ta and RTO . . . . . . . . . . . . . . . . . . . . . <a href="#page-57">57</a>
<a href="#section-14.1">14.1</a>. General . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-57">57</a>
<a href="#section-14.2">14.2</a>. Ta . . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-58">58</a>
<a href="#section-14.3">14.3</a>. RTO . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-58">58</a>
<a href="#section-15">15</a>. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-59">59</a>
<a href="#section-15.1">15.1</a>. Example with IPv4 Addresses . . . . . . . . . . . . . . <a href="#page-60">60</a>
<a href="#section-15.2">15.2</a>. Example with IPv6 Addresses . . . . . . . . . . . . . . <a href="#page-65">65</a>
<span class="grey">Keranen, et al. Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<a href="#section-16">16</a>. STUN Extensions . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-69">69</a>
<a href="#section-16.1">16.1</a>. Attributes . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-69">69</a>
<a href="#section-16.2">16.2</a>. New Error-Response Codes . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-17">17</a>. Operational Considerations . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-17.1">17.1</a>. NAT and Firewall Types . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-17.2">17.2</a>. Bandwidth Requirements . . . . . . . . . . . . . . . . . <a href="#page-70">70</a>
<a href="#section-17.2.1">17.2.1</a>. STUN and TURN Server-Capacity Planning . . . . . . . <a href="#page-71">71</a>
<a href="#section-17.2.2">17.2.2</a>. Gathering and Connectivity Checks . . . . . . . . . <a href="#page-71">71</a>
<a href="#section-17.2.3">17.2.3</a>. Keepalives . . . . . . . . . . . . . . . . . . . . . <a href="#page-72">72</a>
<a href="#section-17.3">17.3</a>. ICE and ICE-Lite . . . . . . . . . . . . . . . . . . . . <a href="#page-72">72</a>
<a href="#section-17.4">17.4</a>. Troubleshooting and Performance Management . . . . . . . <a href="#page-72">72</a>
<a href="#section-17.5">17.5</a>. Endpoint Configuration . . . . . . . . . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-18">18</a>. IAB Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-18.1">18.1</a>. Problem Definition . . . . . . . . . . . . . . . . . . . <a href="#page-73">73</a>
<a href="#section-18.2">18.2</a>. Exit Strategy . . . . . . . . . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#section-18.3">18.3</a>. Brittleness Introduced by ICE . . . . . . . . . . . . . <a href="#page-74">74</a>
<a href="#section-18.4">18.4</a>. Requirements for a Long-Term Solution . . . . . . . . . <a href="#page-75">75</a>
<a href="#section-18.5">18.5</a>. Issues with Existing NAPT Boxes . . . . . . . . . . . . <a href="#page-75">75</a>
<a href="#section-19">19</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-76">76</a>
<a href="#section-19.1">19.1</a>. IP Address Privacy . . . . . . . . . . . . . . . . . . . <a href="#page-76">76</a>
<a href="#section-19.2">19.2</a>. Attacks on Connectivity Checks . . . . . . . . . . . . . <a href="#page-77">77</a>
<a href="#section-19.3">19.3</a>. Attacks on Server-Reflexive Address Gathering . . . . . <a href="#page-80">80</a>
<a href="#section-19.4">19.4</a>. Attacks on Relayed Candidate Gathering . . . . . . . . . <a href="#page-80">80</a>
<a href="#section-19.5">19.5</a>. Insider Attacks . . . . . . . . . . . . . . . . . . . . <a href="#page-81">81</a>
<a href="#section-19.5.1">19.5.1</a>. STUN Amplification Attack . . . . . . . . . . . . . <a href="#page-81">81</a>
<a href="#section-20">20</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-82">82</a>
<a href="#section-20.1">20.1</a>. STUN Attributes . . . . . . . . . . . . . . . . . . . . <a href="#page-82">82</a>
<a href="#section-20.2">20.2</a>. STUN Error Responses . . . . . . . . . . . . . . . . . . <a href="#page-82">82</a>
<a href="#section-20.3">20.3</a>. ICE Options . . . . . . . . . . . . . . . . . . . . . . <a href="#page-82">82</a>
<a href="#section-21">21</a>. Changes from <a href="./rfc5245">RFC 5245</a> . . . . . . . . . . . . . . . . . . . . <a href="#page-83">83</a>
<a href="#section-22">22</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-84">84</a>
<a href="#section-22.1">22.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-84">84</a>
<a href="#section-22.2">22.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-85">85</a>
<a href="#appendix-A">Appendix A</a>. Lite and Full Implementations . . . . . . . . . . . <a href="#page-89">89</a>
<a href="#appendix-B">Appendix B</a>. Design Motivations . . . . . . . . . . . . . . . . . <a href="#page-90">90</a>
<a href="#appendix-B.1">B.1</a>. Pacing of STUN Transactions . . . . . . . . . . . . . . . <a href="#page-90">90</a>
<a href="#appendix-B.2">B.2</a>. Candidates with Multiple Bases . . . . . . . . . . . . . <a href="#page-92">92</a>
B.3. Purpose of the Related-Address and Related-Port
Attributes . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-94">94</a>
<a href="#appendix-B.4">B.4</a>. Importance of the STUN Username . . . . . . . . . . . . . <a href="#page-95">95</a>
<a href="#appendix-B.5">B.5</a>. The Candidate Pair Priority Formula . . . . . . . . . . . <a href="#page-96">96</a>
<a href="#appendix-B.6">B.6</a>. Why Are Keepalives Needed? . . . . . . . . . . . . . . . <a href="#page-96">96</a>
<a href="#appendix-B.7">B.7</a>. Why Prefer Peer-Reflexive Candidates? . . . . . . . . . . <a href="#page-97">97</a>
<a href="#appendix-B.8">B.8</a>. Why Are Binding Indications Used for Keepalives? . . . . <a href="#page-97">97</a>
<a href="#appendix-B.9">B.9</a>. Selecting Candidate Type Preference . . . . . . . . . . . <a href="#page-97">97</a>
<a href="#appendix-C">Appendix C</a>. Connectivity-Check Bandwidth . . . . . . . . . . . . <a href="#page-99">99</a>
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-100">100</a>
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-100">100</a>
<span class="grey">Keranen, et al. Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
Protocols establishing communication sessions between peers typically
involve exchanging IP addresses and ports for the data sources and
sinks. However, this poses challenges when operated through Network
Address Translators (NATs) [<a href="./rfc3235" title=""Network Address Translator (NAT)-Friendly Application Design Guidelines"">RFC3235</a>]. These protocols also seek to
create a data flow directly between participants, so that there is no
application-layer intermediary between them. This is done to reduce
data latency, decrease packet loss, and reduce the operational costs
of deploying the application. However, this is difficult to
accomplish through NATs. A full treatment of the reasons for this is
beyond the scope of this specification.
Numerous solutions have been defined for allowing these protocols to
operate through NATs. These include Application Layer Gateways
(ALGs), the Middlebox Control Protocol [<a href="./rfc3303" title=""Middlebox communication architecture and framework"">RFC3303</a>], the original Simple
Traversal of UDP Through NAT (STUN) specification [<a href="./rfc3489" title=""STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs)"">RFC3489</a>] (note
that <a href="./rfc3489">RFC 3489</a> has been obsoleted by <a href="./rfc5389">RFC 5389</a>), and Realm Specific IP
[<a href="./rfc3102" title=""Realm Specific IP: Framework"">RFC3102</a>] [<a href="./rfc3103" title=""Realm Specific IP: Protocol Specification"">RFC3103</a>] along with session description extensions needed
to make them work, such as the Session Description Protocol (SDP)
attribute [<a href="./rfc4566" title=""SDP: Session Description Protocol"">RFC4566</a>] for the Real-Time Control Protocol (RTCP)
[<a href="./rfc3605" title=""Real Time Control Protocol (RTCP) attribute in Session Description Protocol (SDP)"">RFC3605</a>]. Unfortunately, these techniques all have pros and cons
that make each one optimal in some network topologies, but a poor
choice in others. The result is that administrators and implementers
are making assumptions about the topologies of the networks in which
their solutions will be deployed. This introduces complexity and
brittleness into the system.
This specification defines Interactive Connectivity Establishment
(ICE) as a technique for NAT traversal for UDP-based data streams
(though ICE has been extended to handle other transport protocols,
such as TCP [<a href="./rfc6544" title=""TCP Candidates with Interactive Connectivity Establishment (ICE)"">RFC6544</a>]). ICE works by exchanging a multiplicity of IP
addresses and ports, which are then tested for connectivity by
peer-to-peer connectivity checks. The IP addresses and ports are
exchanged using ICE-usage-specific mechanisms (e.g., in an Offer/
Answer exchange), and the connectivity checks are performed using
STUN [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>]. ICE also makes use of Traversal Using Relay around
NAT (TURN) [<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>], an extension to STUN. Because ICE exchanges a
multiplicity of IP addresses and ports for each media stream, it also
allows for address selection for multihomed and dual-stack hosts.
For this reason, <a href="./rfc5245">RFC 5245</a> [<a href="./rfc5245" title=""Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols"">RFC5245</a>] deprecated the solutions
previously defined in <a href="./rfc4091">RFC 4091</a> [<a href="./rfc4091" title=""The Alternative Network Address Types (ANAT) Semantics for the Session Description Protocol (SDP) Grouping Framework"">RFC4091</a>] and <a href="./rfc4092">RFC 4092</a> [<a href="./rfc4092" title=""Usage of the Session Description Protocol (SDP) Alternative Network Address Types (ANAT) Semantics in the Session Initiation Protocol (SIP)"">RFC4092</a>].
<a href="#appendix-B">Appendix B</a> provides background information and motivations regarding
the design decisions that were made when designing ICE.
<span class="grey">Keranen, et al. Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Overview of ICE</span>
In a typical ICE deployment, there are two endpoints (ICE agents)
that want to communicate. Note that ICE is not intended for NAT
traversal for the signaling protocol, which is assumed to be provided
via another mechanism. ICE assumes that the agents are able to
establish a signaling connection between each other.
Initially, the agents are ignorant of their own topologies. In
particular, the agents may or may not be behind NATs (or multiple
tiers of NATs). ICE allows the agents to discover enough information
about their topologies to potentially find one or more paths by which
they can establish a data session.
Figure 1 shows a typical ICE deployment. The agents are labeled L
and R. Both L and R are behind their own respective NATs, though
they may not be aware of it. The type of NAT and its properties are
also unknown. L and R are capable of engaging in a candidate
exchange process, whose purpose is to set up a data session between L
and R. Typically, this exchange will occur through a signaling
server (e.g., a SIP proxy).
In addition to the agents, a signaling server, and NATs, ICE is
typically used in concert with STUN or TURN servers in the network.
Each agent can have its own STUN or TURN server, or they can be the
same.
+---------+
+--------+ |Signaling| +--------+
| STUN | |Server | | STUN |
| Server | +---------+ | Server |
+--------+ / \ +--------+
/ \
/ \
/ <- Signaling -> \
/ \
+--------+ +--------+
| NAT | | NAT |
+--------+ +--------+
/ \
/ \
+-------+ +-------+
| Agent | | Agent |
| L | | R |
+-------+ +-------+
Figure 1: ICE Deployment Scenario
<span class="grey">Keranen, et al. Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The basic idea behind ICE is as follows: each agent has a variety of
candidate transport addresses (combination of IP address and port for
a particular transport protocol, which is always UDP in this
specification) it could use to communicate with the other agent.
These might include:
o A transport address on a directly attached network interface
o A translated transport address on the public side of a NAT (a
"server-reflexive" address)
o A transport address allocated from a TURN server (a "relayed
address")
Potentially, any of L's candidate transport addresses can be used to
communicate with any of R's candidate transport addresses. In
practice, however, many combinations will not work. For instance, if
L and R are both behind NATs, their directly attached interface
addresses are unlikely to be able to communicate directly (this is
why ICE is needed, after all!). The purpose of ICE is to discover
which pairs of addresses will work. The way that ICE does this is to
systematically try all possible pairs (in a carefully sorted order)
until it finds one or more that work.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Gathering Candidates</span>
In order to execute ICE, an ICE agent identifies and gathers one or
more address candidates. A candidate has a transport address -- a
combination of IP address and port for a particular transport
protocol (with only UDP specified here). There are different types
of candidates; some are derived from physical or logical network
interfaces, and others are discoverable via STUN and TURN.
The first category of candidates are those with a transport address
obtained directly from a local interface. Such a candidate is called
a "host candidate". The local interface could be Ethernet or Wi-Fi,
or it could be one that is obtained through a tunnel mechanism, such
as a Virtual Private Network (VPN) or Mobile IP (MIP). In all cases,
such a network interface appears to the agent as a local interface
from which ports (and thus candidates) can be allocated.
Next, the agent uses STUN or TURN to obtain additional candidates.
These come in two flavors: translated addresses on the public side of
a NAT (server-reflexive candidates) and addresses on TURN servers
(relayed candidates). When TURN servers are utilized, both types of
candidates are obtained from the TURN server. If only STUN servers
are utilized, only server-reflexive candidates are obtained from
them. The relationship of these candidates to the host candidate is
<span class="grey">Keranen, et al. Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
shown in Figure 2. In this figure, both types of candidates are
discovered using TURN. In the figure, the notation X:x means IP
address X and UDP port x.
To Internet
|
|
| /------------ Relayed
Y:y | / Address
+--------+
| |
| TURN |
| Server |
| |
+--------+
|
|
| /------------ Server
X1':x1'|/ Reflexive
+------------+ Address
| NAT |
+------------+
|
| /------------ Local
X:x |/ Address
+--------+
| |
| Agent |
| |
+--------+
Figure 2: Candidate Relationships
When the agent sends a TURN Allocate request from IP address and port
X:x, the NAT (assuming there is one) will create a binding X1':x1',
mapping this server-reflexive candidate to the host candidate X:x.
Outgoing packets sent from the host candidate will be translated by
the NAT to the server-reflexive candidate. Incoming packets sent to
the server-reflexive candidate will be translated by the NAT to the
host candidate and forwarded to the agent. The host candidate
associated with a given server-reflexive candidate is the "base".
Note: "Base" refers to the address an agent sends from for a
particular candidate. Thus, as a degenerate case, host candidates
also have a base, but it's the same as the host candidate.
<span class="grey">Keranen, et al. Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
When there are multiple NATs between the agent and the TURN server,
the TURN request will create a binding on each NAT, but only the
outermost server-reflexive candidate (the one nearest the TURN
server) will be discovered by the agent. If the agent is not behind
a NAT, then the base candidate will be the same as the server-
reflexive candidate, and the server-reflexive candidate is redundant
and will be eliminated.
The Allocate request then arrives at the TURN server. The TURN
server allocates a port y from its local IP address Y, and generates
an Allocate response, informing the agent of this relayed candidate.
The TURN server also informs the agent of the server-reflexive
candidate, X1':x1', by copying the source transport address of the
Allocate request into the Allocate response. The TURN server acts as
a packet relay, forwarding traffic between L and R. In order to send
traffic to L, R sends traffic to the TURN server at Y:y, and the TURN
server forwards that to X1':x1', which passes through the NAT where
it is mapped to X:x and delivered to L.
When only STUN servers are utilized, the agent sends a STUN Binding
request [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>] to its STUN server. The STUN server will inform
the agent of the server-reflexive candidate X1':x1' by copying the
source transport address of the Binding request into the Binding
response.
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Connectivity Checks</span>
Once L has gathered all of its candidates, it orders them by highest-
to-lowest priority and sends them to R over the signaling channel.
When R receives the candidates from L, it performs the same gathering
process and responds with its own list of candidates. At the end of
this process, each ICE agent has a complete list of both its
candidates and its peer's candidates. It pairs them up, resulting in
candidate pairs. To see which pairs work, each agent schedules a
series of connectivity checks. Each check is a STUN request/response
transaction that the client will perform on a particular candidate
pair by sending a STUN request from the local candidate to the remote
candidate.
The basic principle of the connectivity checks is simple:
1. Sort the candidate pairs in priority order.
2. Send checks on each candidate pair in priority order.
3. Acknowledge checks received from the other agent.
<span class="grey">Keranen, et al. Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
With both agents performing a check on a candidate pair, the result
is a 4-way handshake:
L R
- -
STUN request -> \ L's
<- STUN response / check
<- STUN request \ R's
STUN response -> / check
Figure 3: Basic Connectivity Check
It is important to note that STUN requests are sent to and from the
exact same IP addresses and ports that will be used for data (e.g.,
RTP, RTCP, or other protocols). Consequently, agents demultiplex
STUN and data using the contents of the packets rather than the port
on which they are received.
Because a STUN Binding request is used for the connectivity check,
the STUN Binding response will contain the agent's translated
transport address on the public side of any NATs between the agent
and its peer. If this transport address is different from that of
other candidates the agent already learned, it represents a new
candidate (peer-reflexive candidate), which then gets tested by ICE
just the same as any other candidate.
Because the algorithm above searches all candidate pairs, if a
working pair exists, the algorithm will eventually find it no matter
what order the candidates are tried in. In order to produce faster
(and better) results, the candidates are sorted in a specified order.
The resulting list of sorted candidate pairs is called the
"checklist".
The agent works through the checklist by sending a STUN request for
the next candidate pair on the list periodically. These are called
"ordinary checks". When a STUN transaction succeeds, one or more
candidate pairs will become so-called "valid pairs" and will be added
to a candidate-pair list called the "valid list".
As an optimization, as soon as R gets L's check message, R schedules
a connectivity-check message to be sent to L on the same candidate
pair. This is called a "triggered check", and it accelerates the
process of finding valid pairs.
At the end of this handshake, both L and R know that they can send
(and receive) messages end to end in both directions.
<span class="grey">Keranen, et al. Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
In general, the priority algorithm is designed so that candidates of
a similar type get similar priorities so that more direct routes
(that is, routes without data relays or NATs) are preferred over
indirect routes (routes with data relays or NATs). Within those
guidelines, however, agents have a fair amount of discretion about
how to tune their algorithms.
A data stream might consist of multiple components (pieces of a data
stream that require their own set of candidates, e.g., RTP and RTCP).
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Nominating Candidate Pairs and Concluding ICE</span>
ICE assigns one of the ICE agents in the role of the controlling
agent, and the other in the role of the controlled agent. For each
component of a data stream, the controlling agent nominates a valid
pair (from the valid list) to be used for data. The exact timing of
the nomination is based on local policy.
When nominating, the controlling agent lets the checks continue until
at least one valid pair for each component of a data stream is found,
and then it picks a valid pair and sends a STUN request on that pair,
using an attribute to indicate to the controlled peer that it has
been nominated. This is shown in Figure 4.
L R
- -
STUN request -> \ L's
<- STUN response / check
<- STUN request \ R's
STUN response -> / check
STUN request + attribute -> \ L's
<- STUN response / check
Figure 4: Nomination
Once the controlled agent receives the STUN request with the
attribute, it will check (unless the check has already been done) the
same pair. If the transactions above succeed, the agents will set
the nominated flag for the pairs and will cancel any future checks
for that component of the data stream. Once an agent has set the
nominated flag for each component of a data stream, the pairs become
the selected pairs. After that, only the selected pairs will be used
for sending and receiving data associated with that data stream.
<span class="grey">Keranen, et al. Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="section-2.4" href="#section-2.4">2.4</a>. ICE Restart</span>
Once ICE is concluded, it can be restarted at any time for one or all
of the data streams by either ICE agent. This is done by sending
updated candidate information indicating a restart.
<span class="h3"><a class="selflink" id="section-2.5" href="#section-2.5">2.5</a>. Lite Implementations</span>
Certain ICE agents will always be connected to the public Internet
and have a public IP address at which it can receive packets from any
correspondent. To make it easier for these devices to support ICE,
ICE defines a special type of implementation called "lite" (in
contrast to the normal full implementation). Lite agents only use
host candidates and do not generate connectivity checks or run state
machines, though they need to be able to respond to connectivity
checks.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. ICE Usage</span>
This document specifies generic use of ICE with protocols that
provide means to exchange candidate information between ICE agents.
The specific details (i.e., how to encode candidate information and
the actual candidate exchange process) for different protocols using
ICE (referred to as "using protocol") are described in separate usage
documents.
One mechanism that allows agents to exchange candidate information is
the utilization of Offer/Answer semantics (which are based on
[<a href="./rfc3264" title=""An Offer/Answer Model with Session Description Protocol (SDP)"">RFC3264</a>]) as part of the SIP protocol [<a href="./rfc3261" title=""SIP: Session Initiation Protocol"">RFC3261</a>] [<a href="#ref-ICE-SIP-SDP">ICE-SIP-SDP</a>].
[<a id="ref-RFC7825">RFC7825</a>] defines an ICE usage for the Real-Time Streaming Protocol
(RTSP). Note, however, that the ICE usage is based on <a href="./rfc5245">RFC 5245</a>.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
<a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>] [<a href="./rfc8174" title=""Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"">RFC8174</a>] when, and only when, they appear in all
capitals, as shown here.
Readers need to be familiar with the terminology defined in [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>]
and NAT Behavioral requirements for UDP [<a href="./rfc4787" title=""Network Address Translation (NAT) Behavioral Requirements for Unicast UDP"">RFC4787</a>].
<span class="grey">Keranen, et al. Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
This specification makes use of the following additional terminology:
ICE Session: An ICE session consists of all ICE-related actions
starting with the candidate gathering, followed by the
interactions (candidate exchange, connectivity checks,
nominations, and keepalives) between the ICE agents until all the
candidates are released or an ICE restart is triggered.
ICE Agent, Agent: An ICE agent (sometimes simply referred to as an
"agent") is the protocol implementation involved in the ICE
candidate exchange. There are two agents involved in a typical
candidate exchange.
Initiating Peer, Initiating Agent, Initiator: An initiating agent is
an ICE agent that initiates the ICE candidate exchange process.
Responding Peer, Responding Agent, Responder: A responding agent is
an ICE agent that receives and responds to the candidate exchange
process initiated by the initiating agent.
ICE Candidate Exchange, Candidate Exchange: The process where ICE
agents exchange information (e.g., candidates and passwords) that
is needed to perform ICE. Offer/Answer with SDP encoding
[<a href="./rfc3264" title=""An Offer/Answer Model with Session Description Protocol (SDP)"">RFC3264</a>] is one example of a protocol that can be used for
exchanging the candidate information.
Peer: From the perspective of one of the ICE agents in a session,
its peer is the other agent. Specifically, from the perspective
of the initiating agent, the peer is the responding agent. From
the perspective of the responding agent, the peer is the
initiating agent.
Transport Address: The combination of an IP address and the
transport protocol (such as UDP or TCP) port.
Data, Data Stream, Data Session: When ICE is used to set up data
sessions, the data is transported using some protocol. Media is
usually transported over RTP, composed of a stream of RTP packets.
Data session refers to data packets that are exchanged between the
peer on the path created and tested with ICE.
Candidate, Candidate Information: A transport address that is a
potential point of contact for receipt of data. Candidates also
have properties -- their type (server reflexive, relayed, or
host), priority, foundation, and base.
<span class="grey">Keranen, et al. Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Component: A component is a piece of a data stream. A data stream
may require multiple components, each of which has to work in
order for the data stream as a whole to work. For RTP/RTCP data
streams, unless RTP and RTCP are multiplexed in the same port,
there are two components per data stream -- one for RTP, and one
for RTCP. A component has a candidate pair, which cannot be used
by other components.
Host Candidate: A candidate obtained by binding to a specific port
from an IP address on the host. This includes IP addresses on
physical interfaces and logical ones, such as ones obtained
through VPNs.
Server-Reflexive Candidate: A candidate whose IP address and port
are a binding allocated by a NAT for an ICE agent after it sends a
packet through the NAT to a server, such as a STUN server.
Peer-Reflexive Candidate: A candidate whose IP address and port are
a binding allocated by a NAT for an ICE agent after it sends a
packet through the NAT to its peer.
Relayed Candidate: A candidate obtained from a relay server, such as
a TURN server.
Base: The transport address that an ICE agent sends from for a
particular candidate. For host, server-reflexive, and peer-
reflexive candidates, the base is the same as the host candidate.
For relayed candidates, the base is the same as the relayed
candidate (i.e., the transport address used by the TURN server to
send from).
Related Address and Port: A transport address related to a
candidate, which is useful for diagnostics and other purposes. If
a candidate is server or peer reflexive, the related address and
port is equal to the base for that server or peer-reflexive
candidate. If the candidate is relayed, the related address and
port are equal to the mapped address in the Allocate response that
provided the client with that relayed candidate. If the candidate
is a host candidate, the related address and port is identical to
the host candidate.
Foundation: An arbitrary string used in the freezing algorithm to
group similar candidates. It is the same for two candidates that
have the same type, base IP address, protocol (UDP, TCP, etc.),
and STUN or TURN server. If any of these are different, then the
foundation will be different.
<span class="grey">Keranen, et al. Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Local Candidate: A candidate that an ICE agent has obtained and may
send to its peer.
Remote Candidate: A candidate that an ICE agent received from its
peer.
Default Destination/Candidate: The default destination for a
component of a data stream is the transport address that would be
used by an ICE agent that is not ICE aware. A default candidate
for a component is one whose transport address matches the default
destination for that component.
Candidate Pair: A pair containing a local candidate and a remote
candidate.
Check, Connectivity Check, STUN Check: A STUN Binding request for
the purpose of verifying connectivity. A check is sent from the
base of the local candidate to the remote candidate of a candidate
pair.
Checklist: An ordered set of candidate pairs that an ICE agent will
use to generate checks.
Ordinary Check: A connectivity check generated by an ICE agent as a
consequence of a timer that fires periodically, instructing it to
send a check.
Triggered Check: A connectivity check generated as a consequence of
the receipt of a connectivity check from the peer.
Valid Pair: A candidate pair whose local candidate equals the mapped
address of a successful connectivity-check response and whose
remote candidate equals the destination address to which the
connectivity-check request was sent.
Valid List: An ordered set of candidate pairs for a data stream that
have been validated by a successful STUN transaction.
Checklist Set: The ordered list of all checklists. The order is
determined by each ICE usage.
Full Implementation: An ICE implementation that performs the
complete set of functionality defined by this specification.
<span class="grey">Keranen, et al. Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Lite Implementation: An ICE implementation that omits certain
functions, implementing only as much as is necessary for a peer
that is not a lite implementation to gain the benefits of ICE.
Lite implementations do not maintain any of the state machines and
do not generate connectivity checks.
Controlling Agent: The ICE agent that nominates a candidate pair.
In any session, there is always one controlling agent and one
controlled agent.
Controlled Agent: The ICE agent that waits for the controlling agent
to nominate a candidate pair.
Nomination: The process of the controlling agent indicating to the
controlled agent which candidate pair the ICE agents will use for
sending and receiving data. The nomination process defined in
this specification was referred to as "regular nomination" in <a href="./rfc5245">RFC</a>
<a href="./rfc5245">5245</a>. The nomination process that was referred to as "aggressive
nomination" in <a href="./rfc5245">RFC 5245</a> has been deprecated in this specification.
Nominated, Nominated Flag: Once the nomination of a candidate pair
has succeeded, the candidate pair has become nominated, and the
value of its nominated flag is set to true.
Selected Pair, Selected Candidate Pair: The candidate pair used for
sending and receiving data for a component of a data stream is
referred to as the "selected pair". Before selected pairs have
been produced for a data stream, any valid pair associated with a
component of a data stream can be used for sending and receiving
data for the component. Once there are nominated pairs for each
component of a data stream, the nominated pairs become the
selected pairs for the data stream. The candidates associated
with the selected pairs are referred to as "selected candidates".
Using Protocol, ICE Usage: The protocol that uses ICE for NAT
traversal. A usage specification defines the protocol-specific
details on how the procedures defined here are applied to that
protocol.
Timer Ta: The timer for generating new STUN or TURN transactions.
Timer RTO (Retransmission Timeout): The retransmission timer for a
given STUN or TURN transaction.
<span class="grey">Keranen, et al. Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. ICE Candidate Gathering and Exchange</span>
As part of ICE processing, both the initiating and responding agents
gather candidates, prioritize and eliminate redundant candidates, and
exchange candidate information with the peer as defined by the using
protocol (ICE usage). Specifics of the candidate-encoding mechanism
and the semantics of candidate information exchange is out of scope
of this specification.
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Full Implementation</span>
<span class="h4"><a class="selflink" id="section-5.1.1" href="#section-5.1.1">5.1.1</a>. Gathering Candidates</span>
An ICE agent gathers candidates when it believes that communication
is imminent. An initiating agent can do this based on a user
interface cue or on an explicit request to initiate a session. Every
candidate has a transport address. It also has a type and a base.
Four types are defined and gathered by this specification -- host
candidates, server-reflexive candidates, peer-reflexive candidates,
and relayed candidates. The server-reflexive candidates are gathered
using STUN or TURN, and relayed candidates are obtained through TURN.
Peer-reflexive candidates are obtained in later phases of ICE, as a
consequence of connectivity checks.
The process for gathering candidates at the responding agent is
identical to the process for the initiating agent. It is RECOMMENDED
that the responding agent begin this process immediately on receipt
of the candidate information, prior to alerting the user of the
application associated with the ICE session.
<span class="h5"><a class="selflink" id="section-5.1.1.1" href="#section-5.1.1.1">5.1.1.1</a>. Host Candidates</span>
Host candidates are obtained by binding to ports on an IP address
attached to an interface (physical or virtual, including VPN
interfaces) on the host.
For each component of each data stream the ICE agent wishes to use,
the agent SHOULD obtain a candidate on each IP address that the host
has, with the exceptions listed below. The agent obtains each
candidate by binding to a UDP port on the specific IP address. A
host candidate (and indeed every candidate) is always associated with
a specific component for which it is a candidate.
Each component has an ID assigned to it, called the "component ID".
For RTP/RTCP data streams, unless both RTP and RTCP are multiplexed
in the same UDP port (RTP/RTCP multiplexing), the RTP itself has a
component ID of 1, and RTCP has a component ID of 2. In case of RTP/
RTCP multiplexing, a component ID of 1 is used for both RTP and RTCP.
<span class="grey">Keranen, et al. Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
When candidates are obtained, unless the agent knows for sure that
RTP/RTCP multiplexing will be used (i.e., the agent knows that the
other agent also supports, and is willing to use, RTP/RTCP
multiplexing), or unless the agent only supports RTP/RTCP
multiplexing, the agent MUST obtain a separate candidate for RTCP.
If an agent has obtained a candidate for RTCP, and ends up using RTP/
RTCP multiplexing, the agent does not need to perform connectivity
checks on the RTCP candidate. Absence of a component ID 2 as such
does not imply use of RTCP/RTP multiplexing, as it could also mean
that RTCP is not used.
If an agent is using separate candidates for RTP and RTCP, it will
end up with 2*K host candidates if an agent has K IP addresses.
Note that the responding agent, when obtaining its candidates, will
typically know if the other agent supports RTP/RTCP multiplexing, in
which case it will not need to obtain a separate candidate for RTCP.
However, absence of a component ID 2 as such does not imply use of
RTCP/RTP multiplexing, as it could also mean that RTCP is not used.
The use of multiple components, other than for RTP/RTCP streams, is
discouraged as it increases the complexity of ICE processing. If
multiple components are needed, the component IDs SHOULD start with 1
and increase by 1 for each component.
The base for each host candidate is set to the candidate itself.
The host candidates are gathered from all IP addresses with the
following exceptions:
o Addresses from a loopback interface MUST NOT be included in the
candidate addresses.
o Deprecated IPv4-compatible IPv6 addresses [<a href="./rfc4291" title=""IP Version 6 Addressing Architecture"">RFC4291</a>] and IPv6 site-
local unicast addresses [<a href="./rfc3879" title=""Deprecating Site Local Addresses"">RFC3879</a>] MUST NOT be included in the
address candidates.
o IPv4-mapped IPv6 addresses SHOULD NOT be included in the address
candidates unless the application using ICE does not support IPv4
(i.e., it is an IPv6-only application [<a href="./rfc4038" title=""Application Aspects of IPv6 Transition"">RFC4038</a>]).
o If gathering one or more host candidates that correspond to an
IPv6 address that was generated using a mechanism that prevents
location tracking [<a href="./rfc7721" title=""Security and Privacy Considerations for IPv6 Address Generation Mechanisms"">RFC7721</a>], host candidates that correspond to
IPv6 addresses that do allow location tracking, are configured on
the same interface, and are part of the same network prefix MUST
NOT be gathered. Similarly, when host candidates corresponding to
<span class="grey">Keranen, et al. Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
an IPv6 address generated using a mechanism that prevents location
tracking are gathered, then host candidates corresponding to IPv6
link-local addresses [<a href="./rfc4291" title=""IP Version 6 Addressing Architecture"">RFC4291</a>] MUST NOT be gathered.
The IPv6 default address selection specification [<a href="./rfc6724" title=""Default Address Selection for Internet Protocol Version 6 (IPv6)"">RFC6724</a>] specifies
that temporary addresses [<a href="./rfc4941" title=""Privacy Extensions for Stateless Address Autoconfiguration in IPv6"">RFC4941</a>] are to be preferred over permanent
addresses.
<span class="h5"><a class="selflink" id="section-5.1.1.2" href="#section-5.1.1.2">5.1.1.2</a>. Server-Reflexive and Relayed Candidates</span>
An ICE agent SHOULD gather server-reflexive and relayed candidates.
However, use of STUN and TURN servers may be unnecessary in certain
networks and use of TURN servers may be expensive, so some
deployments may elect not to use them. If an agent does not gather
server-reflexive or relayed candidates, it is RECOMMENDED that the
functionality be implemented and just disabled through configuration,
so that it can be re-enabled through configuration if conditions
change in the future.
The agent pairs each host candidate with the STUN or TURN servers
with which it is configured or has discovered by some means. It is
RECOMMENDED that a domain name be configured, the DNS procedures in
[<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>] (using SRV records with the "stun" service) be used to
discover the STUN server, and the DNS procedures in [<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>] (using
SRV records with the "turn" service) be used to discover the TURN
server.
When multiple STUN or TURN servers are available (or when they are
learned through DNS records and multiple results are returned), the
agent MAY gather candidates for all of them and SHOULD gather
candidates for at least one of them (one STUN server and one TURN
server). It does so by pairing host candidates with STUN or TURN
servers, and for each pair, the agent sends a Binding or Allocate
request to the server from the host candidate. Binding requests to a
STUN server are not authenticated, and any ALTERNATE-SERVER attribute
in a response is ignored. Agents MUST support the backwards-
compatibility mode for the Binding request defined in [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>].
Allocate requests SHOULD be authenticated using a long-term
credential obtained by the client through some other means.
The gathering process is controlled using a timer, Ta. Every time Ta
expires, the agent can generate another new STUN or TURN transaction.
This transaction can be either a retry of a previous transaction that
failed with a recoverable error (such as authentication failure) or a
transaction for a new host candidate and STUN or TURN server pair.
The agent SHOULD NOT generate transactions more frequently than once
per each ta expiration. See <a href="#section-14">Section 14</a> for guidance on how to set Ta
and the STUN retransmit timer, RTO.
<span class="grey">Keranen, et al. Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The agent will receive a Binding or Allocate response. A successful
Allocate response will provide the agent with a server-reflexive
candidate (obtained from the mapped address) and a relayed candidate
in the XOR-RELAYED-ADDRESS attribute. If the Allocate request is
rejected because the server lacks resources to fulfill it, the agent
SHOULD instead send a Binding request to obtain a server-reflexive
candidate. A Binding response will provide the agent with only a
server-reflexive candidate (also obtained from the mapped address).
The base of the server-reflexive candidate is the host candidate from
which the Allocate or Binding request was sent. The base of a
relayed candidate is that candidate itself. If a relayed candidate
is identical to a host candidate (which can happen in rare cases),
the relayed candidate MUST be discarded.
If an IPv6-only agent is in a network that utilizes NAT64 [<a href="./rfc6146" title=""Stateful NAT64: Network Address and Protocol Translation from IPv6 Clients to IPv4 Servers"">RFC6146</a>]
and DNS64 [<a href="./rfc6147" title=""DNS64: DNS Extensions for Network Address Translation from IPv6 Clients to IPv4 Servers"">RFC6147</a>] technologies, it may also gather IPv4 server-
reflexive and/or relayed candidates from IPv4-only STUN or TURN
servers. IPv6-only agents SHOULD also utilize IPv6 prefix discovery
[<a href="./rfc7050" title=""Discovery of the IPv6 Prefix Used for IPv6 Address Synthesis"">RFC7050</a>] to discover the IPv6 prefix used by NAT64 (if any) and
generate server-reflexive candidates for each IPv6-only interface,
accordingly. The NAT64 server-reflexive candidates are prioritized
like IPv4 server-reflexive candidates.
<span class="h5"><a class="selflink" id="section-5.1.1.3" href="#section-5.1.1.3">5.1.1.3</a>. Computing Foundations</span>
The ICE agent assigns each candidate a foundation. Two candidates
have the same foundation when all of the following are true:
o They have the same type (host, relayed, server reflexive, or peer
reflexive).
o Their bases have the same IP address (the ports can be different).
o For reflexive and relayed candidates, the STUN or TURN servers
used to obtain them have the same IP address (the IP address used
by the agent to contact the STUN or TURN server).
o They were obtained using the same transport protocol (TCP, UDP).
Similarly, two candidates have different foundations if their types
are different, their bases have different IP addresses, the STUN or
TURN servers used to obtain them have different IP addresses (the IP
addresses used by the agent to contact the STUN or TURN server), or
their transport protocols are different.
<span class="grey">Keranen, et al. Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h5"><a class="selflink" id="section-5.1.1.4" href="#section-5.1.1.4">5.1.1.4</a>. Keeping Candidates Alive</span>
Once server-reflexive and relayed candidates are allocated, they MUST
be kept alive until ICE processing has completed, as described in
<a href="#section-8.3">Section 8.3</a>. For server-reflexive candidates learned through a
Binding request, the bindings MUST be kept alive by additional
Binding requests to the server. Refreshes for allocations are done
using the Refresh transaction, as described in [<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>]. The
Refresh requests will also refresh the server-reflexive candidate.
Host candidates do not time out, but the candidate addresses may
change or disappear for a number of reasons. An ICE agent SHOULD
monitor the interfaces it uses, invalidate candidates whose base has
gone away, and acquire new candidates as appropriate when new IP
addresses (on new or currently used interfaces) appear.
<span class="h4"><a class="selflink" id="section-5.1.2" href="#section-5.1.2">5.1.2</a>. Prioritizing Candidates</span>
The prioritization process results in the assignment of a priority to
each candidate. Each candidate for a data stream MUST have a unique
priority that MUST be a positive integer between 1 and (2**31 - 1).
This priority will be used by ICE to determine the order of the
connectivity checks and the relative preference for candidates.
Higher-priority values give more priority over lower values.
An ICE agent SHOULD compute this priority using the formula in
<a href="#section-5.1.2.1">Section 5.1.2.1</a> and choose its parameters using the guidelines in
<a href="#section-5.1.2.2">Section 5.1.2.2</a>. If an agent elects to use a different formula, ICE
may take longer to converge since the agents will not be coordinated
in their checks.
The process for prioritizing candidates is common across the
initiating and the responding agent.
<span class="h5"><a class="selflink" id="section-5.1.2.1" href="#section-5.1.2.1">5.1.2.1</a>. Recommended Formula</span>
The recommended formula combines a preference for the candidate type
(server reflexive, peer reflexive, relayed, and host), a preference
for the IP address for which the candidate was obtained, and a
component ID using the following formula:
priority = (2^24)*(type preference) +
(2^8)*(local preference) +
(2^0)*(256 - component ID)
The type preference MUST be an integer from 0 (lowest preference) to
126 (highest preference) inclusive, MUST be identical for all
candidates of the same type, and MUST be different for candidates of
<span class="grey">Keranen, et al. Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
different types. The type preference for peer-reflexive candidates
MUST be higher than that of server-reflexive candidates. Setting the
value to 0 means that candidates of this type will only be used as a
last resort. Note that candidates gathered based on the procedures
of <a href="#section-5.1.1">Section 5.1.1</a> will never be peer-reflexive candidates; candidates
of this type are learned from the connectivity checks performed by
ICE.
The local preference MUST be an integer from 0 (lowest preference) to
65535 (highest preference) inclusive. When there is only a single IP
address, this value SHOULD be set to 65535. If there are multiple
candidates for a particular component for a particular data stream
that have the same type, the local preference MUST be unique for each
one. If an ICE agent is dual stack, the local preference SHOULD be
set according to the current best practice described in [<a href="./rfc8421" title=""Interactive Connectivity Establishment (ICE) Multihomed and IPv4/IPv6 Dual-Stack Guidelines"">RFC8421</a>].
The component ID MUST be an integer between 1 and 256 inclusive.
<span class="h5"><a class="selflink" id="section-5.1.2.2" href="#section-5.1.2.2">5.1.2.2</a>. Guidelines for Choosing Type and Local Preferences</span>
The RECOMMENDED values for type preferences are 126 for host
candidates, 110 for peer-reflexive candidates, 100 for server-
reflexive candidates, and 0 for relayed candidates.
If an ICE agent is multihomed and has multiple IP addresses, the
recommendations in [<a href="./rfc8421" title=""Interactive Connectivity Establishment (ICE) Multihomed and IPv4/IPv6 Dual-Stack Guidelines"">RFC8421</a>] SHOULD be followed. If multiple TURN
servers are used, local priorities for the candidates obtained from
the TURN servers are chosen in a similar fashion as for multihomed
local candidates: the local preference value is used to indicate a
preference among different servers, but the preference MUST be unique
for each one.
When choosing type preferences, agents may take into account factors
such as latency, packet loss, cost, network topology, security,
privacy, and others.
<span class="h4"><a class="selflink" id="section-5.1.3" href="#section-5.1.3">5.1.3</a>. Eliminating Redundant Candidates</span>
Next, the ICE agents (initiating and responding) eliminate redundant
candidates. Two candidates can have the same transport address yet
different bases, and these would not be considered redundant.
Frequently, a server-reflexive candidate and a host candidate will be
redundant when the agent is not behind a NAT. A candidate is
redundant if and only if its transport address and base equal those
of another candidate. The agent SHOULD eliminate the redundant
candidate with the lower priority.
<span class="grey">Keranen, et al. Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Lite Implementation Procedures</span>
Lite implementations only utilize host candidates. For each IP
address, independent of an IP address family, there MUST be zero or
one candidate. With the lite implementation, ICE cannot be used to
dynamically choose amongst candidates. Therefore, including more
than one candidate from a particular IP address family is NOT
RECOMMENDED, since only a connectivity check can truly determine
whether to use one address or the other. Instead, it is RECOMMENDED
that agents that have multiple public IP addresses run full ICE
implementations to ensure the best usage of its addresses.
Each component has an ID assigned to it, called the "component ID".
For RTP/RTCP data streams, unless RTCP is multiplexed in the same
port with RTP, the RTP itself has a component ID of 1 and RTCP a
component ID of 2. If an agent is using RTCP without multiplexing,
it MUST obtain candidates for it. However, absence of a component ID
2 as such does not imply use of RTCP/RTP multiplexing, as it could
also mean that RTCP is not used.
Each candidate is assigned a foundation. The foundation MUST be
different for two candidates allocated from different IP addresses;
otherwise, it MUST be the same. A simple integer that increments for
each IP address will suffice. In addition, each candidate MUST be
assigned a unique priority amongst all candidates for the same data
stream. If the formula in <a href="#section-5.1.2.1">Section 5.1.2.1</a> is used to calculate the
priority, the type preference value SHOULD be set to 126. If a host
is IPv4 only, the local preference value SHOULD be set to 65535. If
a host is IPv6 or dual stack, the local preference value SHOULD be
set to the precedence value for IP addresses described in <a href="./rfc6724">RFC 6724</a>
[<a href="./rfc6724" title=""Default Address Selection for Internet Protocol Version 6 (IPv6)"">RFC6724</a>].
Next, an agent chooses a default candidate for each component of each
data stream. If a host is IPv4 only, there would only be one
candidate for each component of each data stream; therefore, that
candidate is the default. If a host is IPv6 only, the default
candidate would typically be a globally scoped IPv6 address. Dual-
stack hosts SHOULD allow configuration whether IPv4 or IPv6 is used
for the default candidate, and the configuration needs to be based on
which one its administrator believes has a higher chance of success
in the current network environment.
The procedures in this section are common across the initiating and
responding agents.
<span class="grey">Keranen, et al. Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Exchanging Candidate Information</span>
ICE agents (initiating and responding) need the following information
about candidates to be exchanged. Each ICE usage MUST define how the
information is exchanged with the using protocol. This section
describes the information that needs to be exchanged.
Candidates: One or more candidates. For each candidate:
Address: The IP address and transport protocol port of the
candidate.
Transport: The transport protocol of the candidate. This MAY be
omitted if the using protocol only runs over a single transport
protocol.
Foundation: A sequence of up to 32 characters.
Component ID: The component ID of the candidate. This MAY be
omitted if the using protocol does not use the concept of
components.
Priority: The 32-bit priority of the candidate.
Type: The type of the candidate.
Related Address and Port: The related IP address and port of the
candidate. These MAY be omitted or set to invalid values if
the agent does not want to reveal them, e.g., for privacy
reasons.
Extensibility Parameters: The using protocol might define means
for adding new per-candidate ICE parameters in the future.
Lite or Full: Whether the agent is a lite agent or full agent.
Connectivity-Check Pacing Value: The pacing value for connectivity
checks that the agent wishes to use. This MAY be omitted if the
agent wishes to use a defined default value.
Username Fragment and Password: Values used to perform connectivity
checks. The values MUST be unguessable, with at least 128 bits of
random number generator output used to generate the password, and
at least 24 bits of output to generate the username fragment.
Extensions: New media-stream or session-level attributes (ICE
options).
<span class="grey">Keranen, et al. Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
If the using protocol is vulnerable to, and able to detect, ICE
mismatch (<a href="#section-5.4">Section 5.4</a>), a way is needed for the detecting agent to
convey this information to its peer. It is a boolean flag.
The using protocol may (or may not) need to deal with backwards
compatibility with older implementations that do not support ICE. If
a fallback mechanism to non-ICE is supported and is being used, then
presumably the using protocol provides a way of conveying the default
candidate (its IP address and port) in addition to the ICE
parameters.
Once an agent has sent its candidate information, it MUST be prepared
to receive both STUN and data packets on each candidate. As
discussed in <a href="#section-12.1">Section 12.1</a>, data packets can be sent to a candidate
prior to its appearance as the default destination for data.
<span class="h3"><a class="selflink" id="section-5.4" href="#section-5.4">5.4</a>. ICE Mismatch</span>
Certain middleboxes, such as ALGs, can alter signaling information in
ways that break ICE (e.g., by rewriting IP addresses in SDP). This
is referred to as "ICE mismatch". If the using protocol is
vulnerable to ICE mismatch, the responding agent needs to be able to
detect it and inform the peer ICE agent about the ICE mismatch.
Each using protocol needs to define whether the using protocol is
vulnerable to ICE mismatch, how ICE mismatch is detected, and whether
specific actions need to be taken when ICE mismatch is detected.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. ICE Candidate Processing</span>
Once an ICE agent has gathered its candidates and exchanged
candidates with its peer (<a href="#section-5">Section 5</a>), it will determine its own role.
In addition, full implementations will form checklists and begin
performing connectivity checks with the peer.
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Procedures for Full Implementation</span>
<span class="h4"><a class="selflink" id="section-6.1.1" href="#section-6.1.1">6.1.1</a>. Determining Role</span>
For each session, each ICE agent (initiating and responding) takes on
a role. There are two roles -- controlling and controlled. The
controlling agent is responsible for the choice of the final
candidate pairs used for communications. The sections below describe
in detail the actual procedures followed by controlling and
controlled agents.
<span class="grey">Keranen, et al. Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The rules for determining the role and the impact on behavior are as
follows:
Both agents are full: The initiating agent that started the ICE
processing MUST take the controlling role, and the other MUST take
the controlled role. Both agents will form checklists, run the
ICE state machines, and generate connectivity checks. The
controlling agent will execute the logic in <a href="#section-8.1">Section 8.1</a> to
nominate pairs that will become (if the connectivity checks
associated with the nominations succeed) the selected pairs, and
then both agents end ICE as described in <a href="#section-8.1.2">Section 8.1.2</a>.
One agent full, one lite: The full agent MUST take the controlling
role, and the lite agent MUST take the controlled role. The full
agent will form checklists, run the ICE state machines, and
generate connectivity checks. That agent will execute the logic
in <a href="#section-8.1">Section 8.1</a> to nominate pairs that will become (if the
connectivity checks associated with the nominations succeed) the
selected pairs and use the logic in <a href="#section-8.1.2">Section 8.1.2</a> to end ICE. The
lite implementation will just listen for connectivity checks,
receive them and respond to them, and then conclude ICE as
described in <a href="#section-8.2">Section 8.2</a>. For the lite implementation, the state
of ICE processing for each data stream is considered to be
Running, and the state of ICE overall is Running.
Both lite: The initiating agent that started the ICE processing MUST
take the controlling role, and the other MUST take the controlled
role. In this case, no connectivity checks are ever sent.
Rather, once the candidates are exchanged, each agent performs the
processing described in <a href="#section-8">Section 8</a> without connectivity checks. It
is possible that both agents will believe they are controlled or
controlling. In the latter case, the conflict is resolved through
glare detection capabilities in the signaling protocol enabling
the candidate exchange. The state of ICE processing for each data
stream is considered to be Running, and the state of ICE overall
is Running.
Once the roles are determined for a session, they persist throughout
the lifetime of the session. The roles can be redetermined as part
of an ICE restart (<a href="#section-9">Section 9</a>), but an ICE agent MUST NOT redetermine
the role as part of an ICE restart unless one or more of the
following criteria is fulfilled:
Full becomes lite: If the controlling agent is full, and switches to
lite, the roles MUST be redetermined if the peer agent is also
full.
<span class="grey">Keranen, et al. Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Role conflict: If the ICE restart causes a role conflict, the roles
might be redetermined due to the role conflict procedures in
<a href="#section-7.3.1.1">Section 7.3.1.1</a>.
NOTE: There are certain Third Party Call Control (3PCC) [<a href="./rfc3725" title=""Best Current Practices for Third Party Call Control (3pcc) in the Session Initiation Protocol (SIP)"">RFC3725</a>]
scenarios where an ICE restart might cause a role conflict.
NOTE: The agents need to inform each other whether they are full or
lite before the roles are determined. The mechanism for that is
specific to the signaling protocol and outside the scope of the
document.
An agent MUST accept if the peer initiates a redetermination of the
roles even if the criteria for doing so are not fulfilled. This can
happen if the peer is compliant with <a href="./rfc5245">RFC 5245</a>.
<span class="h4"><a class="selflink" id="section-6.1.2" href="#section-6.1.2">6.1.2</a>. Forming the Checklists</span>
There is one checklist for each data stream. To form a checklist,
initiating and responding ICE agents form candidate pairs, compute
pair priorities, order pairs by priority, prune pairs, remove lower-
priority pairs, and set checklist states. If candidates are added to
a checklist (e.g., due to detection of peer-reflexive candidates),
the agent will re-perform these steps for the updated checklist.
<span class="h5"><a class="selflink" id="section-6.1.2.1" href="#section-6.1.2.1">6.1.2.1</a>. Checklist State</span>
Each checklist has a state, which captures the state of ICE checks
for the data stream associated with the checklist. The states are:
Running: The checklist is neither Completed nor Failed yet.
Checklists are initially set to the Running state.
Completed: The checklist contains a nominated pair for each
component of the data stream.
Failed: The checklist does not have a valid pair for each component
of the data stream, and all of the candidate pairs in the
checklist are in either the Failed or the Succeeded state. In
other words, at least one component of the checklist has candidate
pairs that are all in the Failed state, which means the component
has failed, which means the checklist has failed.
<span class="h5"><a class="selflink" id="section-6.1.2.2" href="#section-6.1.2.2">6.1.2.2</a>. Forming Candidate Pairs</span>
The ICE agent pairs each local candidate with each remote candidate
for the same component of the same data stream with the same IP
address family. It is possible that some of the local candidates
<span class="grey">Keranen, et al. Standards Track [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
won't get paired with remote candidates, and some of the remote
candidates won't get paired with local candidates. This can happen
if one agent doesn't include candidates for all of the components for
a data stream. If this happens, the number of components for that
data stream is effectively reduced and is considered to be equal to
the minimum across both agents of the maximum component ID provided
by each agent across all components for the data stream.
In the case of RTP, this would happen when one agent provides
candidates for RTCP, and the other does not. As another example, the
initiating agent can multiplex RTP and RTCP on the same port
[<a href="./rfc5761" title=""Multiplexing RTP Data and Control Packets on a Single Port"">RFC5761</a>]. However, since the initiating agent doesn't know if the
peer agent can perform such multiplexing, it includes candidates for
RTP and RTCP on separate ports. If the peer agent can perform such
multiplexing, it would include just a single component for each
candidate -- for the combined RTP/RTCP mux. ICE would end up acting
as if there was just a single component for this candidate.
With IPv6, it is common for a host to have multiple host candidates
for each interface. To keep the amount of resulting candidate pairs
reasonable and to avoid candidate pairs that are highly unlikely to
work, IPv6 link-local addresses MUST NOT be paired with other than
link-local addresses.
The candidate pairs whose local and remote candidates are both the
default candidates for a particular component is called the "default
candidate pair" for that component. This is the pair that would be
used to transmit data if both agents had not been ICE aware.
<span class="grey">Keranen, et al. Standards Track [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Figure 5 shows the properties of and relationships between transport
addresses, candidates, candidate pairs, and checklists.
+--------------------------------------------+
| |
| +---------------------+ |
| |+----+ +----+ +----+ | +Type |
| || IP | |Port| |Tran| | +Priority |
| ||Addr| | | | | | +Foundation |
| |+----+ +----+ +----+ | +Component ID |
| | Transport | +Related Address |
| | Addr | |
| +---------------------+ +Base |
| Candidate |
+--------------------------------------------+
* *
* *************************************
* *
+-------------------------------+
| |
| Local Remote |
| +----+ +----+ +default? |
| |Cand| |Cand| +valid? |
| +----+ +----+ +nominated?|
| +State |
| |
| |
| Candidate Pair |
+-------------------------------+
* *
* ************
* *
+------------------+
| Candidate Pair |
+------------------+
+------------------+
| Candidate Pair |
+------------------+
+------------------+
| Candidate Pair |
+------------------+
Checklist
Figure 5: Conceptual Diagram of a Checklist
<span class="grey">Keranen, et al. Standards Track [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h5"><a class="selflink" id="section-6.1.2.3" href="#section-6.1.2.3">6.1.2.3</a>. Computing Pair Priority and Ordering Pairs</span>
The ICE agent computes a priority for each candidate pair. Let G be
the priority for the candidate provided by the controlling agent.
Let D be the priority for the candidate provided by the controlled
agent. The priority for a pair is computed as follows:
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
The agent sorts each checklist in decreasing order of candidate pair
priority. If two pairs have identical priority, the ordering amongst
them is arbitrary.
<span class="h5"><a class="selflink" id="section-6.1.2.4" href="#section-6.1.2.4">6.1.2.4</a>. Pruning the Pairs</span>
This sorted list of candidate pairs is used to determine a sequence
of connectivity checks that will be performed. Each check involves
sending a request from a local candidate to a remote candidate.
Since an ICE agent cannot send requests directly from a reflexive
candidate (server reflexive or peer reflexive), but only from its
base, the agent next goes through the sorted list of candidate pairs.
For each pair where the local candidate is reflexive, the candidate
MUST be replaced by its base.
The agent prunes each checklist. This is done by removing a
candidate pair if it is redundant with a higher-priority candidate
pair in the same checklist. Two candidate pairs are redundant if
their local candidates have the same base and their remote candidates
are identical. The result is a sequence of ordered candidate pairs,
called the "checklist" for that data stream.
<span class="h5"><a class="selflink" id="section-6.1.2.5" href="#section-6.1.2.5">6.1.2.5</a>. Removing Lower-Priority Pairs</span>
In order to limit the attacks described in <a href="#section-19.5.1">Section 19.5.1</a>, an ICE
agent MUST limit the total number of connectivity checks the agent
performs across all checklists in the checklist set. This is done by
limiting the total number of candidate pairs in the checklist set.
The default limit of candidate pairs for the checklist set is 100,
but the value MUST be configurable. The limit is enforced by, within
in each checklist, discarding lower-priority candidate pairs until
the total number of candidate pairs in the checklist set is smaller
than the limit value. The discarding SHOULD be done evenly so that
the number of candidate pairs in each checklist is reduced the same
amount.
It is RECOMMENDED that a lower-limit value than the default is picked
when possible, and that the value is set to the maximum number of
plausible candidate pairs that might be created in an actual
<span class="grey">Keranen, et al. Standards Track [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
deployment configuration. The requirement for configuration is meant
to provide a tool for fixing this value in the field if, once
deployed, it is found to be problematic.
<span class="h5"><a class="selflink" id="section-6.1.2.6" href="#section-6.1.2.6">6.1.2.6</a>. Computing Candidate Pair States</span>
Each candidate pair in the checklist has a foundation (the
combination of the foundations of the local and remote candidates in
the pair) and one of the following states:
Waiting: A check has not been sent for this pair, but the pair is
not Frozen.
In-Progress: A check has been sent for this pair, but the
transaction is in progress.
Succeeded: A check has been sent for this pair, and it produced a
successful result.
Failed: A check has been sent for this pair, and it failed (a
response to the check was never received, or a failure response
was received).
Frozen: A check for this pair has not been sent, and it cannot be
sent until the pair is unfrozen and moved into the Waiting state.
<span class="grey">Keranen, et al. Standards Track [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Pairs move between states as shown in Figure 6.
+-----------+
| |
| |
| Frozen |
| |
| |
+-----------+
|
|unfreeze
|
V
+-----------+ +-----------+
| | | |
| | perform | |
| Waiting |-------->|In-Progress|
| | | |
| | | |
+-----------+ +-----------+
/ |
// |
// |
// |
/ |
// |
failure // |success
// |
/ |
// |
// |
// |
V V
+-----------+ +-----------+
| | | |
| | | |
| Failed | | Succeeded |
| | | |
| | | |
+-----------+ +-----------+
Figure 6: Pair State Finite State Machine (FSM)
<span class="grey">Keranen, et al. Standards Track [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The initial states for each pair in a checklist are computed by
performing the following sequence of steps:
1. The checklists are placed in an ordered list (the order is
determined by each ICE usage), called the "checklist set".
2. The ICE agent initially places all candidate pairs in the Frozen
state.
3. The agent sets all of the checklists in the checklist set to the
Running state.
4. For each foundation, the agent sets the state of exactly one
candidate pair to the Waiting state (unfreezing it). The
candidate pair to unfreeze is chosen by finding the first
candidate pair (ordered by the lowest component ID and then the
highest priority if component IDs are equal) in the first
checklist (according to the usage-defined checklist set order)
that has that foundation.
NOTE: The procedures above are different from <a href="./rfc5245">RFC 5245</a>, where only
candidate pairs in the first checklist were initially placed in the
Waiting state. Now it applies to candidate pairs in the first
checklist that have that foundation, even if the checklist is not the
first one in the checklist set.
The table below illustrates an example.
<span class="grey">Keranen, et al. Standards Track [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Table legend:
Each row (m1, m2,...) represents a checklist associated with a
data stream. m1 represents the first checklist in the checklist
set.
Each column (f1, f2,...) represents a foundation. Every candidate
pair within a given column share the same foundation.
f-cp represents a candidate pair in the Frozen state.
w-cp represents a candidate pair in the Waiting state.
1. The agent sets all of the pairs in the checklist set to the
Frozen state.
f1 f2 f3 f4 f5
-----------------------------
m1 | f-cp f-cp f-cp
|
m2 | f-cp f-cp f-cp f-cp
|
m3 | f-cp f-cp
2. For each foundation, the candidate pair with the lowest
component ID is placed in the Waiting state, unless a
candidate pair associated with the same foundation has
already been put in the Waiting state in one of the
other examined checklists in the checklist set.
f1 f2 f3 f4 f5
-----------------------------
m1 | w-cp w-cp w-cp
|
m2 | f-cp f-cp f-cp w-cp
|
m3 | f-cp w-cp
Table 1: Pair State Example
In the first checklist (m1), the candidate pair for each foundation
is placed in the Waiting state, as no pairs for the same foundations
have yet been placed in the Waiting state.
In the second checklist (m2), the candidate pair for foundation f4 is
placed in the Waiting state. The candidate pair for foundations f1,
f2, and f3 are kept in the Frozen state, as candidate pairs for those
<span class="grey">Keranen, et al. Standards Track [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
foundations have already been placed in the Waiting state (within
checklist m1).
In the third checklist (m3), the candidate pair for foundation f5 is
placed in the Waiting state. The candidate pair for foundation f1 is
kept in the Frozen state, as a candidate pair for that foundation has
already been placed in the Waiting state (within checklist m1).
Once each checklist have been processed, one candidate pair for each
foundation in the checklist set has been placed in the Waiting state.
<span class="h4"><a class="selflink" id="section-6.1.3" href="#section-6.1.3">6.1.3</a>. ICE State</span>
The ICE agent has a state determined by the state of the checklists.
The state is Completed if all checklists are Completed, Failed if all
checklists are Failed, or Running otherwise.
<span class="h4"><a class="selflink" id="section-6.1.4" href="#section-6.1.4">6.1.4</a>. Scheduling Checks</span>
<span class="h5"><a class="selflink" id="section-6.1.4.1" href="#section-6.1.4.1">6.1.4.1</a>. Triggered-Check Queue</span>
Once the ICE agent has computed the checklists and created the
checklist set, as described in <a href="#section-6.1.2">Section 6.1.2</a>, the agent will begin
performing connectivity checks (ordinary and triggered). For
triggered connectivity checks, the agent maintains a FIFO queue for
each checklist, referred to as the "triggered-check queue", which
contains candidate pairs for which checks are to be sent at the next
available opportunity. The triggered-check queue is initially empty.
<span class="h5"><a class="selflink" id="section-6.1.4.2" href="#section-6.1.4.2">6.1.4.2</a>. Performing Connectivity Checks</span>
The generation of ordinary and triggered connectivity checks is
governed by timer Ta. As soon as the initial states for the
candidate pairs in the checklist set have been set, a check is
performed for a candidate pair within the first checklist in the
Running state, following the procedures in <a href="#section-7">Section 7</a>. After that,
whenever Ta fires the next checklist in the Running state in the
checklist set is picked, and a check is performed for a candidate
within that checklist. After the last checklist in the Running state
in the checklist set has been processed, the first checklist is
picked again, etc.
<span class="grey">Keranen, et al. Standards Track [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Whenever Ta fires, the ICE agent will perform a check for a candidate
pair within the checklist that was picked by performing the following
steps:
1. If the triggered-check queue associated with the checklist
contains one or more candidate pairs, the agent removes the top
pair from the queue, performs a connectivity check on that pair,
puts the candidate pair state to In-Progress, and aborts the
subsequent steps.
2. If there is no candidate pair in the Waiting state, and if there
are one or more pairs in the Frozen state, the agent checks the
foundation associated with each pair in the Frozen state. For a
given foundation, if there is no pair (in any checklist in the
checklist set) in the Waiting or In-Progress state, the agent
puts the candidate pair state to Waiting and continues with the
next step.
3. If there are one or more candidate pairs in the Waiting state,
the agent picks the highest-priority candidate pair (if there are
multiple pairs with the same priority, the pair with the lowest
component ID is picked) in the Waiting state, performs a
connectivity check on that pair, puts the candidate pair state to
In-Progress, and aborts the subsequent steps.
4. If this step is reached, no check could be performed for the
checklist that was picked. So, without waiting for timer Ta to
expire again, select the next checklist in the Running state and
return to step #1. If this happens for every single checklist in
the Running state, meaning there are no remaining candidate pairs
to perform connectivity checks for, abort these steps.
Once the agent has picked a candidate pair for which a connectivity
check is to be performed, the agent starts a check and sends the
Binding request from the base associated with the local candidate of
the pair to the remote candidate of the pair, as described in
<a href="#section-7.2.4">Section 7.2.4</a>.
Based on local policy, an agent MAY choose to terminate performing
the connectivity checks for one or more checklists in the checklist
set at any time. However, only the controlling agent is allowed to
conclude ICE (<a href="#section-8">Section 8</a>).
To compute the message integrity for the check, the agent uses the
remote username fragment and password learned from the candidate
information obtained from its peer. The local username fragment is
known directly by the agent for its own candidate.
<span class="grey">Keranen, et al. Standards Track [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Lite Implementation Procedures</span>
Lite implementations skip most of the steps in <a href="#section-6">Section 6</a> except for
verifying the peer's ICE support and determining its role in the ICE
processing.
If the lite implementation is the controlling agent (which will only
happen if the peer ICE agent is also a lite implementation), it
selects a candidate pair based on the ones in the candidate exchange
(for IPv4, there is only ever one pair) and then updates the peer
with the new candidate information reflecting that selection, if
needed (it is never needed for an IPv4-only host).
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Performing Connectivity Checks</span>
This section describes how connectivity checks are performed.
An ICE agent MUST be compliant to [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>]. A full implementation
acts both as a STUN client and a STUN server, while a lite
implementation only acts as a STUN server (as it does not generate
connectivity checks).
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. STUN Extensions</span>
ICE extends STUN with the attributes: PRIORITY, USE-CANDIDATE, ICE-
CONTROLLED, and ICE-CONTROLLING. These attributes are formally
defined in <a href="#section-16.1">Section 16.1</a>. This section describes the usage of the
attributes.
The attributes are only applicable to ICE connectivity checks.
<span class="h4"><a class="selflink" id="section-7.1.1" href="#section-7.1.1">7.1.1</a>. PRIORITY</span>
The PRIORITY attribute MUST be included in a Binding request and be
set to the value computed by the algorithm in <a href="#section-5.1.2">Section 5.1.2</a> for the
local candidate, but with the candidate type preference of peer-
reflexive candidates.
<span class="h4"><a class="selflink" id="section-7.1.2" href="#section-7.1.2">7.1.2</a>. USE-CANDIDATE</span>
The controlling agent MUST include the USE-CANDIDATE attribute in
order to nominate a candidate pair (<a href="#section-8.1.1">Section 8.1.1</a>). The controlled
agent MUST NOT include the USE-CANDIDATE attribute in a Binding
request.
<span class="grey">Keranen, et al. Standards Track [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h4"><a class="selflink" id="section-7.1.3" href="#section-7.1.3">7.1.3</a>. ICE-CONTROLLED and ICE-CONTROLLING</span>
The controlling agent MUST include the ICE-CONTROLLING attribute in a
Binding request. The controlled agent MUST include the ICE-
CONTROLLED attribute in a Binding request.
The content of either attribute is used as tiebreaker values when an
ICE role conflict occurs (<a href="#section-7.3.1.1">Section 7.3.1.1</a>).
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. STUN Client Procedures</span>
<span class="h4"><a class="selflink" id="section-7.2.1" href="#section-7.2.1">7.2.1</a>. Creating Permissions for Relayed Candidates</span>
If the connectivity check is being sent using a relayed local
candidate, the client MUST create a permission first if it has not
already created one previously. It would have created one previously
if it had told the TURN server to create a permission for the given
relayed candidate towards the IP address of the remote candidate. To
create the permission, the ICE agent follows the procedures defined
in [<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>]. The permission MUST be created towards the IP address
of the remote candidate. It is RECOMMENDED that the agent defer
creation of a TURN channel until ICE completes, in which case
permissions for connectivity checks are normally created using a
CreatePermission request. Once established, the agent MUST keep the
permission active until ICE concludes.
<span class="h4"><a class="selflink" id="section-7.2.2" href="#section-7.2.2">7.2.2</a>. Forming Credentials</span>
A connectivity-check Binding request MUST utilize the STUN short-term
credential mechanism.
The username for the credential is formed by concatenating the
username fragment provided by the peer with the username fragment of
the ICE agent sending the request, separated by a colon (":").
The password is equal to the password provided by the peer.
For example, consider the case where ICE agent L is the initiating
agent and ICE agent R is the responding agent. Agent L included a
username fragment of LFRAG for its candidates and a password of
LPASS. Agent R provided a username fragment of RFRAG and a password
of RPASS. A connectivity check from L to R utilizes the username
RFRAG:LFRAG and a password of RPASS. A connectivity check from R to
L utilizes the username LFRAG:RFRAG and a password of LPASS. The
responses utilize the same usernames and passwords as the requests
(note that the USERNAME attribute is not present in the response).
<span class="grey">Keranen, et al. Standards Track [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h4"><a class="selflink" id="section-7.2.3" href="#section-7.2.3">7.2.3</a>. Diffserv Treatment</span>
If the agent is using Differentiated Services Code Point (DSCP)
markings [<a href="./rfc2475" title=""An Architecture for Differentiated Services"">RFC2475</a>] in data packets that it will send, the agent
SHOULD apply the same markings to Binding requests and responses that
it will send.
If multiple DSCP markings are used on the data packets, the agent
SHOULD choose one of them for use with the connectivity check.
<span class="h4"><a class="selflink" id="section-7.2.4" href="#section-7.2.4">7.2.4</a>. Sending the Request</span>
A connectivity check is generated by sending a Binding request from
the base associated with a local candidate to a remote candidate.
[<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>] describes how Binding requests are constructed and
generated.
Support for backwards compatibility with <a href="./rfc3489">RFC 3489</a> MUST NOT be assumed
when performing connectivity checks. The FINGERPRINT mechanism MUST
be used for connectivity checks.
<span class="h4"><a class="selflink" id="section-7.2.5" href="#section-7.2.5">7.2.5</a>. Processing the Response</span>
This section defines additional procedures for processing Binding
responses specific to ICE connectivity checks.
When a Binding response is received, it is correlated to the
corresponding Binding request using the transaction ID [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>],
which then associates the response with the candidate pair for which
the Binding request was sent. After that, the response is processed
according to the procedures for a role conflict, a failure, or a
success, according to the procedures below.
<span class="h5"><a class="selflink" id="section-7.2.5.1" href="#section-7.2.5.1">7.2.5.1</a>. Role Conflict</span>
If the Binding request generates a 487 (Role Conflict) error response
(<a href="#section-7.3.1.1">Section 7.3.1.1</a>), and if the ICE agent included an ICE-CONTROLLED
attribute in the request, the agent MUST switch to the controlling
role. If the agent included an ICE-CONTROLLING attribute in the
request, the agent MUST switch to the controlled role.
Once the agent has switched its role, the agent MUST add the
candidate pair whose check generated the 487 error response to the
triggered-check queue associated with the checklist to which the pair
belongs, and set the candidate pair state to Waiting. When the
triggered connectivity check is later performed, the ICE-CONTROLLING/
ICE-CONTROLLED attribute of the Binding request will indicate the
agent's new role. The agent MUST change the tiebreaker value.
<span class="grey">Keranen, et al. Standards Track [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
NOTE: A role switch requires an agent to recompute pair priorities
(<a href="#section-6.1.2.3">Section 6.1.2.3</a>), since the priority values depend on the role.
NOTE: A role switch will also impact whether the agent is responsible
for nominating candidate pairs, and whether the agent is responsible
for initiating the exchange of the updated candidate information with
the peer once ICE is concluded.
<span class="h5"><a class="selflink" id="section-7.2.5.2" href="#section-7.2.5.2">7.2.5.2</a>. Failure</span>
This section describes cases when the candidate pair state is set to
Failed.
NOTE: When the ICE agent sets the candidate pair state to Failed as a
result of a connectivity-check error, the agent does not change the
states of other candidate pairs with the same foundation.
<span class="h6"><a class="selflink" id="section-7.2.5.2.1" href="#section-7.2.5.2.1">7.2.5.2.1</a>. Non-Symmetric Transport Addresses</span>
The ICE agent MUST check that the source and destination transport
addresses in the Binding request and response are symmetric. That
is, the source IP address and port of the response MUST be equal to
the destination IP address and port to which the Binding request was
sent, and the destination IP address and port of the response MUST be
equal to the source IP address and port from which the Binding
request was sent. If the addresses are not symmetric, the agent MUST
set the candidate pair state to Failed.
<span class="h6"><a class="selflink" id="section-7.2.5.2.2" href="#section-7.2.5.2.2">7.2.5.2.2</a>. ICMP Error</span>
An ICE agent MAY support processing of ICMP errors for connectivity
checks. If the agent supports processing of ICMP errors, and if a
Binding request generates a hard ICMP error, the agent SHOULD set the
state of the candidate pair to Failed. Implementers need to be aware
that ICMP errors can be used as a method for Denial-of-Service (DoS)
attacks when making a decision on how and if to process ICMP errors.
<span class="h6"><a class="selflink" id="section-7.2.5.2.3" href="#section-7.2.5.2.3">7.2.5.2.3</a>. Timeout</span>
If the Binding request transaction times out, the ICE agent MUST set
the candidate pair state to Failed.
<span class="h6"><a class="selflink" id="section-7.2.5.2.4" href="#section-7.2.5.2.4">7.2.5.2.4</a>. Unrecoverable STUN Response</span>
If the Binding request generates a STUN error response that is
unrecoverable [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>], the ICE agent SHOULD set the candidate pair
state to Failed.
<span class="grey">Keranen, et al. Standards Track [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h5"><a class="selflink" id="section-7.2.5.3" href="#section-7.2.5.3">7.2.5.3</a>. Success</span>
A connectivity check is considered a success if each of the following
criteria is true:
o The Binding request generated a success response; and
o The source and destination transport addresses in the Binding
request and response are symmetric.
If a check is considered a success, the ICE agent performs (in order)
the actions described in the following sections.
<span class="h6"><a class="selflink" id="section-7.2.5.3.1" href="#section-7.2.5.3.1">7.2.5.3.1</a>. Discovering Peer-Reflexive Candidates</span>
The ICE agent MUST check the mapped address from the STUN response.
If the transport address does not match any of the local candidates
that the agent knows about, the mapped address represents a new
candidate: a peer-reflexive candidate. Like other candidates, a
peer-reflexive candidate has a type, base, priority, and foundation.
They are computed as follows:
o The type is peer reflexive.
o The base is the local candidate of the candidate pair from which
the Binding request was sent.
o The priority is the value of the PRIORITY attribute in the Binding
request.
o The foundation is described in <a href="#section-5.1.1.3">Section 5.1.1.3</a>.
The peer-reflexive candidate is then added to the list of local
candidates for the data stream. The username fragment and password
are the same as for all other local candidates for that data stream.
The ICE agent does not need to pair the peer-reflexive candidate with
remote candidates, as a valid pair will be created due to the
procedures in <a href="#section-7.2.5.3.2">Section 7.2.5.3.2</a>. If an agent wishes to pair the
peer-reflexive candidate with remote candidates other than the one in
the valid pair that will be generated, the agent MAY provide updated
candidate information to the peer that includes the peer-reflexive
candidate. This will cause the peer-reflexive candidate to be paired
with all other remote candidates.
<span class="grey">Keranen, et al. Standards Track [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h6"><a class="selflink" id="section-7.2.5.3.2" href="#section-7.2.5.3.2">7.2.5.3.2</a>. Constructing a Valid Pair</span>
The ICE agent constructs a candidate pair whose local candidate
equals the mapped address of the response and whose remote candidate
equals the destination address to which the request was sent. This
is called a "valid pair".
The valid pair might equal the pair that generated the connectivity
check, a different pair in the checklist, or a pair currently not in
the checklist.
The agent maintains a separate list, referred to as the "valid list".
There is a valid list for each checklist in the checklist set. The
valid list will contain valid pairs. Initially, each valid list is
empty.
Each valid pair within the valid list has a flag, called the
"nominated flag". When a valid pair is added to a valid list, the
flag value is set to 'false'.
The valid pair will be added to a valid list as follows:
1. If the valid pair equals the pair that generated the check, the
pair is added to the valid list associated with the checklist to
which the pair belongs; or
2. If the valid pair equals another pair in a checklist, that pair
is added to the valid list associated with the checklist of that
pair. The pair that generated the check is not added to a valid
list; or
3. If the valid pair is not in any checklist, the agent computes the
priority for the pair based on the priority of each candidate,
using the algorithm in <a href="#section-6.1.2">Section 6.1.2</a>. The priority of the local
candidate depends on its type. Unless the type is peer
reflexive, the priority is equal to the priority signaled for
that candidate in the candidate exchange. If the type is peer
reflexive, it is equal to the PRIORITY attribute the agent placed
in the Binding request that just completed. The priority of the
remote candidate is taken from the candidate information of the
peer. If the candidate does not appear there, then the check has
been a triggered check to a new remote candidate. In that case,
the priority is taken as the value of the PRIORITY attribute in
the Binding request that triggered the check that just completed.
The pair is then added to the valid list.
<span class="grey">Keranen, et al. Standards Track [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
NOTE: It will be very common that the valid pair will not be in any
checklist. Recall that the checklist has pairs whose local
candidates are never reflexive; those pairs had their local
candidates converted to the base of the reflexive candidates and were
then pruned if they were redundant. When the response to the Binding
request arrives, the mapped address will be reflexive if there is a
NAT between the two. In that case, the valid pair will have a local
candidate that doesn't match any of the pairs in the checklist.
<span class="h6"><a class="selflink" id="section-7.2.5.3.3" href="#section-7.2.5.3.3">7.2.5.3.3</a>. Updating Candidate Pair States</span>
The ICE agent sets the states of both the candidate pair that
generated the check and the constructed valid pair (which may be
different) to Succeeded.
The agent MUST set the states for all other Frozen candidate pairs in
all checklists with the same foundation to Waiting.
NOTE: Within a given checklist, candidate pairs with the same
foundations will typically have different component ID values.
<span class="h6"><a class="selflink" id="section-7.2.5.3.4" href="#section-7.2.5.3.4">7.2.5.3.4</a>. Updating the Nominated Flag</span>
If the controlling agent sends a Binding request with the USE-
CANDIDATE attribute set, and if the ICE agent receives a successful
response to the request, the agent sets the nominated flag of the
pair to true. If the request fails (<a href="#section-7.2.5.2">Section 7.2.5.2</a>), the agent MUST
remove the candidate pair from the valid list, set the candidate pair
state to Failed, and set the checklist state to Failed.
If the controlled agent receives a successful response to a Binding
request sent by the agent, and that Binding request was triggered by
a received Binding request with the USE-CANDIDATE attribute set
(<a href="#section-7.3.1.4">Section 7.3.1.4</a>), the agent sets the nominated flag of the pair to
true. If the triggered request fails, the agent MUST remove the
candidate pair from the valid list, set the candidate pair state to
Failed, and set the checklist state to Failed.
Once the nominated flag is set for a component of a data stream, it
concludes the ICE processing for that component (<a href="#section-8">Section 8</a>).
<span class="h5"><a class="selflink" id="section-7.2.5.4" href="#section-7.2.5.4">7.2.5.4</a>. Checklist State Updates</span>
Regardless of whether a connectivity check was successful or failed,
the completion of the check may require updating of checklist states.
For each checklist in the checklist set, if all of the candidate
pairs are in either Failed or Succeeded state, and if there is not a
valid pair in the valid list for each component of the data stream
<span class="grey">Keranen, et al. Standards Track [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
associated with the checklist, the state of the checklist is set to
Failed. If there is a valid pair for each component in the valid
list, the state of the checklist is set to Succeeded.
<span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. STUN Server Procedures</span>
An ICE agent (lite or full) MUST be prepared to receive Binding
requests on the base of each candidate it included in its most recent
candidate exchange.
The agent MUST use the short-term credential mechanism (i.e., the
MESSAGE-INTEGRITY attribute) to authenticate the request and perform
a message integrity check. Likewise, the short-term credential
mechanism MUST be used for the response. The agent MUST consider the
username to be valid if it consists of two values separated by a
colon, where the first value is equal to the username fragment
generated by the agent in a candidate exchange for a session in
progress. It is possible (and in fact very likely) that the
initiating agent will receive a Binding request prior to receiving
the candidates from its peer. If this happens, the agent MUST
immediately generate a response (including computation of the mapped
address as described in <a href="#section-7.3.1.2">Section 7.3.1.2</a>). The agent has sufficient
information at this point to generate the response; the password from
the peer is not required. Once the answer is received, it MUST
proceed with the remaining steps required; namely, see Sections
7.3.1.3, 7.3.1.4, and 7.3.1.5 for full implementations. In cases
where multiple STUN requests are received before the answer, this may
cause several pairs to be queued up in the triggered-check queue.
An agent MUST NOT utilize the ALTERNATE-SERVER mechanism and MUST NOT
support the backwards-compatibility mechanisms defined in <a href="./rfc5389">RFC 5389</a>
(for working with the protocol in <a href="./rfc3489">RFC 3489</a>). It MUST utilize the
FINGERPRINT mechanism.
If the agent is using DSCP markings [<a href="./rfc2475" title=""An Architecture for Differentiated Services"">RFC2475</a>] in its data packets, it
SHOULD apply the same markings to Binding responses. The same would
apply to any Layer 2 markings the endpoint might be applying to data
packets.
<span class="h4"><a class="selflink" id="section-7.3.1" href="#section-7.3.1">7.3.1</a>. Additional Procedures for Full Implementations</span>
This subsection defines the additional server procedures applicable
to full implementations, when the full implementation accepts the
Binding request.
<span class="grey">Keranen, et al. Standards Track [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h5"><a class="selflink" id="section-7.3.1.1" href="#section-7.3.1.1">7.3.1.1</a>. Detecting and Repairing Role Conflicts</span>
In certain usages of ICE (such as 3PCC), both ICE agents may end up
choosing the same role, resulting in a role conflict. The section
describes a mechanism for detecting and repairing role conflicts.
The usage document MUST specify whether this mechanism is needed.
An agent MUST examine the Binding request for either the ICE-
CONTROLLING or ICE-CONTROLLED attribute. It MUST follow these
procedures:
o If the agent is in the controlling role, and the ICE-CONTROLLING
attribute is present in the request:
* If the agent's tiebreaker value is larger than or equal to the
contents of the ICE-CONTROLLING attribute, the agent generates
a Binding error response and includes an ERROR-CODE attribute
with a value of 487 (Role Conflict) but retains its role.
* If the agent's tiebreaker value is less than the contents of
the ICE-CONTROLLING attribute, the agent switches to the
controlled role.
o If the agent is in the controlled role, and the ICE-CONTROLLED
attribute is present in the request:
* If the agent's tiebreaker value is larger than or equal to the
contents of the ICE-CONTROLLED attribute, the agent switches to
the controlling role.
* If the agent's tiebreaker value is less than the contents of
the ICE-CONTROLLED attribute, the agent generates a Binding
error response and includes an ERROR-CODE attribute with a
value of 487 (Role Conflict) but retains its role.
o If the agent is in the controlled role and the ICE-CONTROLLING
attribute was present in the request, or if the agent was in the
controlling role and the ICE-CONTROLLED attribute was present in
the request, there is no conflict.
A change in roles will require an agent to recompute pair priorities
(<a href="#section-6.1.2.3">Section 6.1.2.3</a>), since those priorities are a function of role.
The change in role will also impact whether the agent is responsible
for selecting nominated pairs and initiating exchange with updated
candidate information upon conclusion of ICE.
<span class="grey">Keranen, et al. Standards Track [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The remaining subsections in <a href="#section-7.3.1">Section 7.3.1</a> are followed if the agent
generated a successful response to the Binding request, even if the
agent changed roles.
<span class="h5"><a class="selflink" id="section-7.3.1.2" href="#section-7.3.1.2">7.3.1.2</a>. Computing Mapped Addresses</span>
For requests received on a relayed candidate, the source transport
address used for STUN processing (namely, generation of the
XOR-MAPPED-ADDRESS attribute) is the transport address as seen by the
TURN server. That source transport address will be present in the
XOR-PEER-ADDRESS attribute of a Data Indication message, if the
Binding request was delivered through a Data Indication. If the
Binding request was delivered through a ChannelData message, the
source transport address is the one that was bound to the channel.
<span class="h5"><a class="selflink" id="section-7.3.1.3" href="#section-7.3.1.3">7.3.1.3</a>. Learning Peer-Reflexive Candidates</span>
If the source transport address of the request does not match any
existing remote candidates, it represents a new peer-reflexive remote
candidate. This candidate is constructed as follows:
o The type is peer reflexive.
o The priority is the value of the PRIORITY attribute in the Binding
request.
o The foundation is an arbitrary value, different from the
foundations of all other remote candidates. If any subsequent
candidate exchanges contain this peer-reflexive candidate, it will
signal the actual foundation for the candidate.
o The component ID is the component ID of the local candidate to
which the request was sent.
This candidate is added to the list of remote candidates. However,
the ICE agent does not pair this candidate with any local candidates.
<span class="h5"><a class="selflink" id="section-7.3.1.4" href="#section-7.3.1.4">7.3.1.4</a>. Triggered Checks</span>
Next, the agent constructs a pair whose local candidate has the
transport address (as seen by the agent) on which the STUN request
was received and a remote candidate equal to the source transport
address where the request came from (which may be the peer-reflexive
remote candidate that was just learned). The local candidate will be
either a host candidate (for cases where the request was not received
through a relay) or a relayed candidate (for cases where it is
received through a relay). The local candidate can never be a
server-reflexive candidate. Since both candidates are known to the
<span class="grey">Keranen, et al. Standards Track [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
agent, it can obtain their priorities and compute the candidate pair
priority. This pair is then looked up in the checklist. There can
be one of several outcomes:
o When the pair is already on the checklist:
* If the state of that pair is Succeeded, nothing further is
done.
* If the state of that pair is In-Progress, the agent cancels the
In-Progress transaction. Cancellation means that the agent
will not retransmit the Binding requests associated with the
connectivity-check transaction, will not treat the lack of
response to be a failure, but will wait the duration of the
transaction timeout for a response. In addition, the agent
MUST enqueue the pair in the triggered checklist associated
with the checklist, and set the state of the pair to Waiting,
in order to trigger a new connectivity check of the pair.
Creating a new connectivity check enables validating
In-Progress pairs as soon as possible, without having to wait
for retransmissions of the Binding requests associated with the
original connectivity-check transaction.
* If the state of that pair is Waiting, Frozen, or Failed, the
agent MUST enqueue the pair in the triggered checklist
associated with the checklist (if not already present), and set
the state of the pair to Waiting, in order to trigger a new
connectivity check of the pair. Note that a state change of
the pair from Failed to Waiting might also trigger a state
change of the associated checklist.
These steps are done to facilitate rapid completion of ICE when both
agents are behind NAT.
o If the pair is not already on the checklist:
* The pair is inserted into the checklist based on its priority.
* Its state is set to Waiting.
* The pair is enqueued into the triggered-check queue.
When a triggered check is to be sent, it is constructed and processed
as described in <a href="#section-7.2.4">Section 7.2.4</a>. These procedures require the agent to
know the transport address, username fragment, and password for the
peer. The username fragment for the remote candidate is equal to the
part after the colon of the USERNAME in the Binding request that was
just received. Using that username fragment, the agent can check the
<span class="grey">Keranen, et al. Standards Track [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
candidates received from its peer (there may be more than one in
cases of forking) and find this username fragment. The corresponding
password is then picked.
<span class="h5"><a class="selflink" id="section-7.3.1.5" href="#section-7.3.1.5">7.3.1.5</a>. Updating the Nominated Flag</span>
If the controlled agent receives a Binding request with the USE-
CANDIDATE attribute set, and if the ICE agent accepts the request,
the following action is based on the state of the pair computed in
<a href="#section-7.3.1.4">Section 7.3.1.4</a>:
o If the state of this pair is Succeeded, it means that the check
previously sent by this pair produced a successful response and
generated a valid pair (<a href="#section-7.2.5.3.2">Section 7.2.5.3.2</a>). The agent sets the
nominated flag value of the valid pair to true.
o If the received Binding request triggered a new check to be
enqueued in the triggered-check queue (<a href="#section-7.3.1.4">Section 7.3.1.4</a>), once the
check is sent and if it generates a successful response, and
generates a valid pair, the agent sets the nominated flag of the
pair to true. If the request fails (<a href="#section-7.2.5.2">Section 7.2.5.2</a>), the agent
MUST remove the candidate pair from the valid list, set the
candidate pair state to Failed, and set the checklist state to
Failed.
If the controlled agent does not accept the request from the
controlling agent, the controlled agent MUST reject the nomination
request with an appropriate error code response (e.g., 400)
[<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>].
Once the nominated flag is set for a component of a data stream, it
concludes the ICE processing for that component. See <a href="#section-8">Section 8</a>.
<span class="h4"><a class="selflink" id="section-7.3.2" href="#section-7.3.2">7.3.2</a>. Additional Procedures for Lite Implementations</span>
If the controlled agent receives a Binding request with the USE-
CANDIDATE attribute set, and if the ICE agent accepts the request,
the agent constructs a candidate pair whose local candidate has the
transport address on which the request was received, and whose remote
candidate is equal to the source transport address of the request
that was received. This candidate pair is assigned an arbitrary
priority and placed into the valid list of the associated checklist.
The agent sets the nominated flag for that pair to true.
Once the nominated flag is set for a component of a data stream, it
concludes the ICE processing for that component. See <a href="#section-8">Section 8</a>.
<span class="grey">Keranen, et al. Standards Track [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Concluding ICE Processing</span>
This section describes how an ICE agent completes ICE.
<span class="h3"><a class="selflink" id="section-8.1" href="#section-8.1">8.1</a>. Procedures for Full Implementations</span>
Concluding ICE involves nominating pairs by the controlling agent and
updating state machinery.
<span class="h4"><a class="selflink" id="section-8.1.1" href="#section-8.1.1">8.1.1</a>. Nominating Pairs</span>
Prior to nominating, the controlling agent lets connectivity checks
continue until some stopping criterion is met. After that, based on
an evaluation criterion, the controlling agent picks a pair among the
valid pairs in the valid list for nomination.
Once the controlling agent has picked a valid pair for nomination, it
repeats the connectivity check that produced this valid pair (by
enqueueing the pair that generated the check into the triggered-check
queue), this time with the USE-CANDIDATE attribute
(<a href="#section-7.2.5.3.4">Section 7.2.5.3.4</a>). The procedures for the controlled agent are
described in <a href="#section-7.3.1.5">Section 7.3.1.5</a>.
Eventually, if the nominations succeed, both the controlling and
controlled agents will have a single nominated pair in the valid list
for each component of the data stream. Once an ICE agent sets the
state of the checklist to Completed (when there is a nominated pair
for each component of the data stream), that pair becomes the
selected pair for that agent and is used for sending and receiving
data for that component of the data stream.
If an agent is not able to produce selected pairs for each component
of a data stream, the agent MUST take proper actions for informing
the other agent, e.g., by removing the stream. The exact actions are
outside the scope of this specification.
The criteria for stopping the connectivity checks and for picking a
pair for nomination are outside the scope of this specification.
They are a matter of local optimization. The only requirement is
that the agent MUST eventually pick one and only one candidate pair
and generate a check for that pair with the USE-CANDIDATE attribute
set.
Once the controlling agent has successfully nominated a candidate
pair (<a href="#section-7.2.5.3.4">Section 7.2.5.3.4</a>), the agent MUST NOT nominate another pair
for same component of the data stream within the ICE session. Doing
so requires an ICE restart.
<span class="grey">Keranen, et al. Standards Track [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
A controlling agent that does not support this specification (i.e.,
it is implemented according to <a href="./rfc5245">RFC 5245</a>) might nominate more than one
candidate pair. This was referred to as "aggressive nomination" in
<a href="./rfc5245">RFC 5245</a>. If more than one candidate pair is nominated by the
controlling agent, and if the controlled agent accepts multiple
nominations requests, the agents MUST produce the selected pairs and
use the pairs with the highest priority.
The usage of the 'ice2' ICE option (<a href="#section-10">Section 10</a>) by endpoints
supporting this specification is supposed to prevent controlling
agents that are implemented according to <a href="./rfc5245">RFC 5245</a> from using
aggressive nomination.
NOTE: In <a href="./rfc5245">RFC 5245</a>, usage of "aggressive nomination" allowed agents to
continuously nominate pairs, before a pair was eventually selected,
in order to allow sending of data on those pairs. In this
specification, data can always be sent on any valid pair, without
nomination. Hence, there is no longer a need for aggressive
nomination.
<span class="h4"><a class="selflink" id="section-8.1.2" href="#section-8.1.2">8.1.2</a>. Updating Checklist and ICE States</span>
For both a controlling and a controlled agent, when a candidate pair
for a component of a data stream gets nominated, it might impact
other pairs in the checklist associated with the data stream. It
might also impact the state of the checklist:
o Once a candidate pair for a component of a data stream has been
nominated, and the state of the checklist associated with the data
stream is Running, the ICE agent MUST remove all candidate pairs
for the same component from the checklist and from the triggered-
check queue. If the state of a pair is In-Progress, the agent
cancels the In-Progress transaction. Cancellation means that the
agent will not retransmit the Binding requests associated with the
connectivity-check transaction, will not treat the lack of
response to be a failure, but will wait the duration of the
transaction timeout for a response.
o Once candidate pairs for each component of a data stream have been
nominated, and the state of the checklist associated with the data
stream is Running, the ICE agent sets the state of the checklist
to Completed.
o Once a candidate pair for a component of a data stream has been
nominated, an agent MUST continue to respond to any Binding
request it might still receive for the nominated pair and for any
remaining candidate pairs in the checklist associated with the
<span class="grey">Keranen, et al. Standards Track [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
data stream. As defined in <a href="#section-7.3.1.4">Section 7.3.1.4</a>, when the state of a
pair is Succeeded, an agent will no longer generate triggered
checks when receiving a Binding request for the pair.
Once the state of each checklist in the checklist set is Completed,
the agent sets the state of the ICE session to Completed.
If the state of a checklist is Failed, ICE has not been able to
successfully complete the process for the data stream associated with
the checklist. The correct behavior depends on the state of the
checklists in the checklist set. If the controlling agent wants to
continue the session without the data stream associated with the
Failed checklist, and if there are still one or more checklists in
Running or Completed mode, the agent can let the ICE processing
continue. The agent MUST take proper actions for removing the failed
data stream. If the controlling agent does not want to continue the
session and MUST terminate the session, the state of the ICE session
is set to Failed.
If the state of each checklist in the checklist set is Failed, the
state of the ICE session is set to Failed. Unless the controlling
agent wants to continue the session without the data streams, it MUST
terminate the session.
<span class="h3"><a class="selflink" id="section-8.2" href="#section-8.2">8.2</a>. Procedures for Lite Implementations</span>
When ICE concludes, a lite ICE agent can free host candidates that
were not used by ICE, as described in <a href="#section-8.3">Section 8.3</a>.
If the peer is a full agent, once the lite agent accepts a nomination
request for a candidate pair, the lite agent considers the pair
nominated. Once there are nominated pairs for each component of a
data stream, the pairs become the selected pairs for the components
of the data stream. Once the lite agent has produced selected pairs
for all components of all data streams, the ICE session state is set
to Completed.
If the peer is a lite agent, the agent pairs local candidates with
remote candidates that are of the same data stream and have the same
component, transport protocol, and IP address family. For each
component of each data stream, if there is only one candidate pair,
that pair is added to the valid list. If there is more than one
pair, it is RECOMMENDED that an agent follow the procedures of <a href="./rfc6724">RFC</a>
<a href="./rfc6724">6724</a> [<a href="./rfc6724" title=""Default Address Selection for Internet Protocol Version 6 (IPv6)"">RFC6724</a>] to select a pair and add it to the valid list.
<span class="grey">Keranen, et al. Standards Track [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
If all of the components for all data streams had one pair, the state
of ICE processing is Completed. Otherwise, the controlling agent
MUST send an updated candidate list to reconcile different agents
selecting different candidate pairs. ICE processing is complete
after and only after the updated candidate exchange is complete.
<span class="h3"><a class="selflink" id="section-8.3" href="#section-8.3">8.3</a>. Freeing Candidates</span>
<span class="h4"><a class="selflink" id="section-8.3.1" href="#section-8.3.1">8.3.1</a>. Full Implementation Procedures</span>
The rules in this section describe when it is safe for an agent to
cease sending or receiving checks on a candidate that did not become
a selected candidate (i.e., is not associated with a selected pair)
and when to free the candidate.
Once a checklist has reached the Completed state, the agent SHOULD
wait an additional three seconds, and then it can cease responding to
checks or generating triggered checks on all local candidates other
than the ones that became selected candidates. Once all ICE sessions
have ceased using a given local candidate (a candidate may be used by
multiple ICE sessions, e.g., in forking scenarios), the agent can
free that candidate. The three-second delay handles cases when
aggressive nomination is used, and the selected pairs can quickly
change after ICE has completed.
Freeing of server-reflexive candidates is never explicit; it happens
by lack of a keepalive.
<span class="h4"><a class="selflink" id="section-8.3.2" href="#section-8.3.2">8.3.2</a>. Lite Implementation Procedures</span>
A lite implementation can free candidates that did not become
selected candidates as soon as ICE processing has reached the
Completed state for all ICE sessions using those candidates.
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. ICE Restarts</span>
An ICE agent MAY restart ICE for existing data streams. An ICE
restart causes all previous states of the data streams, excluding the
roles of the agents, to be flushed. The only difference between an
ICE restart and a brand new data session is that during the restart,
data can continue to be sent using existing data sessions, and a new
data session always requires the roles to be determined.
<span class="grey">Keranen, et al. Standards Track [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The following actions can be accomplished only by using an ICE
restart (the agent MUST use ICE restarts to do so):
o Change the destinations of data streams.
o Change from a lite implementation to a full implementation.
o Change from a full implementation to a lite implementation.
To restart ICE, an agent MUST change both the password and the
username fragment for the data stream(s) being restarted.
When the ICE is restarted, the candidate set for the new ICE session
might include some, none, or all of the candidates used in the
current ICE session.
As described in <a href="#section-6.1.1">Section 6.1.1</a>, agents MUST NOT redetermine the roles
as part as an ICE restart, unless certain criteria that require the
roles to be redetermined are fulfilled.
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. ICE Option</span>
This section defines a new ICE option, 'ice2'. When an ICE agent
includes 'ice2' in a candidate exchange, the ICE option indicates
that it is compliant to this specification. For example, the agent
will not use the aggressive nomination procedure defined in <a href="./rfc5245">RFC 5245</a>.
In addition, it will ensure that a peer compliant with <a href="./rfc5245">RFC 5245</a> does
not use aggressive nomination either, as required by <a href="./rfc5245#section-14">Section 14 of
RFC 5245</a> for peers that receive unknown ICE options.
An agent compliant to this specification MUST inform the peer about
the compliance using the 'ice2' option.
NOTE: The encoding of the 'ice2' option, and the message(s) used to
carry it to the peer, are protocol specific. The encoding for SDP
[<a href="./rfc4566" title=""SDP: Session Description Protocol"">RFC4566</a>] is defined in [<a href="#ref-ICE-SIP-SDP">ICE-SIP-SDP</a>].
<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>. Keepalives</span>
All endpoints MUST send keepalives for each data session. These
keepalives serve the purpose of keeping NAT bindings alive for the
data session. The keepalives SHOULD be sent using a format that is
supported by its peer. ICE endpoints allow for STUN-based keepalives
for UDP streams, and as such, STUN keepalives MUST be used when an
ICE agent is a full ICE implementation and is communicating with a
peer that supports ICE (lite or full).
<span class="grey">Keranen, et al. Standards Track [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
An agent MUST send a keepalive on each candidate pair that is used
for sending data if no packet has been sent on that pair in the last
Tr seconds. Agents SHOULD use a Tr value of 15 seconds. Agents MAY
use a bigger value but MUST NOT use a value smaller than 15 seconds.
Once selected pairs have been produced for a data stream, keepalives
are only sent on those pairs.
An agent MUST stop sending keepalives on a data stream if the data
stream is removed. If the ICE session is terminated, an agent MUST
stop sending keepalives on all data streams.
An agent MAY use another value for Tr, e.g., based on configuration
or network/NAT characteristics. For example, if an agent has a
dynamic way to discover the binding lifetimes of the intervening
NATs, it can use that value to determine Tr. Administrators
deploying ICE in more controlled networking environments SHOULD set
Tr to the longest duration possible in their environment.
When STUN is being used for keepalives, a STUN Binding Indication is
used [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>]. The Indication MUST NOT utilize any authentication
mechanism. It SHOULD contain the FINGERPRINT attribute to aid in
demultiplexing, but it SHOULD NOT contain any other attributes. It
is used solely to keep the NAT bindings alive. The Binding
Indication is sent using the same local and remote candidates that
are being used for data. Though Binding Indications are used for
keepalives, an agent MUST be prepared to receive a connectivity check
as well. If a connectivity check is received, a response is
generated as discussed in [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>], but there is no impact on ICE
processing otherwise.
Agents MUST by default use STUN keepalives. Individual ICE usages
and ICE extensions MAY specify usage-/extension-specific keepalives.
<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>. Data Handling</span>
<span class="h3"><a class="selflink" id="section-12.1" href="#section-12.1">12.1</a>. Sending Data</span>
An ICE agent MAY send data on any valid pair before selected pairs
have been produced for the data stream.
Once selected pairs have been produced for a data stream, an agent
MUST send data on those pairs only.
An agent sends data from the base of the local candidate to the
remote candidate. In the case of a local relayed candidate, data is
forwarded through the base (located in the TURN server), using the
procedures defined in [<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>].
<span class="grey">Keranen, et al. Standards Track [Page 55]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
If the local candidate is a relayed candidate, it is RECOMMENDED that
an agent creates a channel on the TURN server towards the remote
candidate. This is done using the procedures for channel creation as
defined in <a href="./rfc5766#section-11">Section 11 of [RFC5766]</a>.
The selected pair for a component of a data stream is:
o empty if the state of the checklist for that data stream is
Running, and there is no previous selected pair for that component
due to an ICE restart
o equal to the previous selected pair for a component of a data
stream if the state of the checklist for that data stream is
Running, and there was a previous selected pair for that component
due to an ICE restart
Unless an agent is able to produce a selected pair for each component
associated with a data stream, the agent MUST NOT continue sending
data for any component associated with that data stream.
<span class="h4"><a class="selflink" id="section-12.1.1" href="#section-12.1.1">12.1.1</a>. Procedures for Lite Implementations</span>
A lite implementation MUST NOT send data until it has a valid list
that contains a candidate pair for each component of that data
stream. Once that happens, the ICE agent MAY begin sending data
packets. To do that, it sends data to the remote candidate in the
pair (setting the destination address and port of the packet equal to
that remote candidate) and will send it from the base associated with
the candidate pair used for sending data. In case of a relayed
candidate, data is sent from the agent and forwarded through the base
(located in the TURN server), using the procedures defined in
[<a href="./rfc5766" title=""Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)"">RFC5766</a>].
<span class="h3"><a class="selflink" id="section-12.2" href="#section-12.2">12.2</a>. Receiving Data</span>
Even though ICE agents are only allowed to send data using valid
candidate pairs (and, once selected pairs have been produced, only on
the selected pairs), ICE implementations SHOULD by default be
prepared to receive data on any of the candidates provided in the
most recent candidate exchange with the peer. ICE usages MAY define
rules that differ from this, e.g., by defining that data will not be
sent until selected pairs have been produced for a data stream.
When an agent receives an RTP packet with a new source or destination
IP address for a particular RTP/RTCP data stream, it is RECOMMENDED
that the agent readjust its jitter buffers.
<span class="grey">Keranen, et al. Standards Track [Page 56]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<a href="./rfc3550#section-8.2">Section 8.2 of RFC 3550</a> [<a href="./rfc3550" title=""RTP: A Transport Protocol for Real-Time Applications"">RFC3550</a>] describes an algorithm for
detecting synchronization source (SSRC) collisions and loops. These
algorithms are based, in part, on seeing different source transport
addresses with the same SSRC. However, when ICE is used, such
changes will sometimes occur as the data streams switch between
candidates. An agent will be able to determine that a data stream is
from the same peer as a consequence of the STUN exchange that
proceeds media data transmission. Thus, if there is a change in the
source transport address, but the media data packets come from the
same peer agent, this MUST NOT be treated as an SSRC collision.
<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>. Extensibility Considerations</span>
This specification makes very specific choices about how both ICE
agents in a session coordinate to arrive at the set of candidate
pairs that are selected for data. It is anticipated that future
specifications will want to alter these algorithms, whether they are
simple changes like timer tweaks or larger changes like a revamp of
the priority algorithm. When such a change is made, providing
interoperability between the two agents in a session is critical.
First, ICE provides the ICE option concept. Each extension or change
to ICE is associated with an ICE option. When an agent supports such
an extension or change, it provides the ICE option to the peer agent
as part of the candidate exchange.
One of the complications in achieving interoperability is that ICE
relies on a distributed algorithm running on both agents to converge
on an agreed set of candidate pairs. If the two agents run different
algorithms, it can be difficult to guarantee convergence on the same
candidate pairs. The nomination procedure described in <a href="#section-8">Section 8</a>
eliminates some of the need for tight coordination by delegating the
selection algorithm completely to the controlling agent, and ICE will
converge perfectly even when both agents use different pair
prioritization algorithms. One of the keys to such convergence is
triggered checks, which ensure that the nominated pair is validated
by both agents.
ICE is also extensible to other data streams beyond RTP and for
transport protocols beyond UDP. Extensions to ICE for non-RTP data
streams need to specify how many components they utilize and assign
component IDs to them, starting at 1 for the most important component
ID. Specifications for new transport protocols MUST define how, if
at all, various steps in the ICE processing differ from UDP.
<span class="grey">Keranen, et al. Standards Track [Page 57]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-14" href="#section-14">14</a>. Setting Ta and RTO</span>
<span class="h3"><a class="selflink" id="section-14.1" href="#section-14.1">14.1</a>. General</span>
During the ICE gathering phase (<a href="#section-5.1.1">Section 5.1.1</a>) and while ICE is
performing connectivity checks (<a href="#section-7">Section 7</a>), an ICE agent triggers
STUN and TURN transactions. These transactions are paced at a rate
indicated by Ta, and the retransmission interval for each transaction
is calculated based on the retransmission timer for the STUN
transactions (RTO) [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>].
This section describes how the Ta and RTO values are computed during
the ICE gathering phase and while ICE is performing connectivity
checks.
NOTE: Previously, in <a href="./rfc5245">RFC 5245</a>, different formulas were defined for
computing Ta and RTO, depending on whether or not ICE was used for a
real-time data stream (e.g., RTP).
The formulas below result in a behavior whereby an agent will send
its first packet for every single connectivity check before
performing a retransmit. This can be seen in the formulas for the
RTO (which represents the retransmit interval). Those formulas scale
with N, the number of checks to be performed. As a result of this,
ICE maintains a nicely constant rate, but it becomes more sensitive
to packet loss. The loss of the first single packet for any
connectivity check is likely to cause that pair to take a long time
to be validated, and instead, a lower-priority check (but one for
which there was no packet loss) is much more likely to complete
first. This results in ICE performing suboptimally, choosing lower-
priority pairs over higher-priority pairs.
<span class="h3"><a class="selflink" id="section-14.2" href="#section-14.2">14.2</a>. Ta</span>
ICE agents SHOULD use a default Ta value, 50 ms, but MAY use another
value based on the characteristics of the associated data.
If an agent wants to use a Ta value other than the default value, the
agent MUST indicate the proposed value to its peer during the
establishment of the ICE session. Both agents MUST use the higher
value of the proposed values. If an agent does not propose a value,
the default value is used for that agent when comparing which value
is higher.
Regardless of the Ta value chosen for each agent, the combination of
all transactions from all agents (if a given implementation runs
several concurrent agents) MUST NOT be sent more often than once
<span class="grey">Keranen, et al. Standards Track [Page 58]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
every 5 ms (as though there were one global Ta value for pacing all
agents). See <a href="#appendix-B.1">Appendix B.1</a> for the background of using a value of
5 ms with ICE.
NOTE: <a href="#appendix-C">Appendix C</a> shows examples of required bandwidth, using
different Ta values.
<span class="h3"><a class="selflink" id="section-14.3" href="#section-14.3">14.3</a>. RTO</span>
During the ICE gathering phase, ICE agents SHOULD calculate the RTO
value using the following formula:
RTO = MAX (500ms, Ta * (Num-Of-Cands))
Num-Of-Cands: the number of server-reflexive and relay candidates
For connectivity checks, agents SHOULD calculate the RTO value using
the following formula:
RTO = MAX (500ms, Ta * N * (Num-Waiting + Num-In-Progress))
N: the total number of connectivity checks to be performed.
Num-Waiting: the number of checks in the checklist set in the
Waiting state.
Num-In-Progress: the number of checks in the checklist set in the
In-Progress state.
Note that the RTO will be different for each transaction as the
number of checks in the Waiting and In-Progress states change.
Agents MAY calculate the RTO value using other mechanisms than those
described above. Agents MUST NOT use an RTO value smaller than
500 ms.
<span class="h2"><a class="selflink" id="section-15" href="#section-15">15</a>. Examples</span>
This section shows two ICE examples: one using IPv4 addresses and one
using IPv6 addresses.
To facilitate understanding, transport addresses are listed using
variables that have mnemonic names. The format of the name is
entity-type-seqno: "entity" refers to the entity whose IP address the
transport address is on and is one of "L", "R", "STUN", or "NAT".
The type is either "PUB" for transport addresses that are public or
"PRIV" for transport addresses that are private [<a href="./rfc1918" title=""Address Allocation for Private Internets"">RFC1918</a>]. Finally,
<span class="grey">Keranen, et al. Standards Track [Page 59]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
seq-no is a sequence number that is different for each transport
address of the same type on a particular entity. Each variable has
an IP address and port, denoted by varname.IP and varname.PORT,
respectively, where varname is the name of the variable.
In the call flow itself, STUN messages are annotated with several
attributes. The "S=" attribute indicates the source transport
address of the message. The "D=" attribute indicates the destination
transport address of the message. The "MA=" attribute is used in
STUN Binding response messages and refers to the mapped address.
"USE-CAND" implies the presence of the USE-CANDIDATE attribute.
The call flow examples omit STUN authentication operations and focus
on a single data stream between two full implementations.
<span class="h3"><a class="selflink" id="section-15.1" href="#section-15.1">15.1</a>. Example with IPv4 Addresses</span>
The example below is using the topology shown in Figure 7.
+-------+
|STUN |
|Server |
+-------+
|
+---------------------+
| |
| Internet |
| |
+---------------------+
| |
| |
+---------+ |
| NAT | |
+---------+ |
| |
| |
+-----+ +-----+
| L | | R |
+-----+ +-----+
Figure 7: Example Topology
<span class="grey">Keranen, et al. Standards Track [Page 60]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
In the example, ICE agents L and R are full ICE implementations.
Both agents have a single IPv4 address, and both are configured with
the same STUN server. The NAT has an endpoint-independent mapping
property and an address-dependent filtering property. The IP
addresses of the ICE agents, the STUN server, and the NAT are shown
below:
ENTITY IP Address Mnemonic name
--------------------------------------------------
ICE Agent L: 10.0.1.1 L-PRIV-1
ICE Agent R: 192.0.2.1 R-PUB-1
STUN Server: 192.0.2.2 STUN-PUB-1
NAT (Public): 192.0.2.3 NAT-PUB-1
L NAT STUN R
|STUN alloc. | | |
|(1) STUN Req | | |
|S=$L-PRIV-1 | | |
|D=$STUN-PUB-1 | | |
|------------->| | |
| |(2) STUN Req | |
| |S=$NAT-PUB-1 | |
| |D=$STUN-PUB-1 | |
| |------------->| |
| |(3) STUN Res | |
| |S=$STUN-PUB-1 | |
| |D=$NAT-PUB-1 | |
| |MA=$NAT-PUB-1 | |
| |<-------------| |
|(4) STUN Res | | |
|S=$STUN-PUB-1 | | |
|D=$L-PRIV-1 | | |
|MA=$NAT-PUB-1 | | |
|<-------------| | |
|(5) L's Candidate Information| |
|------------------------------------------->|
| | | | STUN
| | | | alloc.
| | |(6) STUN Req |
| | |S=$R-PUB-1 |
| | |D=$STUN-PUB-1 |
| | |<-------------|
| | |(7) STUN Res |
| | |S=$STUN-PUB-1 |
| | |D=$R-PUB-1 |
| | |MA=$R-PUB-1 |
| | |------------->|
<span class="grey">Keranen, et al. Standards Track [Page 61]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
|(8) R's Candidate Information| |
|<-------------------------------------------|
| | (9) Bind Req |Begin
| | S=$R-PUB-1 |Connectivity
| | D=$L-PRIV-1 |Checks
| | <-------------------|
| | Dropped |
|(10) Bind Req | | |
|S=$L-PRIV-1 | | |
|D=$R-PUB-1 | | |
|------------->| | |
| |(11) Bind Req | |
| |S=$NAT-PUB-1 | |
| |D=$R-PUB-1 | |
| |---------------------------->|
| |(12) Bind Res | |
| |S=$R-PUB-1 | |
| |D=$NAT-PUB-1 | |
| |MA=$NAT-PUB-1 | |
| |<----------------------------|
|(13) Bind Res | | |
|S=$R-PUB-1 | | |
|D=$L-PRIV-1 | | |
|MA=$NAT-PUB-1 | | |
|<-------------| | |
|Data | | |
|===========================================>|
| | | |
| |(14) Bind Req | |
| |S=$R-PUB-1 | |
| |D=$NAT-PUB-1 | |
| |<----------------------------|
|(15) Bind Req | | |
|S=$R-PUB-1 | | |
|D=$L-PRIV-1 | | |
|<-------------| | |
|(16) Bind Res | | |
|S=$L-PRIV-1 | | |
|D=$R-PUB-1 | | |
|MA=$R-PUB-1 | | |
|------------->| | |
| |(17) Bind Res | |
| |S=$NAT-PUB-1 | |
| |D=$R-PUB-1 | |
| |MA=$R-PUB-1 | |
| |---------------------------->|
|Data | | |
|<===========================================|
<span class="grey">Keranen, et al. Standards Track [Page 62]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
| | | |
.......
| | | |
|(18) Bind Req | | |
|S=$L-PRIV-1 | | |
|D=$R-PUB-1 | | |
|USE-CAND | | |
|------------->| | |
| |(19) Bind Req | |
| |S=$NAT-PUB-1 | |
| |D=$R-PUB-1 | |
| |USE-CAND | |
| |---------------------------->|
| |(20) Bind Res | |
| |S=$R-PUB-1 | |
| |D=$NAT-PUB-1 | |
| |MA=$NAT-PUB-1 | |
| |<----------------------------|
|(21) Bind Res | | |
|S=$R-PUB-1 | | |
|D=$L-PRIV-1 | | |
|MA=$NAT-PUB-1 | | |
|<-------------| | |
| | | |
Figure 8: Example Flow
Messages 1-4: Agent L gathers a host candidate from its local IP
address, and from that it sends a STUN Binding request to the STUN
server. The request creates a NAT binding. The NAT public IP
address of the binding becomes agent L's server-reflexive candidate.
Message 5: Agent L sends its local candidate information to agent R,
using the signaling protocol associated with the ICE usage.
Messages 6-7: Agent R gathers a host candidate from its local IP
address, and from that it sends a STUN Binding request to the STUN
server. Since agent R is not behind a NAT, R's server-reflexive
candidate will be identical to the host candidate.
Message 8: Agent R sends its local candidate information to agent L,
using the signaling protocol associated with the ICE usage.
Since both agents are full ICE implementations, the initiating agent
(agent L) becomes the controlling agent.
<span class="grey">Keranen, et al. Standards Track [Page 63]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Agents L and R both pair up the candidates. Both agents initially
have two pairs. However, agent L will prune the pair containing its
server-reflexive candidate, resulting in just one (L1). At agent L,
this pair has a local candidate of $L_PRIV_1 and a remote candidate
of $R_PUB_1. At agent R, there are two pairs. The highest-priority
pair (R1) has a local candidate of $R_PUB_1 and a remote candidate of
$L_PRIV_1, and the second pair (R2) has a local candidate of $R_PUB_1
and a remote candidate of $NAT_PUB_1. The pairs are shown below (the
pair numbers are for reference purposes only):
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PRIV_1 R_PUB_1 L1
ICE Agent R: R_PUB_1 L_PRIV_1 R1
R_PUB_1 NAT_PUB_1 R2
Message 9: Agent R initiates a connectivity check for pair #2. As
the remote candidate of the pair is the private address of agent L,
the check will not be successful, as the request cannot be routed
from R to L, and will be dropped by the network.
Messages 10-13: Agent L initiates a connectivity check for pair L1.
The check succeeds, and L creates a new pair (L2). The local
candidate of the new pair is $NAT_PUB_1, and the remote candidate is
$R_PUB_1. The pair (L2) is added to the valid list of agent L.
Agent L can now send and receive data on the pair (L2) if it wishes.
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PRIV_1 R_PUB_1 L1
NAT_PUB_1 R_PUB_1 L2 X
ICE Agent R: R_PUB_1 L_PRIV_1 R1
R_PUB_1 NAT_PUB_1 R2
Messages 14-17: When agent R receives the Binding request from agent
L (message 11), it will initiate a triggered connectivity check. The
pair matches one of agent R's existing pairs (R2). The check
succeeds, and the pair (R2) is added to the valid list of agent R.
Agent R can now send and receive data on the pair (R2) if it wishes.
<span class="grey">Keranen, et al. Standards Track [Page 64]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PRIV_1 R_PUB_1 L1
NAT_PUB_1 R_PUB_1 L2 X
ICE Agent R: R_PUB_1 L_PRIV_1 R1
R_PUB_1 NAT_PUB_1 R2 X
Messages 18-21: At some point, the controlling agent (agent L)
decides to nominate a pair (L2) in the valid list. It performs a
connectivity check on the pair (L2) and includes the USE-CANDIDATE
attribute in the Binding request. As the check succeeds, agent L
sets the nominated flag value of the pair (L2) to 'true', and agent R
sets the nominated flag value of the matching pair (R2) to 'true'.
As there are no more components associated with the stream, the
nominated pairs become the selected pairs. Consequently, processing
for this stream moves into the Completed state. The ICE process also
moves into the Completed state.
<span class="h3"><a class="selflink" id="section-15.2" href="#section-15.2">15.2</a>. Example with IPv6 Addresses</span>
The example below is using the topology shown in Figure 9.
+-------+
|STUN |
|Server |
+-------+
|
+---------------------+
| |
| Internet |
| |
+---------------------+
| |
| |
| |
| |
| |
| |
| |
+-----+ +-----+
| L | | R |
+-----+ +-----+
Figure 9: Example Topology
<span class="grey">Keranen, et al. Standards Track [Page 65]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
In the example, ICE agents L and R are full ICE implementations.
Both agents have a single IPv6 address, and both are configured with
the same STUN server. The IP addresses of the ICE agents and the
STUN server are shown below:
ENTITY IP Address mnemonic name
--------------------------------------------------
ICE Agent L: 2001:db8::3 L-PUB-1
ICE Agent R: 2001:db8::5 R-PUB-1
STUN Server: 2001:db8::9 STUN-PUB-1
L STUN R
|STUN alloc. | |
|(1) STUN Req | |
|S=$L-PUB-1 | |
|D=$STUN-PUB-1 | |
|---------------------------->| |
|(2) STUN Res | |
| S=$STUN-PUB-1 | |
| D=$L-PUB-1 | |
| MA=$L-PUB-1 | |
|<----------------------------| |
|(3) L's Candidate Information| |
|------------------------------------------->|
| | | STUN
| | | alloc.
| |(4) STUN Req |
| |S=$R-PUB-1 |
| |D=$STUN-PUB-1 |
| |<-------------|
| |(5) STUN Res |
| |S=$STUN-PUB-1 |
| |D=$R-PUB-1 |
| |MA=$R-PUB-1 |
| |------------->|
|(6) R's Candidate Information| |
|<-------------------------------------------|
|(7) Bind Req | |
|S=$L-PUB-1 | |
|D=$R-PUB-1 | |
|------------------------------------------->|
|(8) Bind Res | |
|S=$R-PUB-1 | |
|D=$L-PUB-1 | |
|MA=$L-PUB-1 | |
|<-------------------------------------------|
<span class="grey">Keranen, et al. Standards Track [Page 66]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
|Data | |
|===========================================>|
| | |
|(9) Bind Req | |
|S=$R-PUB-1 | |
|D=$L-PUB-1 | |
|<-------------------------------------------|
|(10) Bind Res | |
|S=$L-PUB-1 | |
|D=$R-PUB-1 | |
|MA=$R-PUB-1 | |
|------------------------------------------->|
|Data | |
|<===========================================|
| | |
.......
| | |
|(11) Bind Req | |
|S=$L-PUB-1 | |
|D=$R-PUB-1 | |
|USE-CAND | |
|------------------------------------------->|
|(12) Bind Res | |
|S=$R-PUB-1 | |
|D=$L-PUB-1 | |
|MA=$L-PUB-1 | |
|<-------------------------------------------|
| | | |
Figure 10: Example Flow
Messages 1-2: Agent L gathers a host candidate from its local IP
address, and from that it sends a STUN Binding request to the STUN
server. Since agent L is not behind a NAT, L's server-reflexive
candidate will be identical to the host candidate.
Message 3: Agent L sends its local candidate information to agent R,
using the signaling protocol associated with the ICE usage.
Messages 4-5: Agent R gathers a host candidate from its local IP
address, and from that it sends a STUN Binding request to the STUN
server. Since agent R is not behind a NAT, R's server-reflexive
candidate will be identical to the host candidate.
Message 6: Agent R sends its local candidate information to agent L,
using the signaling protocol associated with the ICE usage.
<span class="grey">Keranen, et al. Standards Track [Page 67]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Since both agents are full ICE implementations, the initiating agent
(agent L) becomes the controlling agent.
Agents L and R both pair up the candidates. Both agents initially
have one pair each. At agent L, the pair (L1) has a local candidate
of $L_PUB_1 and a remote candidate of $R_PUB_1. At agent R, the pair
(R1) has a local candidate of $R_PUB_1 and a remote candidate of
$L_PUB_1. The pairs are shown below (the pair numbers are for
reference purpose only):
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PUB_1 R_PUB_1 L1
ICE Agent R: R_PUB_1 L_PUB_1 R1
Messages 7-8: Agent L initiates a connectivity check for pair L1.
The check succeeds, and the pair (L1) is added to the valid list of
agent L. Agent L can now send and receive data on the pair (L1) if
it wishes.
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PUB_1 R_PUB_1 L1 X
ICE Agent R: R_PUB_1 L_PUB_1 R1
Messages 9-10: When agent R receives the Binding request from agent L
(message 7), it will initiate a triggered connectivity check. The
pair matches agent R's existing pair (R1). The check succeeds, and
the pair (R1) is added to the valid list of agent R. Agent R can now
send and receive data on the pair (R1) if it wishes.
Pairs
ENTITY Local Remote Pair # Valid
------------------------------------------------------------------
ICE Agent L: L_PUB_1 R_PUB_1 L1 X
ICE Agent R: R_PUB_1 L_PUB_1 R1 X
Messages 11-12: At some point, the controlling agent (agent L)
decides to nominate a pair (L1) in the valid list. It performs a
connectivity check on the pair (L1) and includes the USE-CANDIDATE
attribute in the Binding request. As the check succeeds, agent L
sets the nominated flag value of the pair (L1) to 'true', and agent R
sets the nominated flag value of the matching pair (R1) to 'true'.
<span class="grey">Keranen, et al. Standards Track [Page 68]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-69" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
As there are no more components associated with the stream, the
nominated pairs become the selected pairs. Consequently, processing
for this stream moves into the Completed state. The ICE process also
moves into the Completed state.
<span class="h2"><a class="selflink" id="section-16" href="#section-16">16</a>. STUN Extensions</span>
<span class="h3"><a class="selflink" id="section-16.1" href="#section-16.1">16.1</a>. Attributes</span>
This specification defines four STUN attributes: PRIORITY,
USE-CANDIDATE, ICE-CONTROLLED, and ICE-CONTROLLING.
The PRIORITY attribute indicates the priority that is to be
associated with a peer-reflexive candidate, if one will be discovered
by this check. It is a 32-bit unsigned integer and has an attribute
value of 0x0024.
The USE-CANDIDATE attribute indicates that the candidate pair
resulting from this check will be used for transmission of data. The
attribute has no content (the Length field of the attribute is zero);
it serves as a flag. It has an attribute value of 0x0025.
The ICE-CONTROLLED attribute is present in a Binding request. The
attribute indicates that the client believes it is currently in the
controlled role. The content of the attribute is a 64-bit unsigned
integer in network byte order, which contains a random number. The
number is used for solving role conflicts, when it is referred to as
the "tiebreaker value". An ICE agent MUST use the same number for
all Binding requests, for all streams, within an ICE session, unless
it has received a 487 response, in which case it MUST change the
number (<a href="#section-7.2.5.1">Section 7.2.5.1</a>). The agent MAY change the number when an
ICE restart occurs.
The ICE-CONTROLLING attribute is present in a Binding request. The
attribute indicates that the client believes it is currently in the
controlling role. The content of the attribute is a 64-bit unsigned
integer in network byte order, which contains a random number. As
for the ICE-CONTROLLED attribute, the number is used for solving role
conflicts. An agent MUST use the same number for all Binding
requests, for all streams, within an ICE session, unless it has
received a 487 response, in which case it MUST change the number
(<a href="#section-7.2.5.1">Section 7.2.5.1</a>). The agent MAY change the number when an ICE
restart occurs.
<span class="grey">Keranen, et al. Standards Track [Page 69]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-70" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="section-16.2" href="#section-16.2">16.2</a>. New Error-Response Codes</span>
This specification defines a single error-response code:
487 (Role Conflict): The Binding request contained either the ICE-
CONTROLLING or ICE-CONTROLLED attribute, indicating an ICE role
that conflicted with the server. The remote server compared the
tiebreaker values of the client and the server and determined that
the client needs to switch roles.
<span class="h2"><a class="selflink" id="section-17" href="#section-17">17</a>. Operational Considerations</span>
This section discusses issues relevant to operators operating
networks where ICE will be used by endpoints.
<span class="h3"><a class="selflink" id="section-17.1" href="#section-17.1">17.1</a>. NAT and Firewall Types</span>
ICE was designed to work with existing NAT and firewall equipment.
Consequently, it is not necessary to replace or reconfigure existing
firewall and NAT equipment in order to facilitate deployment of ICE.
Indeed, ICE was developed to be deployed in environments where the
Voice over IP (VoIP) operator has no control over the IP network
infrastructure, including firewalls and NATs.
That said, ICE works best in environments where the NAT devices are
"behave" compliant, meeting the recommendations defined in [<a href="./rfc4787" title=""Network Address Translation (NAT) Behavioral Requirements for Unicast UDP"">RFC4787</a>]
and [<a href="./rfc5382" title=""NAT Behavioral Requirements for TCP"">RFC5382</a>]. In networks with behave-compliant NAT, ICE will work
without the need for a TURN server, thus improving voice quality,
decreasing call setup times, and reducing the bandwidth demands on
the network operator.
<span class="h3"><a class="selflink" id="section-17.2" href="#section-17.2">17.2</a>. Bandwidth Requirements</span>
Deployment of ICE can have several interactions with available
network capacity that operators need to take into consideration.
<span class="h4"><a class="selflink" id="section-17.2.1" href="#section-17.2.1">17.2.1</a>. STUN and TURN Server-Capacity Planning</span>
First and foremost, ICE makes use of TURN and STUN servers, which
would typically be located in data centers. The STUN servers require
relatively little bandwidth. For each component of each data stream,
there will be one or more STUN transactions from each client to the
STUN server. In a basic voice-only IPv4 VoIP deployment, there will
be four transactions per call (one for RTP and one for RTCP, for both
the caller and callee). Each transaction is a single request and a
single response, the former being 20 bytes long, and the latter, 28.
<span class="grey">Keranen, et al. Standards Track [Page 70]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-71" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Consequently, if a system has N users, and each makes four calls in a
busy hour, this would require N*1.7bps. For one million users, this
is 1.7 Mbps, a very small number (relatively speaking).
TURN traffic is more substantial. The TURN server will see traffic
volume equal to the STUN volume (indeed, if TURN servers are
deployed, there is no need for a separate STUN server), in addition
to the traffic for the actual data. The amount of calls requiring
TURN for data relay is highly dependent on network topologies, and
can and will vary over time. In a network with 100% behave-compliant
NATs, it is exactly zero.
The planning considerations above become more significant in
multimedia scenarios (e.g., audio and video conferences) and when the
numbers of participants in a session grow.
<span class="h4"><a class="selflink" id="section-17.2.2" href="#section-17.2.2">17.2.2</a>. Gathering and Connectivity Checks</span>
The process of gathering candidates and performing connectivity
checks can be bandwidth intensive. ICE has been designed to pace
both of these processes. The gathering and connectivity-check phases
are meant to generate traffic at roughly the same bandwidth as the
data traffic itself will consume once the ICE process concludes.
This was done to ensure that if a network is designed to support
communication traffic of a certain type (voice, video, or just text),
it will have sufficient capacity to support the ICE checks for that
data. Once ICE has concluded, the subsequent ICE keepalives will
later cause a marginal increase in the total bandwidth utilization;
however, this will typically be an extremely small increase.
Congestion due to the gathering and check phases has proven to be a
problem in deployments that did not utilize pacing. Typically,
access links became congested as the endpoints flooded the network
with checks as fast as they could send them. Consequently, network
operators need to ensure that their ICE implementations support the
pacing feature. Though this pacing does increase call setup times,
it makes ICE network friendly and easier to deploy.
<span class="h4"><a class="selflink" id="section-17.2.3" href="#section-17.2.3">17.2.3</a>. Keepalives</span>
STUN keepalives (in the form of STUN Binding Indications) are sent in
the middle of a data session. However, they are sent only in the
absence of actual data traffic. In deployments with continuous media
and without utilizing Voice Activity Detection (VAD), or deployments
where VAD is utilized together with short interval (max 1 second)
comfort noise, the keepalives are never used and there is no increase
in bandwidth usage. When VAD is being used without comfort noise,
keepalives will be sent during silence periods. This involves a
<span class="grey">Keranen, et al. Standards Track [Page 71]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-72" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
single packet every 15-20 seconds, far less than the packet every
20-30 ms that is sent when there is voice. Therefore, keepalives do
not have any real impact on capacity planning.
<span class="h3"><a class="selflink" id="section-17.3" href="#section-17.3">17.3</a>. ICE and ICE-Lite</span>
Deployments utilizing a mix of ICE and ICE-lite interoperate with
each other. They have been explicitly designed to do so.
However, ICE-lite can only be deployed in limited use cases. Those
cases, and the caveats involved in doing so, are documented in
<a href="#appendix-A">Appendix A</a>.
<span class="h3"><a class="selflink" id="section-17.4" href="#section-17.4">17.4</a>. Troubleshooting and Performance Management</span>
ICE utilizes end-to-end connectivity checks and places much of the
processing in the endpoints. This introduces a challenge to the
network operator -- how can they troubleshoot ICE deployments? How
can they know how ICE is performing?
ICE has built-in features to help deal with these problems.
Signaling servers, typically deployed in data centers of the network
operator, will see the contents of the candidate exchanges that
convey the ICE parameters. These parameters include the type of each
candidate (host, server reflexive, or relayed), along with their
related addresses. Once ICE processing has completed, an updated
candidate exchange takes place, signaling the selected address (and
its type). This updated signaling is performed exactly for the
purposes of educating network equipment (such as a diagnostic tool
attached to a signaling) about the results of ICE processing.
As a consequence, through the logs generated by a signaling server, a
network operator can observe what types of candidates are being used
for each call and what addresses were selected by ICE. This is the
primary information that helps evaluate how ICE is performing.
<span class="h3"><a class="selflink" id="section-17.5" href="#section-17.5">17.5</a>. Endpoint Configuration</span>
ICE relies on several pieces of data being configured into the
endpoints. This configuration data includes timers, credentials for
TURN servers, and hostnames for STUN and TURN servers. ICE itself
does not provide a mechanism for this configuration. Instead, it is
assumed that this information is attached to whatever mechanism is
used to configure all of the other parameters in the endpoint. For
SIP phones, standard solutions such as the configuration framework
[<a href="./rfc6080" title=""A Framework for Session Initiation Protocol User Agent Profile Delivery"">RFC6080</a>] have been defined.
<span class="grey">Keranen, et al. Standards Track [Page 72]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-73" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-18" href="#section-18">18</a>. IAB Considerations</span>
The IAB has studied the problem of "Unilateral Self-Address Fixing"
(UNSAF), which is the general process by which an ICE agent attempts
to determine its address in another realm on the other side of a NAT
through a collaborative protocol reflection mechanism [<a href="./rfc3424" title=""IAB Considerations for UNilateral Self-Address Fixing (UNSAF) Across Network Address Translation"">RFC3424</a>]. ICE
is an example of a protocol that performs this type of function.
Interestingly, the process for ICE is not unilateral, but bilateral,
and the difference has a significant impact on the issues raised by
the IAB. Indeed, ICE can be considered a Bilateral Self-Address
Fixing (B-SAF) protocol, rather than an UNSAF protocol. Regardless,
the IAB has mandated that any protocols developed for this purpose
document a specific set of considerations. This section meets those
requirements.
<span class="h3"><a class="selflink" id="section-18.1" href="#section-18.1">18.1</a>. Problem Definition</span>
From <a href="./rfc3424">RFC 3424</a>, any UNSAF proposal needs to provide:
Precise definition of a specific, limited-scope problem that is to
be solved with the UNSAF proposal. A short term fix should not be
generalized to solve other problems. Such generalizations lead to
the the prolonged dependence on and usage of the supposed short
term fix -- meaning that it is no longer accurate to call it
"short term".
The specific problems being solved by ICE are:
Providing a means for two peers to determine the set of transport
addresses that can be used for communication.
Providing a means for an agent to determine an address that is
reachable by another peer with which it wishes to communicate.
<span class="h3"><a class="selflink" id="section-18.2" href="#section-18.2">18.2</a>. Exit Strategy</span>
From <a href="./rfc3424">RFC 3424</a>, any UNSAF proposal needs to provide:
Description of an exit strategy/transition plan. The better short
term fixes are the ones that will naturally see less and less use
as the appropriate technology is deployed.
ICE itself doesn't easily get phased out. However, it is useful even
in a globally connected Internet, to serve as a means for detecting
whether a router failure has temporarily disrupted connectivity, for
example. ICE also helps prevent certain security attacks that have
nothing to do with NAT. However, what ICE does is help phase out
other UNSAF mechanisms. ICE effectively picks amongst those
<span class="grey">Keranen, et al. Standards Track [Page 73]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-74" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
mechanisms, prioritizing ones that are better and deprioritizing ones
that are worse. As NATs begin to dissipate as IPv6 is introduced,
server-reflexive and relayed candidates (both forms of UNSAF
addresses) simply never get used, because higher-priority
connectivity exists to the native host candidates. Therefore, the
servers get used less and less and can eventually be removed when
their usage goes to zero.
Indeed, ICE can assist in the transition from IPv4 to IPv6. It can
be used to determine whether to use IPv6 or IPv4 when two dual-stack
hosts communicate with SIP (IPv6 gets used). It can also allow a
network with both 6to4 and native v6 connectivity to determine which
address to use when communicating with a peer.
<span class="h3"><a class="selflink" id="section-18.3" href="#section-18.3">18.3</a>. Brittleness Introduced by ICE</span>
From <a href="./rfc3424">RFC 3424</a>, any UNSAF proposal needs to provide:
Discussion of specific issues that may render systems more
"brittle". For example, approaches that involve using data at
multiple network layers create more dependencies, increase
debugging challenges, and make it harder to transition.
ICE actually removes brittleness from existing UNSAF mechanisms. In
particular, classic STUN (as described in <a href="./rfc3489">RFC 3489</a> [<a href="./rfc3489" title=""STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs)"">RFC3489</a>]) has
several points of brittleness. One of them is the discovery process
that requires an ICE agent to try to classify the type of NAT it is
behind. This process is error prone. With ICE, that discovery
process is simply not used. Rather than unilaterally assessing the
validity of the address, its validity is dynamically determined by
measuring connectivity to a peer. The process of determining
connectivity is very robust.
Another point of brittleness in classic STUN and any other unilateral
mechanism is its absolute reliance on an additional server. ICE
makes use of a server for allocating unilateral addresses, but it
allows agents to directly connect if possible. Therefore, in some
cases, the failure of a STUN server would still allow for a call to
progress when ICE is used.
Another point of brittleness in classic STUN is that it assumes the
STUN server is on the public Internet. Interestingly, with ICE, that
is not necessary. There can be a multitude of STUN servers in a
variety of address realms. ICE will discover the one that has
provided a usable address.
<span class="grey">Keranen, et al. Standards Track [Page 74]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-75" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The most troubling point of brittleness in classic STUN is that it
doesn't work in all network topologies. In cases where there is a
shared NAT between each agent and the STUN server, traditional STUN
may not work. With ICE, that restriction is removed.
Classic STUN also introduces some security considerations.
Fortunately, those security considerations are also mitigated by ICE.
Consequently, ICE serves to repair the brittleness introduced in
classic STUN, and it does not introduce any additional brittleness
into the system.
The penalty of these improvements is that ICE increases session
establishment times.
<span class="h3"><a class="selflink" id="section-18.4" href="#section-18.4">18.4</a>. Requirements for a Long-Term Solution</span>
From <a href="./rfc3424">RFC 3424</a>, any UNSAF proposal needs to provide the following:
Identify requirements for longer term, sound technical solutions;
contribute to the process of finding the right longer term
solution.
Our conclusions from <a href="./rfc3489">RFC 3489</a> remain unchanged. However, we feel ICE
actually helps because we believe it can be part of the long-term
solution.
<span class="h3"><a class="selflink" id="section-18.5" href="#section-18.5">18.5</a>. Issues with Existing NAPT Boxes</span>
From <a href="./rfc3424">RFC 3424</a>, any UNSAF proposal needs to provide:
Discussion of the impact of the noted practical issues with
existing, deployed NA[P]Ts and experience reports.
A number of NAT boxes are now being deployed into the market that try
to provide "generic" ALG functionality. These generic ALGs hunt for
IP addresses, in either text or binary form within a packet, and
rewrite them if they match a binding. This interferes with classic
STUN. However, the update to STUN [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>] uses an encoding that
hides these binary addresses from generic ALGs.
Existing NAPT boxes have non-deterministic and typically short
expiration times for UDP-based bindings. This requires
implementations to send periodic keepalives to maintain those
bindings. ICE uses a default of 15 s, which is a very conservative
estimate. Eventually, over time, as NAT boxes become compliant to
behave [<a href="./rfc4787" title=""Network Address Translation (NAT) Behavioral Requirements for Unicast UDP"">RFC4787</a>], this minimum keepalive will become deterministic
<span class="grey">Keranen, et al. Standards Track [Page 75]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-76" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
and well known, and the ICE timers can be adjusted. Having a way to
discover and control the minimum keepalive interval would be far
better still.
<span class="h2"><a class="selflink" id="section-19" href="#section-19">19</a>. Security Considerations</span>
<span class="h3"><a class="selflink" id="section-19.1" href="#section-19.1">19.1</a>. IP Address Privacy</span>
The process of probing for candidates reveals the source addresses of
the client and its peer to any on-network listening attacker, and the
process of exchanging candidates reveals the addresses to any
attacker that is able to see the negotiation. Some addresses, such
as the server-reflexive addresses gathered through the local
interface of VPN users, may be sensitive information. If these
potential attacks cannot be mitigated, ICE usages can define
mechanisms for controlling which addresses are revealed to the
negotiation and/or probing process. Individual implementations may
also have implementation-specific rules for controlling which
addresses are revealed. For example, [<a href="#ref-WebRTC-IP-HANDLING">WebRTC-IP-HANDLING</a>] provides
additional information about the privacy aspects of revealing IP
addresses via ICE for WebRTC applications. ICE implementations where
such issues can arise are RECOMMENDED to provide a programmatic or
user interface that provides control over which network interfaces
are used to generate candidates.
Based on the types of candidates provided by the peer, and the
results of the connectivity tests performed against those candidates,
the peer might be able to determine characteristics of the local
network, e.g., if different timings are apparent to the peer. Within
the limit, the peer might be able to probe the local network.
There are several types of attacks possible in an ICE system. The
subsections consider these attacks and their countermeasures.
<span class="h3"><a class="selflink" id="section-19.2" href="#section-19.2">19.2</a>. Attacks on Connectivity Checks</span>
An attacker might attempt to disrupt the STUN connectivity checks.
Ultimately, all of these attacks fool an ICE agent into thinking
something incorrect about the results of the connectivity checks.
Depending on the type of attack, the attacker needs to have different
capabilities. In some cases, the attacker needs to be on the path of
the connectivity checks. In other cases, the attacker does not need
to be on the path, as long as it is able to generate STUN
connectivity checks. While attacks on connectivity checks are
typically performed by network entities, if an attacker is able to
control an endpoint, it might be able to trigger connectivity-check
attacks. The possible false conclusions an attacker can try and
cause are:
<span class="grey">Keranen, et al. Standards Track [Page 76]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-77" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
False Invalid: An attacker can fool a pair of agents into thinking a
candidate pair is invalid, when it isn't. This can be used to
cause an agent to prefer a different candidate (such as one
injected by the attacker) or to disrupt a call by forcing all
candidates to fail.
False Valid: An attacker can fool a pair of agents into thinking a
candidate pair is valid, when it isn't. This can cause an agent
to proceed with a session but then not be able to receive any
data.
False Peer-Reflexive Candidate: An attacker can cause an agent to
discover a new peer-reflexive candidate when it is not expected
to. This can be used to redirect data streams to a DoS target or
to the attacker, for eavesdropping or other purposes.
False Valid on False Candidate: An attacker has already convinced an
agent that there is a candidate with an address that does not
actually route to that agent (e.g., by injecting a false peer-
reflexive candidate or false server-reflexive candidate). The
attacker then launches an attack that forces the agents to believe
that this candidate is valid.
If an attacker can cause a false peer-reflexive candidate or false
valid on a false candidate, it can launch any of the attacks
described in [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>].
To force the false invalid result, the attacker has to wait for the
connectivity check from one of the agents to be sent. When it is,
the attacker needs to inject a fake response with an unrecoverable
error response (such as a 400), or drop the response so that it never
reaches the agent. However, since the candidate is, in fact, valid,
the original request may reach the peer agent and result in a success
response. The attacker needs to force this packet or its response to
be dropped through a DoS attack, a Layer 2 network disruption, or
another technique. If it doesn't do this, the success response will
also reach the originator, alerting it to a possible attack. The
ability for the attacker to generate a fake response is mitigated
through the STUN short-term credential mechanism. In order for this
response to be processed, the attacker needs the password. If the
candidate exchange signaling is secured, the attacker will not have
the password, and its response will be discarded.
Spoofed ICMP Hard Errors (Type 3, codes 2-4) can also be used to
create false invalid results. If an ICE agent implements a response
to these ICMP errors, the attacker is capable of generating an ICMP
message that is delivered to the agent sending the connectivity
check. The validation of the ICMP error message by the agent is its
<span class="grey">Keranen, et al. Standards Track [Page 77]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-78" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
only defense. For Type 3 code=4, the outer IP header provides no
validation, unless the connectivity check was sent with DF=0. For
codes 2 or 3, which are originated by the host, the address is
expected to be any of the remote agent's host, reflexive, or relay
candidate IP addresses. The ICMP message includes the IP header and
UDP header of the message triggering the error. These fields also
need to be validated. The IP destination and UDP destination port
need to match either the targeted candidate address and port or the
candidate's base address. The source IP address and port can be any
candidate for the same base address of the agent sending the
connectivity check. Thus, any attacker having access to the exchange
of the candidates will have the necessary information. Hence, the
validation is a weak defense, and the sending of spoofed ICMP attacks
is also possible for off-path attackers from a node in a network
without source address validation.
Forcing the fake valid result works in a similar way. The attacker
needs to wait for the Binding request from each agent and inject a
fake success response. Again, due to the STUN short-term credential
mechanism, in order for the attacker to inject a valid success
response, the attacker needs the password. Alternatively, the
attacker can route (e.g., using a tunneling mechanism) a valid
success response, which normally would be dropped or rejected by the
network, to the agent.
Forcing the false peer-reflexive candidate result can be done with
either fake requests or responses, or with replays. We consider the
fake requests and responses case first. It requires the attacker to
send a Binding request to one agent with a source IP address and port
for the false candidate. In addition, the attacker needs to wait for
a Binding request from the other agent and generate a fake response
with a XOR-MAPPED-ADDRESS attribute containing the false candidate.
Like the other attacks described here, this attack is mitigated by
the STUN message integrity mechanisms and secure candidate exchanges.
Forcing the false peer-reflexive candidate result with packet replays
is different. The attacker waits until one of the agents sends a
check. It intercepts this request and replays it towards the other
agent with a faked source IP address. It also needs to prevent the
original request from reaching the remote agent, by either launching
a DoS attack to cause the packet to be dropped or forcing it to be
dropped using Layer 2 mechanisms. The replayed packet is received at
the other agent, and accepted, since the integrity check passes (the
integrity check cannot and does not cover the source IP address and
port). It is then responded to. This response will contain a XOR-
MAPPED-ADDRESS with the false candidate, and it will be sent to that
false candidate. The attacker then needs to receive it and relay it
towards the originator.
<span class="grey">Keranen, et al. Standards Track [Page 78]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-79" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
The other agent will then initiate a connectivity check towards that
false candidate. This validation needs to succeed. This requires
the attacker to force a false valid on a false candidate. The
injecting of fake requests or responses to achieve this goal is
prevented using the integrity mechanisms of STUN and the candidate
exchange. Thus, this attack can only be launched through replays.
To do that, the attacker needs to intercept the check towards this
false candidate and replay it towards the other agent. Then, it
needs to intercept the response and replay that back as well.
This attack is very hard to launch unless the attacker is identified
by the fake candidate. This is because it requires the attacker to
intercept and replay packets sent by two different hosts. If both
agents are on different networks (e.g., across the public Internet),
this attack can be hard to coordinate, since it needs to occur
against two different endpoints on different parts of the network at
the same time.
If the attacker itself is identified by the fake candidate, the
attack is easier to coordinate. However, if the data path is secured
(e.g., using the Secure Real-time Transport Protocol (SRTP)
[<a href="./rfc3711" title=""The Secure Real-time Transport Protocol (SRTP)"">RFC3711</a>]), the attacker will not be able to process the data
packets, but will only be able to discard them, effectively disabling
the data stream. However, this attack requires the agent to disrupt
packets in order to block the connectivity check from reaching the
target. In that case, if the goal is to disrupt the data stream,
it's much easier to just disrupt it with the same mechanism, rather
than attack ICE.
<span class="h3"><a class="selflink" id="section-19.3" href="#section-19.3">19.3</a>. Attacks on Server-Reflexive Address Gathering</span>
ICE endpoints make use of STUN Binding requests for gathering server-
reflexive candidates from a STUN server. These requests are not
authenticated in any way. As a consequence, there are numerous
techniques an attacker can employ to provide the client with a false
server-reflexive candidate:
o An attacker can compromise the DNS, causing DNS queries to return
a rogue STUN server address. That server can provide the client
with fake server-reflexive candidates. This attack is mitigated
by DNS security, though DNSSEC is not required to address it.
o An attacker that can observe STUN messages (such as an attacker on
a shared network segment, like Wi-Fi) can inject a fake response
that is valid and will be accepted by the client.
o An attacker can compromise a STUN server and cause it to send
responses with incorrect mapped addresses.
<span class="grey">Keranen, et al. Standards Track [Page 79]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-80" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
A false mapped address learned by these attacks will be used as a
server-reflexive candidate in the establishment of the ICE session.
For this candidate to actually be used for data, the attacker also
needs to attack the connectivity checks, and in particular, force a
false valid on a false candidate. This attack is very hard to launch
if the false address identifies a fourth party (neither the
initiator, responder, nor attacker), since it requires attacking the
checks generated by each ICE agent in the session and is prevented by
SRTP if it identifies the attacker itself.
If the attacker elects not to attack the connectivity checks, the
worst it can do is prevent the server-reflexive candidate from being
used. However, if the peer agent has at least one candidate that is
reachable by the agent under attack, the STUN connectivity checks
themselves will provide a peer-reflexive candidate that can be used
for the exchange of data. Peer-reflexive candidates are generally
preferred over server-reflexive candidates. As such, an attack
solely on the STUN address gathering will normally have no impact on
a session at all.
<span class="h3"><a class="selflink" id="section-19.4" href="#section-19.4">19.4</a>. Attacks on Relayed Candidate Gathering</span>
An attacker might attempt to disrupt the gathering of relayed
candidates, forcing the client to believe it has a false relayed
candidate. Exchanges with the TURN server are authenticated using a
long-term credential. Consequently, injection of fake responses or
requests will not work. In addition, unlike Binding requests,
Allocate requests are not susceptible to replay attacks with modified
source IP addresses and ports, since the source IP address and port
are not utilized to provide the client with its relayed candidate.
Even if an attacker has caused the client to believe in a false
relayed candidate, the connectivity checks cause such a candidate to
be used only if they succeed. Thus, an attacker needs to launch a
false valid on a false candidate, per above, which is a very
difficult attack to coordinate.
<span class="h3"><a class="selflink" id="section-19.5" href="#section-19.5">19.5</a>. Insider Attacks</span>
In addition to attacks where the attacker is a third party trying to
insert fake candidate information or STUN messages, there are attacks
possible with ICE when the attacker is an authenticated and valid
participant in the ICE exchange.
<span class="grey">Keranen, et al. Standards Track [Page 80]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-81" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h4"><a class="selflink" id="section-19.5.1" href="#section-19.5.1">19.5.1</a>. STUN Amplification Attack</span>
The STUN amplification attack is similar to a "voice hammer" attack,
where the attacker causes other agents to direct voice packets to the
attack target. However, instead of voice packets being directed to
the target, STUN connectivity checks are directed to the target. The
attacker sends a large number of candidates, say, 50. The responding
agent receives the candidate information and starts its checks, which
are directed at the target, and consequently, never generate a
response. In the case of WebRTC, the user might not even be aware
that this attack is ongoing, since it might be triggered in the
background by malicious JavaScript code that the user has fetched.
The answerer will start a new connectivity check every Ta ms (say,
Ta=50ms). However, the retransmission timers are set to a large
number due to the large number of candidates. As a consequence,
packets will be sent at an interval of one every Ta milliseconds and
then with increasing intervals after that. Thus, STUN will not send
packets at a rate faster than data would be sent, and the STUN
packets persist only briefly, until ICE fails for the session.
Nonetheless, this is an amplification mechanism.
It is impossible to eliminate the amplification, but the volume can
be reduced through a variety of heuristics. ICE agents SHOULD limit
the total number of connectivity checks they perform to 100.
Additionally, agents MAY limit the number of candidates they will
accept.
Frequently, protocols that wish to avoid these kinds of attacks force
the initiator to wait for a response prior to sending the next
message. However, in the case of ICE, this is not possible. It is
not possible to differentiate the following two cases:
o There was no response because the initiator is being used to
launch a DoS attack against an unsuspecting target that will not
respond.
o There was no response because the IP address and port are not
reachable by the initiator.
In the second case, another check will be sent at the next
opportunity, while in the former case, no further checks will be
sent.
<span class="grey">Keranen, et al. Standards Track [Page 81]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-82" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-20" href="#section-20">20</a>. IANA Considerations</span>
The original ICE specification registered four STUN attributes and
one new STUN error response. The STUN attributes and error response
are reproduced here. In addition, this specification registers a new
ICE option.
<span class="h3"><a class="selflink" id="section-20.1" href="#section-20.1">20.1</a>. STUN Attributes</span>
IANA has registered four STUN attributes:
0x0024 PRIORITY
0x0025 USE-CANDIDATE
0x8029 ICE-CONTROLLED
0x802A ICE-CONTROLLING
<span class="h3"><a class="selflink" id="section-20.2" href="#section-20.2">20.2</a>. STUN Error Responses</span>
IANA has registered the following STUN error-response code:
487 Role Conflict: The client asserted an ICE role (controlling or
controlled) that is in conflict with the role of the server.
<span class="h3"><a class="selflink" id="section-20.3" href="#section-20.3">20.3</a>. ICE Options</span>
IANA has registered the following ICE option in the "ICE Options"
subregistry of the "Interactive Connectivity Establishment (ICE)"
registry, following the procedures defined in [<a href="./rfc6336" title=""IANA Registry for Interactive Connectivity Establishment (ICE) Options"">RFC6336</a>].
ICE Option name:
ice2
Contact:
Name: IESG
Email: iesg@ietf.org
Change Controller:
IESG
Description:
The ICE option indicates that the ICE agent using the ICE option
is implemented according to <a href="./rfc8445">RFC 8445</a>.
Reference:
<a href="./rfc8445">RFC 8445</a>
<span class="grey">Keranen, et al. Standards Track [Page 82]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-83" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="section-21" href="#section-21">21</a>. Changes from <a href="./rfc5245">RFC 5245</a></span>
The purpose of this updated ICE specification is to:
o Clarify procedures in <a href="./rfc5245">RFC 5245</a>.
o Make technical changes, due to discovered flaws in <a href="./rfc5245">RFC 5245</a> and
feedback from the community that has implemented and deployed ICE
applications based on <a href="./rfc5245">RFC 5245</a>.
o Make the procedures independent of the signaling protocol, by
removing the SIP and SDP procedures. Procedures specific to a
signaling protocol will be defined in separate usage documents.
[<a href="#ref-ICE-SIP-SDP">ICE-SIP-SDP</a>] defines ICE usage with SIP and SDP.
The following technical changes have been done:
o Aggressive nomination removed.
o The procedures for calculating candidate pair states and
scheduling connectivity checks modified.
o Procedures for calculation of Ta and RTO modified.
o Active checklist and Frozen checklist definitions removed.
o 'ice2' ICE option added.
o IPv6 considerations modified.
o Usage with no-op for keepalives, and keepalives with non-ICE
peers, removed.
<span class="h2"><a class="selflink" id="section-22" href="#section-22">22</a>. References</span>
<span class="h3"><a class="selflink" id="section-22.1" href="#section-22.1">22.1</a>. Normative References</span>
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC4941">RFC4941</a>] Narten, T., Draves, R., and S. Krishnan, "Privacy
Extensions for Stateless Address Autoconfiguration in
IPv6", <a href="./rfc4941">RFC 4941</a>, DOI 10.17487/RFC4941, September 2007,
<<a href="https://www.rfc-editor.org/info/rfc4941">https://www.rfc-editor.org/info/rfc4941</a>>.
<span class="grey">Keranen, et al. Standards Track [Page 83]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-84" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
[<a id="ref-RFC5389">RFC5389</a>] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing,
"Session Traversal Utilities for NAT (STUN)", <a href="./rfc5389">RFC 5389</a>,
DOI 10.17487/RFC5389, October 2008,
<<a href="https://www.rfc-editor.org/info/rfc5389">https://www.rfc-editor.org/info/rfc5389</a>>.
[<a id="ref-RFC5766">RFC5766</a>] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using
Relays around NAT (TURN): Relay Extensions to Session
Traversal Utilities for NAT (STUN)", <a href="./rfc5766">RFC 5766</a>,
DOI 10.17487/RFC5766, April 2010,
<<a href="https://www.rfc-editor.org/info/rfc5766">https://www.rfc-editor.org/info/rfc5766</a>>.
[<a id="ref-RFC6336">RFC6336</a>] Westerlund, M. and C. Perkins, "IANA Registry for
Interactive Connectivity Establishment (ICE) Options",
<a href="./rfc6336">RFC 6336</a>, DOI 10.17487/RFC6336, July 2011,
<<a href="https://www.rfc-editor.org/info/rfc6336">https://www.rfc-editor.org/info/rfc6336</a>>.
[<a id="ref-RFC6724">RFC6724</a>] Thaler, D., Ed., Draves, R., Matsumoto, A., and T. Chown,
"Default Address Selection for Internet Protocol Version 6
(IPv6)", <a href="./rfc6724">RFC 6724</a>, DOI 10.17487/RFC6724, September 2012,
<<a href="https://www.rfc-editor.org/info/rfc6724">https://www.rfc-editor.org/info/rfc6724</a>>.
[<a id="ref-RFC8174">RFC8174</a>] Leiba, B., "Ambiguity of Uppercase vs Lowercase in <a href="./rfc2119">RFC</a>
<a href="./rfc2119">2119</a> Key Words", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc8174">RFC 8174</a>, DOI 10.17487/RFC8174,
May 2017, <<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>>.
<span class="h3"><a class="selflink" id="section-22.2" href="#section-22.2">22.2</a>. Informative References</span>
[<a id="ref-ICE-SIP-SDP">ICE-SIP-SDP</a>]
Petit-Huguenin, M., Nandakumar, S., and A. Keranen,
"Session Description Protocol (SDP) Offer/Answer
procedures for Interactive Connectivity Establishment
(ICE)", Work in Progress,
<a href="./draft-ietf-mmusic-ice-sip-sdp-21">draft-ietf-mmusic-ice-sip-sdp-21</a>, June 2018.
[<a id="ref-RFC1918">RFC1918</a>] Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G.,
and E. Lear, "Address Allocation for Private Internets",
<a href="https://www.rfc-editor.org/bcp/bcp5">BCP 5</a>, <a href="./rfc1918">RFC 1918</a>, DOI 10.17487/RFC1918, February 1996,
<<a href="https://www.rfc-editor.org/info/rfc1918">https://www.rfc-editor.org/info/rfc1918</a>>.
[<a id="ref-RFC2475">RFC2475</a>] Blake, S., Black, D., Carlson, M., Davies, E., Wang, Z.,
and W. Weiss, "An Architecture for Differentiated
Services", <a href="./rfc2475">RFC 2475</a>, DOI 10.17487/RFC2475, December 1998,
<<a href="https://www.rfc-editor.org/info/rfc2475">https://www.rfc-editor.org/info/rfc2475</a>>.
[<a id="ref-RFC3102">RFC3102</a>] Borella, M., Lo, J., Grabelsky, D., and G. Montenegro,
"Realm Specific IP: Framework", <a href="./rfc3102">RFC 3102</a>,
DOI 10.17487/RFC3102, October 2001,
<<a href="https://www.rfc-editor.org/info/rfc3102">https://www.rfc-editor.org/info/rfc3102</a>>.
<span class="grey">Keranen, et al. Standards Track [Page 84]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-85" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
[<a id="ref-RFC3103">RFC3103</a>] Borella, M., Grabelsky, D., Lo, J., and K. Taniguchi,
"Realm Specific IP: Protocol Specification", <a href="./rfc3103">RFC 3103</a>,
DOI 10.17487/RFC3103, October 2001,
<<a href="https://www.rfc-editor.org/info/rfc3103">https://www.rfc-editor.org/info/rfc3103</a>>.
[<a id="ref-RFC3235">RFC3235</a>] Senie, D., "Network Address Translator (NAT)-Friendly
Application Design Guidelines", <a href="./rfc3235">RFC 3235</a>,
DOI 10.17487/RFC3235, January 2002,
<<a href="https://www.rfc-editor.org/info/rfc3235">https://www.rfc-editor.org/info/rfc3235</a>>.
[<a id="ref-RFC3261">RFC3261</a>] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston,
A., Peterson, J., Sparks, R., Handley, M., and E.
Schooler, "SIP: Session Initiation Protocol", <a href="./rfc3261">RFC 3261</a>,
DOI 10.17487/RFC3261, June 2002,
<<a href="https://www.rfc-editor.org/info/rfc3261">https://www.rfc-editor.org/info/rfc3261</a>>.
[<a id="ref-RFC3264">RFC3264</a>] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model
with Session Description Protocol (SDP)", <a href="./rfc3264">RFC 3264</a>,
DOI 10.17487/RFC3264, June 2002,
<<a href="https://www.rfc-editor.org/info/rfc3264">https://www.rfc-editor.org/info/rfc3264</a>>.
[<a id="ref-RFC3303">RFC3303</a>] Srisuresh, P., Kuthan, J., Rosenberg, J., Molitor, A., and
A. Rayhan, "Middlebox communication architecture and
framework", <a href="./rfc3303">RFC 3303</a>, DOI 10.17487/RFC3303, August 2002,
<<a href="https://www.rfc-editor.org/info/rfc3303">https://www.rfc-editor.org/info/rfc3303</a>>.
[<a id="ref-RFC3424">RFC3424</a>] Daigle, L., Ed. and IAB, "IAB Considerations for
UNilateral Self-Address Fixing (UNSAF) Across Network
Address Translation", <a href="./rfc3424">RFC 3424</a>, DOI 10.17487/RFC3424,
November 2002, <<a href="https://www.rfc-editor.org/info/rfc3424">https://www.rfc-editor.org/info/rfc3424</a>>.
[<a id="ref-RFC3489">RFC3489</a>] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy,
"STUN - Simple Traversal of User Datagram Protocol (UDP)
Through Network Address Translators (NATs)", <a href="./rfc3489">RFC 3489</a>,
DOI 10.17487/RFC3489, March 2003,
<<a href="https://www.rfc-editor.org/info/rfc3489">https://www.rfc-editor.org/info/rfc3489</a>>.
[<a id="ref-RFC3550">RFC3550</a>] Schulzrinne, H., Casner, S., Frederick, R., and V.
Jacobson, "RTP: A Transport Protocol for Real-Time
Applications", STD 64, <a href="./rfc3550">RFC 3550</a>, DOI 10.17487/RFC3550,
July 2003, <<a href="https://www.rfc-editor.org/info/rfc3550">https://www.rfc-editor.org/info/rfc3550</a>>.
[<a id="ref-RFC3605">RFC3605</a>] Huitema, C., "Real Time Control Protocol (RTCP) attribute
in Session Description Protocol (SDP)", <a href="./rfc3605">RFC 3605</a>,
DOI 10.17487/RFC3605, October 2003,
<<a href="https://www.rfc-editor.org/info/rfc3605">https://www.rfc-editor.org/info/rfc3605</a>>.
<span class="grey">Keranen, et al. Standards Track [Page 85]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-86" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
[<a id="ref-RFC3711">RFC3711</a>] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K.
Norrman, "The Secure Real-time Transport Protocol (SRTP)",
<a href="./rfc3711">RFC 3711</a>, DOI 10.17487/RFC3711, March 2004,
<<a href="https://www.rfc-editor.org/info/rfc3711">https://www.rfc-editor.org/info/rfc3711</a>>.
[<a id="ref-RFC3725">RFC3725</a>] Rosenberg, J., Peterson, J., Schulzrinne, H., and G.
Camarillo, "Best Current Practices for Third Party Call
Control (3pcc) in the Session Initiation Protocol (SIP)",
<a href="https://www.rfc-editor.org/bcp/bcp85">BCP 85</a>, <a href="./rfc3725">RFC 3725</a>, DOI 10.17487/RFC3725, April 2004,
<<a href="https://www.rfc-editor.org/info/rfc3725">https://www.rfc-editor.org/info/rfc3725</a>>.
[<a id="ref-RFC3879">RFC3879</a>] Huitema, C. and B. Carpenter, "Deprecating Site Local
Addresses", <a href="./rfc3879">RFC 3879</a>, DOI 10.17487/RFC3879, September
2004, <<a href="https://www.rfc-editor.org/info/rfc3879">https://www.rfc-editor.org/info/rfc3879</a>>.
[<a id="ref-RFC4038">RFC4038</a>] Shin, M-K., Ed., Hong, Y-G., Hagino, J., Savola, P., and
E. Castro, "Application Aspects of IPv6 Transition",
<a href="./rfc4038">RFC 4038</a>, DOI 10.17487/RFC4038, March 2005,
<<a href="https://www.rfc-editor.org/info/rfc4038">https://www.rfc-editor.org/info/rfc4038</a>>.
[<a id="ref-RFC4091">RFC4091</a>] Camarillo, G. and J. Rosenberg, "The Alternative Network
Address Types (ANAT) Semantics for the Session Description
Protocol (SDP) Grouping Framework", <a href="./rfc4091">RFC 4091</a>,
DOI 10.17487/RFC4091, June 2005,
<<a href="https://www.rfc-editor.org/info/rfc4091">https://www.rfc-editor.org/info/rfc4091</a>>.
[<a id="ref-RFC4092">RFC4092</a>] Camarillo, G. and J. Rosenberg, "Usage of the Session
Description Protocol (SDP) Alternative Network Address
Types (ANAT) Semantics in the Session Initiation Protocol
(SIP)", <a href="./rfc4092">RFC 4092</a>, DOI 10.17487/RFC4092, June 2005,
<<a href="https://www.rfc-editor.org/info/rfc4092">https://www.rfc-editor.org/info/rfc4092</a>>.
[<a id="ref-RFC4103">RFC4103</a>] Hellstrom, G. and P. Jones, "RTP Payload for Text
Conversation", <a href="./rfc4103">RFC 4103</a>, DOI 10.17487/RFC4103, June 2005,
<<a href="https://www.rfc-editor.org/info/rfc4103">https://www.rfc-editor.org/info/rfc4103</a>>.
[<a id="ref-RFC4291">RFC4291</a>] Hinden, R. and S. Deering, "IP Version 6 Addressing
Architecture", <a href="./rfc4291">RFC 4291</a>, DOI 10.17487/RFC4291, February
2006, <<a href="https://www.rfc-editor.org/info/rfc4291">https://www.rfc-editor.org/info/rfc4291</a>>.
[<a id="ref-RFC4566">RFC4566</a>] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
Description Protocol", <a href="./rfc4566">RFC 4566</a>, DOI 10.17487/RFC4566,
July 2006, <<a href="https://www.rfc-editor.org/info/rfc4566">https://www.rfc-editor.org/info/rfc4566</a>>.
[<a id="ref-RFC4787">RFC4787</a>] Audet, F., Ed. and C. Jennings, "Network Address
Translation (NAT) Behavioral Requirements for Unicast
UDP", <a href="https://www.rfc-editor.org/bcp/bcp127">BCP 127</a>, <a href="./rfc4787">RFC 4787</a>, DOI 10.17487/RFC4787, January
2007, <<a href="https://www.rfc-editor.org/info/rfc4787">https://www.rfc-editor.org/info/rfc4787</a>>.
<span class="grey">Keranen, et al. Standards Track [Page 86]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-87" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
[<a id="ref-RFC5245">RFC5245</a>] Rosenberg, J., "Interactive Connectivity Establishment
(ICE): A Protocol for Network Address Translator (NAT)
Traversal for Offer/Answer Protocols", <a href="./rfc5245">RFC 5245</a>,
DOI 10.17487/RFC5245, April 2010,
<<a href="https://www.rfc-editor.org/info/rfc5245">https://www.rfc-editor.org/info/rfc5245</a>>.
[<a id="ref-RFC5382">RFC5382</a>] Guha, S., Ed., Biswas, K., Ford, B., Sivakumar, S., and P.
Srisuresh, "NAT Behavioral Requirements for TCP", <a href="https://www.rfc-editor.org/bcp/bcp142">BCP 142</a>,
<a href="./rfc5382">RFC 5382</a>, DOI 10.17487/RFC5382, October 2008,
<<a href="https://www.rfc-editor.org/info/rfc5382">https://www.rfc-editor.org/info/rfc5382</a>>.
[<a id="ref-RFC5761">RFC5761</a>] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and
Control Packets on a Single Port", <a href="./rfc5761">RFC 5761</a>,
DOI 10.17487/RFC5761, April 2010,
<<a href="https://www.rfc-editor.org/info/rfc5761">https://www.rfc-editor.org/info/rfc5761</a>>.
[<a id="ref-RFC6080">RFC6080</a>] Petrie, D. and S. Channabasappa, Ed., "A Framework for
Session Initiation Protocol User Agent Profile Delivery",
<a href="./rfc6080">RFC 6080</a>, DOI 10.17487/RFC6080, March 2011,
<<a href="https://www.rfc-editor.org/info/rfc6080">https://www.rfc-editor.org/info/rfc6080</a>>.
[<a id="ref-RFC6146">RFC6146</a>] Bagnulo, M., Matthews, P., and I. van Beijnum, "Stateful
NAT64: Network Address and Protocol Translation from IPv6
Clients to IPv4 Servers", <a href="./rfc6146">RFC 6146</a>, DOI 10.17487/RFC6146,
April 2011, <<a href="https://www.rfc-editor.org/info/rfc6146">https://www.rfc-editor.org/info/rfc6146</a>>.
[<a id="ref-RFC6147">RFC6147</a>] Bagnulo, M., Sullivan, A., Matthews, P., and I. van
Beijnum, "DNS64: DNS Extensions for Network Address
Translation from IPv6 Clients to IPv4 Servers", <a href="./rfc6147">RFC 6147</a>,
DOI 10.17487/RFC6147, April 2011,
<<a href="https://www.rfc-editor.org/info/rfc6147">https://www.rfc-editor.org/info/rfc6147</a>>.
[<a id="ref-RFC6298">RFC6298</a>] Paxson, V., Allman, M., Chu, J., and M. Sargent,
"Computing TCP's Retransmission Timer", <a href="./rfc6298">RFC 6298</a>,
DOI 10.17487/RFC6298, June 2011,
<<a href="https://www.rfc-editor.org/info/rfc6298">https://www.rfc-editor.org/info/rfc6298</a>>.
[<a id="ref-RFC6544">RFC6544</a>] Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach,
"TCP Candidates with Interactive Connectivity
Establishment (ICE)", <a href="./rfc6544">RFC 6544</a>, DOI 10.17487/RFC6544,
March 2012, <<a href="https://www.rfc-editor.org/info/rfc6544">https://www.rfc-editor.org/info/rfc6544</a>>.
[<a id="ref-RFC6928">RFC6928</a>] Chu, J., Dukkipati, N., Cheng, Y., and M. Mathis,
"Increasing TCP's Initial Window", <a href="./rfc6928">RFC 6928</a>,
DOI 10.17487/RFC6928, April 2013,
<<a href="https://www.rfc-editor.org/info/rfc6928">https://www.rfc-editor.org/info/rfc6928</a>>.
<span class="grey">Keranen, et al. Standards Track [Page 87]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-88" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
[<a id="ref-RFC7050">RFC7050</a>] Savolainen, T., Korhonen, J., and D. Wing, "Discovery of
the IPv6 Prefix Used for IPv6 Address Synthesis",
<a href="./rfc7050">RFC 7050</a>, DOI 10.17487/RFC7050, November 2013,
<<a href="https://www.rfc-editor.org/info/rfc7050">https://www.rfc-editor.org/info/rfc7050</a>>.
[<a id="ref-RFC7721">RFC7721</a>] Cooper, A., Gont, F., and D. Thaler, "Security and Privacy
Considerations for IPv6 Address Generation Mechanisms",
<a href="./rfc7721">RFC 7721</a>, DOI 10.17487/RFC7721, March 2016,
<<a href="https://www.rfc-editor.org/info/rfc7721">https://www.rfc-editor.org/info/rfc7721</a>>.
[<a id="ref-RFC7825">RFC7825</a>] Goldberg, J., Westerlund, M., and T. Zeng, "A Network
Address Translator (NAT) Traversal Mechanism for Media
Controlled by the Real-Time Streaming Protocol (RTSP)",
<a href="./rfc7825">RFC 7825</a>, DOI 10.17487/RFC7825, December 2016,
<<a href="https://www.rfc-editor.org/info/rfc7825">https://www.rfc-editor.org/info/rfc7825</a>>.
[<a id="ref-RFC8421">RFC8421</a>] Martinsen, P., Reddy, T., and P. Patil, "Interactive
Connectivity Establishment (ICE) Multihomed and IPv4/IPv6
Dual-Stack Guidelines", <a href="./rfc8421">RFC 8421</a>, DOI 10.17487/RFC8421,
July 2018, <<a href="https://www.rfc-editor.org/info/rfc8421">https://www.rfc-editor.org/info/rfc8421</a>>.
[<a id="ref-WebRTC-IP-HANDLING">WebRTC-IP-HANDLING</a>]
Uberti, J. and G. Shieh, "WebRTC IP Address Handling
Requirements", Work in Progress, <a href="./draft-ietf-rtcweb-ip-handling-09">draft-ietf-rtcweb-ip-</a>
<a href="./draft-ietf-rtcweb-ip-handling-09">handling-09</a>, June 2018.
<span class="grey">Keranen, et al. Standards Track [Page 88]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-89" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Lite and Full Implementations</span>
ICE allows for two types of implementations. A full implementation
supports the controlling and controlled roles in a session and can
also perform address gathering. In contrast, a lite implementation
is a minimalist implementation that does little but respond to STUN
checks, and it only supports the controlled role in a session.
Because ICE requires both endpoints to support it in order to bring
benefits to either endpoint, incremental deployment of ICE in a
network is more complicated. Many sessions involve an endpoint that
is, by itself, not behind a NAT and not one that would worry about
NAT traversal. A very common case is to have one endpoint that
requires NAT traversal (such as a VoIP hard phone or soft phone) make
a call to one of these devices. Even if the phone supports a full
ICE implementation, ICE won't be used at all if the other device
doesn't support it. The lite implementation allows for a low-cost
entry point for these devices. Once they support the lite
implementation, full implementations can connect to them and get the
full benefits of ICE.
Consequently, a lite implementation is only appropriate for devices
that will *always* be connected to the public Internet and have a
public IP address at which it can receive packets from any
correspondent. ICE will not function when a lite implementation is
placed behind a NAT.
ICE allows a lite implementation to have a single IPv4 host candidate
and several IPv6 addresses. In that case, candidate pairs are
selected by the controlling agent using a static algorithm, such as
the one in <a href="./rfc6724">RFC 6724</a>, which is recommended by this specification.
However, static mechanisms for address selection are always prone to
error, since they can never reflect the actual topology or provide
actual guarantees on connectivity. They are always heuristics.
Consequently, if an ICE agent is implementing ICE just to select
between its IPv4 and IPv6 addresses, and none of its IP addresses are
behind NAT, usage of full ICE is still RECOMMENDED in order to
provide the most robust form of address selection possible.
It is important to note that the lite implementation was added to
this specification to provide a stepping stone to full
implementation. Even for devices that are always connected to the
public Internet with just a single IPv4 address, a full
implementation is preferable if achievable. Full implementations
also obtain the security benefits of ICE unrelated to NAT traversal.
Finally, it is often the case that a device that finds itself with a
public address today will be placed in a network tomorrow where it
will be behind a NAT. It is difficult to definitively know, over the
<span class="grey">Keranen, et al. Standards Track [Page 89]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-90" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
lifetime of a device or product, if it will always be used on the
public Internet. Full implementation provides assurance that
communications will always work.
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Design Motivations</span>
ICE contains a number of normative behaviors that may themselves be
simple but derive from complicated or non-obvious thinking or use
cases that merit further discussion. Since these design motivations
are not necessary to understand for purposes of implementation, they
are discussed here. This appendix is non-normative.
<span class="h3"><a class="selflink" id="appendix-B.1" href="#appendix-B.1">B.1</a>. Pacing of STUN Transactions</span>
STUN transactions used to gather candidates and to verify
connectivity are paced out at an approximate rate of one new
transaction every Ta milliseconds. Each transaction, in turn, has a
retransmission timer RTO that is a function of Ta as well. Why are
these transactions paced, and why are these formulas used?
Sending of these STUN requests will often have the effect of creating
bindings on NAT devices between the client and the STUN servers.
Experience has shown that many NAT devices have upper limits on the
rate at which they will create new bindings. Discussions in the IETF
ICE WG during the work on this specification concluded that once
every 5 ms is well supported. This is why Ta has a lower bound of
5 ms. Furthermore, transmission of these packets on the network
makes use of bandwidth and needs to be rate limited by the ICE agent.
Deployments based on earlier draft versions of [<a href="./rfc5245" title=""Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols"">RFC5245</a>] tended to
overload rate-constrained access links and perform poorly overall, in
addition to negatively impacting the network. As a consequence, the
pacing ensures that the NAT device does not get overloaded and that
traffic is kept at a reasonable rate.
The definition of a "reasonable" rate is that STUN MUST NOT use more
bandwidth than the RTP itself will use, once data starts flowing.
The formula for Ta is designed so that, if a STUN packet were sent
every Ta seconds, it would consume the same amount of bandwidth as
RTP packets, summed across all data streams. Of course, STUN has
retransmits, and the desire is to pace those as well. For this
reason, RTO is set such that the first retransmit on the first
transaction happens just as the first STUN request on the last
transaction occurs. Pictorially:
<span class="grey">Keranen, et al. Standards Track [Page 90]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-91" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
First Packets Retransmits
| |
| |
-------+------ -------+------
/ \ / \
/ \ / \
+--+ +--+ +--+ +--+ +--+ +--+
|A1| |B1| |C1| |A2| |B2| |C2|
+--+ +--+ +--+ +--+ +--+ +--+
---+-------+-------+-------+-------+-------+------------ Time
0 Ta 2Ta 3Ta 4Ta 5Ta
In this picture, there are three transactions that will be sent (for
example, in the case of candidate gathering, there are three host
candidate/STUN server pairs). These are transactions A, B, and C.
The retransmit timer is set so that the first retransmission on the
first transaction (packet A2) is sent at time 3Ta.
Subsequent retransmits after the first will occur even less
frequently than Ta milliseconds apart, since STUN uses an exponential
backoff on its retransmissions.
This mechanism of a global minimum pacing interval of 5 ms is not
generally applicable to transport protocols, but it is applicable to
ICE based on the following reasoning.
o Start with the following rules that would be generally applicable
to transport protocols:
1. Let MaxBytes be the maximum number of bytes allowed to be
outstanding in the network at startup, which SHOULD be 14600,
as defined in <a href="./rfc6928#section-2">Section 2 of [RFC6928]</a>.
2. Let HTO be the transaction timeout, which SHOULD be 2*RTT if
RTT is known or 500 ms otherwise. This is based on the RTO
for STUN messages from [<a href="./rfc5389" title=""Session Traversal Utilities for NAT (STUN)"">RFC5389</a>] and the TCP initial RTO,
which is 1 sec in [<a href="./rfc6298" title=""Computing TCP's Retransmission Timer"">RFC6298</a>].
3. Let MinPacing be the minimum pacing interval between
transactions, which is 5 ms (see above).
<span class="grey">Keranen, et al. Standards Track [Page 91]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-92" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
o Observe that agents typically do not know the RTT for ICE
transactions (connectivity checks in particular), meaning that HTO
will almost always be 500 ms.
o Observe that a MinPacing of 5 ms and HTO of 500 ms gives at most
100 packets/HTO, which for a typical ICE check of less than 120
bytes means a maximum of 12000 outstanding bytes in the network,
which is less than the maximum expressed by rule 1.
o Thus, for ICE, the rule set reduces to just the MinPacing rule,
which is equivalent to having a global Ta value.
<span class="grey">Keranen, et al. Standards Track [Page 92]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-93" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h3"><a class="selflink" id="appendix-B.2" href="#appendix-B.2">B.2</a>. Candidates with Multiple Bases</span>
<a href="#section-5.1.3">Section 5.1.3</a> talks about eliminating candidates that have the same
transport address and base. However, candidates with the same
transport addresses but different bases are not redundant. When can
an ICE agent have two candidates that have the same IP address and
port but different bases? Consider the topology of Figure 11:
+----------+
| STUN Srvr|
+----------+
|
|
-----
// \\
| |
| B:net10 |
| |
\\ //
-----
|
|
+----------+
| NAT |
+----------+
|
|
-----
// \\
| A |
|192.168/16 |
| |
\\ //
-----
|
|
|192.168.1.100 -----
+----------+ // \\ +----------+
| | | | | |
| Initiator|---------| C:net10 |-----------| Responder|
| |10.0.1.100| | 10.0.1.101 | |
+----------+ \\ // +----------+
-----
Figure 11: Identical Candidates with Different Bases
<span class="grey">Keranen, et al. Standards Track [Page 93]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-94" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
In this case, the initiating agent is multihomed. It has one IP
address, 10.0.1.100, on network C, which is a net 10 private network.
The responding agent is on this same network. The initiating agent
is also connected to network A, which is 192.168/16, and has an IP
address of 192.168.1.100. There is a NAT on this network, natting
into network B, which is another net 10 private network, but it is
not connected to network C. There is a STUN server on network B.
The initiating agent obtains a host candidate on its IP address on
network C (10.0.1.100:2498) and a host candidate on its IP address on
network A (192.168.1.100:3344). It performs a STUN query to its
configured STUN server from 192.168.1.100:3344. This query passes
through the NAT, which happens to assign the binding 10.0.1.100:2498.
The STUN server reflects this in the STUN Binding response. Now, the
initiating agent has obtained a server-reflexive candidate with a
transport address that is identical to a host candidate
(10.0.1.100:2498). However, the server-reflexive candidate has a
base of 192.168.1.100:3344, and the host candidate has a base of
10.0.1.100:2498.
<span class="h3"><a class="selflink" id="appendix-B.3" href="#appendix-B.3">B.3</a>. Purpose of the Related-Address and Related-Port Attributes</span>
The candidate attribute contains two values that are not used at all
by ICE itself -- related address and related port. Why are they
present?
There are two motivations for its inclusion. The first is
diagnostic. It is very useful to know the relationship between the
different types of candidates. By including it, an ICE agent can
know which relayed candidate is associated with which reflexive
candidate, which in turn is associated with a specific host
candidate. When checks for one candidate succeed but not for others,
this provides useful diagnostics on what is going on in the network.
The second reason has to do with off-path Quality-of-Service (QoS)
mechanisms. When ICE is used in environments such as PacketCable
2.0, proxies will, in addition to performing normal SIP operations,
inspect the SDP in SIP messages and extract the IP address and port
for data traffic. They can then interact, through policy servers,
with access routers in the network, to establish guaranteed QoS for
the data flows. This QoS is provided by classifying the RTP traffic
based on 5-tuple and then providing it a guaranteed rate, or marking
its DSCP appropriately. When a residential NAT is present, and a
relayed candidate gets selected for data, this relayed candidate will
be a transport address on an actual TURN server. That address says
nothing about the actual transport address in the access router that
would be used to classify packets for QoS treatment. Rather, the
<span class="grey">Keranen, et al. Standards Track [Page 94]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-95" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
server-reflexive candidate towards the TURN server is needed. By
carrying the translation in the SDP, the proxy can use that transport
address to request QoS from the access router.
<span class="h3"><a class="selflink" id="appendix-B.4" href="#appendix-B.4">B.4</a>. Importance of the STUN Username</span>
ICE requires the usage of message integrity with STUN using its
short-term credential functionality. The actual short-term
credential is formed by exchanging username fragments in the
candidate exchange. The need for this mechanism goes beyond just
security; it is actually required for correct operation of ICE in the
first place.
Consider ICE agents L, R, and Z. L and R are within private
enterprise 1, which is using 10.0.0.0/8. Z is within private
enterprise 2, which is also using 10.0.0.0/8. As it turns out, R and
Z both have IP address 10.0.1.1. L sends candidates to Z. Z
responds to L with its host candidates. In this case, those
candidates are 10.0.1.1:8866 and 10.0.1.1:8877. As it turns out, R
is in a session at that same time and is also using 10.0.1.1:8866 and
10.0.1.1:8877 as host candidates. This means that R is prepared to
accept STUN messages on those ports, just as Z is. L will send a
STUN request to 10.0.1.1:8866 and another to 10.0.1.1:8877. However,
these do not go to Z as expected. Instead, they go to R! If R just
replied to them, L would believe it has connectivity to Z, when in
fact it has connectivity to a completely different user, R. To fix
this, STUN short-term credential mechanisms are used. The username
fragments are sufficiently random; thus it is highly unlikely that R
would be using the same values as Z. Consequently, R would reject
the STUN request since the credentials were invalid. In essence, the
STUN username fragments provide a form of transient host identifiers,
bound to a particular session established as part of the candidate
exchange.
An unfortunate consequence of the non-uniqueness of IP addresses is
that, in the above example, R might not even be an ICE agent. It
could be any host, and the port to which the STUN packet is directed
could be any ephemeral port on that host. If there is an application
listening on this socket for packets, and it is not prepared to
handle malformed packets for whatever protocol is in use, the
operation of that application could be affected. Fortunately, since
the ports exchanged are ephemeral and usually drawn from the dynamic
or registered range, the odds are good that the port is not used to
run a server on host R, but rather is the agent side of some
protocol. This decreases the probability of hitting an allocated
port, due to the transient nature of port usage in this range.
However, the possibility of a problem does exist, and network
deployers need to be prepared for it. Note that this is not a
<span class="grey">Keranen, et al. Standards Track [Page 95]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-96" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
problem specific to ICE; stray packets can arrive at a port at any
time for any type of protocol, especially ones on the public
Internet. As such, this requirement is just restating a general
design guideline for Internet applications -- be prepared for unknown
packets on any port.
<span class="h3"><a class="selflink" id="appendix-B.5" href="#appendix-B.5">B.5</a>. The Candidate Pair Priority Formula</span>
The priority for a candidate pair has an odd form. It is:
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
Why is this? When the candidate pairs are sorted based on this
value, the resulting sorting has the MAX/MIN property. This means
that the pairs are first sorted based on decreasing value of the
minimum of the two priorities. For pairs that have the same value of
the minimum priority, the maximum priority is used to sort amongst
them. If the max and the min priorities are the same, the
controlling agent's priority is used as the tiebreaker in the last
part of the expression. The factor of 2*32 is used since the
priority of a single candidate is always less than 2*32, resulting in
the pair priority being a "concatenation" of the two component
priorities. This creates the MAX/MIN sorting. MAX/MIN ensures that,
for a particular ICE agent, a lower-priority candidate is never used
until all higher-priority candidates have been tried.
<span class="h3"><a class="selflink" id="appendix-B.6" href="#appendix-B.6">B.6</a>. Why Are Keepalives Needed?</span>
Once data begins flowing on a candidate pair, it is still necessary
to keep the bindings alive at intermediate NATs for the duration of
the session. Normally, the data stream packets themselves (e.g.,
RTP) meet this objective. However, several cases merit further
discussion. Firstly, in some RTP usages, such as SIP, the data
streams can be "put on hold". This is accomplished by using the SDP
"sendonly" or "inactive" attributes, as defined in <a href="./rfc3264">RFC 3264</a>
[<a href="./rfc3264" title=""An Offer/Answer Model with Session Description Protocol (SDP)"">RFC3264</a>]. <a href="./rfc3264">RFC 3264</a> directs implementations to cease transmission of
data in these cases. However, doing so may cause NAT bindings to
time out, and data won't be able to come off hold.
Secondly, some RTP payload formats, such as the payload format for
text conversation [<a href="./rfc4103" title=""RTP Payload for Text Conversation"">RFC4103</a>], may send packets so infrequently that
the interval exceeds the NAT binding timeouts.
Thirdly, if silence suppression is in use, long periods of silence
may cause data transmission to cease sufficiently long for NAT
bindings to time out.
<span class="grey">Keranen, et al. Standards Track [Page 96]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-97" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
For these reasons, the data packets themselves cannot be relied upon.
ICE defines a simple periodic keepalive utilizing STUN Binding
Indications. This makes its bandwidth requirements highly
predictable and thus amenable to QoS reservations.
<span class="h3"><a class="selflink" id="appendix-B.7" href="#appendix-B.7">B.7</a>. Why Prefer Peer-Reflexive Candidates?</span>
<a href="#section-5.1.2">Section 5.1.2</a> describes procedures for computing the priority of a
candidate based on its type and local preferences. That section
requires that the type preference for peer-reflexive candidates
always be higher than server reflexive. Why is that? The reason has
to do with the security considerations in <a href="#section-19">Section 19</a>. It is much
easier for an attacker to cause an ICE agent to use a false server-
reflexive candidate rather than a false peer-reflexive candidate.
Consequently, attacks against address gathering with Binding requests
are thwarted by ICE by preferring the peer-reflexive candidates.
<span class="h3"><a class="selflink" id="appendix-B.8" href="#appendix-B.8">B.8</a>. Why Are Binding Indications Used for Keepalives?</span>
Data keepalives are described in <a href="#section-11">Section 11</a>. These keepalives make
use of STUN when both endpoints are ICE capable. However, rather
than using a Binding request transaction (which generates a
response), the keepalives use an Indication. Why is that?
The primary reason has to do with network QoS mechanisms. Once data
begins flowing, network elements will assume that the data stream has
a fairly regular structure, making use of periodic packets at fixed
intervals, with the possibility of jitter. If an ICE agent is
sending data packets, and then receives a Binding request, it would
need to generate a response packet along with its data packets. This
will increase the actual bandwidth requirements for the 5-tuple
carrying the data packets and introduce jitter in the delivery of
those packets. Analysis has shown that this is a concern in certain
Layer 2 access networks that use fairly tight packet schedulers for
data.
Additionally, using a Binding Indication allows integrity to be
disabled, which may result in better performance. This is useful for
large-scale endpoints, such as Public Switched Telephone Network
(PSTN) gateways and Session Border Controllers (SBCs).
<span class="h3"><a class="selflink" id="appendix-B.9" href="#appendix-B.9">B.9</a>. Selecting Candidate Type Preference</span>
One criterion for selecting type and local preference values is the
use of a data intermediary, such as a TURN server, a tunnel service
such as a VPN server, or NAT. With a data intermediary, if data is
sent to that candidate, it will first transit the data intermediary
before being received. One type of candidate that involves a data
<span class="grey">Keranen, et al. Standards Track [Page 97]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-98" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
intermediary is the relayed candidate. Another type is the host
candidate, which is obtained from a VPN interface. When data is
transited through a data intermediary, it can have a positive or
negative effect on the latency between transmission and reception.
It may or may not increase the packet losses, because of the
additional router hops that may be taken. It may increase the cost
of providing service, since data will be routed in and right back out
of a data intermediary run by a provider. If these concerns are
important, the type preference for relayed candidates needs to be
carefully chosen.
Another criterion for selecting preferences is the IP address family.
ICE works with both IPv4 and IPv6. It provides a transition
mechanism that allows dual-stack hosts to prefer connectivity over
IPv6 but to fall back to IPv4 in case the v6 networks are
disconnected. Implementation SHOULD follow the guidelines from
[<a href="./rfc8421" title=""Interactive Connectivity Establishment (ICE) Multihomed and IPv4/IPv6 Dual-Stack Guidelines"">RFC8421</a>] to avoid excessive delays in the connectivity-check phase
if broken paths exist.
Another criterion for selecting preferences is topological awareness.
This is beneficial for candidates that make use of intermediaries.
In those cases, if an ICE agent has preconfigured or dynamically
discovered knowledge of the topological proximity of the
intermediaries to itself, it can use that to assign higher local
preferences to candidates obtained from closer intermediaries.
Another criterion for selecting preferences might be security or
privacy. If a user is a telecommuter, and therefore connected to a
corporate network and a local home network, the user may prefer their
voice traffic to be routed over the VPN or similar tunnel in order to
keep it on the corporate network when communicating within the
enterprise but may use the local network when communicating with
users outside of the enterprise. In such a case, a VPN address would
have a higher local preference than any other address.
<span class="grey">Keranen, et al. Standards Track [Page 98]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-99" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Connectivity-Check Bandwidth</span>
The tables below show, for IPv4 and IPv6, the bandwidth required for
performing connectivity checks, using different Ta values (given in
ms) and different ufrag sizes (given in bytes).
The results were provided by Jusin Uberti (Google) on 11 April 2016.
IP version: IPv4
Packet len (bytes): 108 + ufrag
|
ms | 4 8 12 16
-----|------------------------
500 | 1.86k 1.98k 2.11k 2.24k
200 | 4.64k 4.96k 5.28k 5.6k
100 | 9.28k 9.92k 10.6k 11.2k
50 | 18.6k 19.8k 21.1k 22.4k
20 | 46.4k 49.6k 52.8k 56.0k
10 | 92.8k 99.2k 105k 112k
5 | 185k 198k 211k 224k
2 | 464k 496k 528k 560k
1 | 928k 992k 1.06M 1.12M
IP version: IPv6
Packet len (bytes): 128 + ufrag
|
ms | 4 8 12 16
-----|------------------------
500 | 2.18k 2.3k 2.43k 2.56k
200 | 5.44k 5.76k 6.08k 6.4k
100 | 10.9k 11.5k 12.2k 12.8k
50 | 21.8k 23.0k 24.3k 25.6k
20 | 54.4k 57.6k 60.8k 64.0k
10 | 108k 115k 121k 128k
5 | 217k 230k 243k 256k
2 | 544k 576k 608k 640k
1 | 1.09M 1.15M 1.22M 1.28M
Figure 12: Connectivity-Check Bandwidth
<span class="grey">Keranen, et al. Standards Track [Page 99]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-100" ></span>
<span class="grey"><a href="./rfc8445">RFC 8445</a> ICE July 2018</span>
Acknowledgements
Most of the text in this document comes from the original ICE
specification, <a href="./rfc5245">RFC 5245</a>. The authors would like to thank everyone
who has contributed to that document. For additional contributions
to this revision of the specification, we would like to thank Emil
Ivov, Paul Kyzivat, Pal-Erik Martinsen, Simon Perrault, Eric
Rescorla, Thomas Stach, Peter Thatcher, Martin Thomson, Justin
Uberti, Suhas Nandakumar, Taylor Brandstetter, Peter Saint-Andre,
Harald Alvestrand, and Roman Shpount. Ben Campbell did the AD
review. Stephen Farrell did the sec-dir review. Stewart Bryant did
the gen-art review. Qin We did the ops-dir review. Magnus
Westerlund did the tsv-art review.
Authors' Addresses
Ari Keranen
Ericsson
Hirsalantie 11
02420 Jorvas
Finland
Email: ari.keranen@ericsson.com
Christer Holmberg
Ericsson
Hirsalantie 11
02420 Jorvas
Finland
Email: christer.holmberg@ericsson.com
Jonathan Rosenberg
jdrosen.net
Monmouth, NJ
United States of America
Email: jdrosen@jdrosen.net
URI: <a href="http://www.jdrosen.net">http://www.jdrosen.net</a>
Keranen, et al. Standards Track [Page 100]
</pre>
|