| 1 | BEP: 24 |
|---|
| 2 | Title: Tracker Returns External IP |
|---|
| 3 | Version: $Revision$ |
|---|
| 4 | Last-Modified: $Date$ |
|---|
| 5 | Author: David Harrison <dave@bittorrent.com> |
|---|
| 6 | Status: Draft |
|---|
| 7 | Type: Standards track |
|---|
| 8 | Content-Type: text/x-rst |
|---|
| 9 | Created: 12-May-2008 |
|---|
| 10 | Post-History: |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | So that peers may easily determine their IP address. A BitTorrent |
|---|
| 14 | tracker may return the requesting peer's public IP address. |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | Overview |
|---|
| 18 | ======== |
|---|
| 19 | |
|---|
| 20 | A BitTorrent client can easily learn the IP address used when sending, |
|---|
| 21 | but because of intervnening Network Address Translators (NATs) the IP |
|---|
| 22 | address of the client's host seen inside the client's private network |
|---|
| 23 | may differ from the IP address used to route the client's packets |
|---|
| 24 | through the public Internet. |
|---|
| 25 | |
|---|
| 26 | In BitTorrent as described in BEP 3 [#BEP-3]_, peers wishing to |
|---|
| 27 | transfer a file contact a central tracker. This tracker returns a |
|---|
| 28 | list of peers that are currently transferring the file. For all peers |
|---|
| 29 | that reach the tracker across the public Internet, the source address |
|---|
| 30 | in each request seen by the tracker carries the publicly routable IP |
|---|
| 31 | address of the requesting peer. |
|---|
| 32 | |
|---|
| 33 | A tracker implementing this extension returns the key *external ip* |
|---|
| 34 | with a bencoded string value containing the IPv4 address as a 32 bit |
|---|
| 35 | binary or containing the IPv6 address as a 128 bit binary. |
|---|
| 36 | |
|---|
| 37 | Using a 32 or 128 packed binary is idiosyncratic since the value for |
|---|
| 38 | the *ip* key returned in a dict within the *peers* list is returned as |
|---|
| 39 | a string using ipv4 dotted notation or a domain name. However the |
|---|
| 40 | packed representation poses no semantic disadvantage and is negligibly |
|---|
| 41 | smaller. |
|---|
| 42 | |
|---|
| 43 | The IPv4 part of this extension has been supported by uTorrent since |
|---|
| 44 | May of 2007. |
|---|
| 45 | |
|---|
| 46 | The tracker is not unique in its ability to see a peer's public IP |
|---|
| 47 | address. Any peer reached over the public Internet sees the public IP |
|---|
| 48 | address of the peer on the far side of the connection. The *Extension |
|---|
| 49 | Protocol* proposed in [#BEP-10]_ provides a mechanism for a client to |
|---|
| 50 | obtains its public IP from any of its peers. There is no conflict for |
|---|
| 51 | a BitTorrent client to support both tracker and peer methods, and they |
|---|
| 52 | have slightly different advantages. A peer can learn its external IP |
|---|
| 53 | from a tracker even when there are no peers. For trackerless swarms, |
|---|
| 54 | a peer can learn its IP from any peer whose reference was obtained from the DHT |
|---|
| 55 | [#BEP-5]_. |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | References |
|---|
| 59 | ========== |
|---|
| 60 | |
|---|
| 61 | .. [#BEP-3] BEP_0003. The BitTorrent Protocol Specification, Cohen. |
|---|
| 62 | (http://www.bittorrent.org/beps/bep_0003.html) |
|---|
| 63 | |
|---|
| 64 | .. [#BEP-5] BEP_0005. DHT Protocol. Loewenstern. |
|---|
| 65 | (http://www.bittorrent.org/beps/bep_0005.html) |
|---|
| 66 | |
|---|
| 67 | .. [#BEP-10] BEP_0010. Extension Protocol. Norberg, Strigeus, Hazel |
|---|
| 68 | (http://www.bittorrent.org/beps/bep_0010.html) |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | Copyright |
|---|
| 72 | ========= |
|---|
| 73 | |
|---|
| 74 | This document has been placed in the public domain. |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | .. |
|---|
| 79 | Local Variables: |
|---|
| 80 | mode: indented-text |
|---|
| 81 | indent-tabs-mode: nil |
|---|
| 82 | sentence-end-double-space: t |
|---|
| 83 | fill-column: 70 |
|---|
| 84 | coding: utf-8 |
|---|
| 85 | End: |
|---|
| 86 | |
|---|