Methods and systems for establishing communications through firewalls and network address translators

Disclosed are methods that enable communications to be established regardless of the presence of communications blockers, e.g., firewalls and NATs, in the path between two computing devices. Two devices each establish communications with a rendezvous service. Through the service, the devices signal each other to set up direct, peer-to-peer communications between themselves. If the devices fail to establish direct communications, then they invoke a relay service that provides the illusion of direct communications. In another aspect, an originating device attempts to establish communications with a recipient, using an address and port number associated with the recipient. If that attempts fails, possibly because a firewall is blocking communications, then the originating device retries using a port normally held open by firewalls. If this attempt also fails, then the originating device invokes the services of a proxy to negotiate a port acceptable for use by the recipient and by any intervening firewalls.

TECHNICAL FIELD

The present invention relates generally to computer communications, and, more particularly, to communications flowing through a firewall or a Network Address Translator.

BACKGROUND OF THE INVENTION

The growth of networks, specifically the Internet, is spurring a proliferation of applications based on peer-to-peer computer communications. In the older host-sever paradigm, a user took advantage of services provided by a more or less centralized corporate entity. In peer-to-peer communications, a user at one computing device communicates in real time directly with a user at another device. Computer telephony, teleconferencing, interactive games, and remote collaboration are just a few examples of increasingly popular applications that take advantage of inexpensive peer-to-peer communications.

It has long been possible to provide the illusion of peer-to-peer communications by means of a relay service. When two users wish to communicate, each logs on to the relay service and directs its communications to the relay service. The relay service receives the communications and forwards them on to their intended recipient. This approach is very useful as long as the amount of data transferred is small and the latency requirements are lax, but in cases that demand large bandwidth and real-time response, the relay service quickly becomes a traffic bottleneck. In addition, setting up and running a large relay service are quite expensive in terms of money and resources. Ideally, peer-to-peer applications can operate without the mediation of a relay service, but relays are still useful in providing connectivity when, for some reason, direct peer-to-peer communications are not possible.

Direct communications may not be possible if a “communications blocker” sits on the path between the peer computing devices. A firewall is a first example of a communications blocker. For security's sake, many users install firewalls between their computing devices and communications networks. Most firewalls protect computing devices by blocking incoming and outgoing communications except that which comes over specifically allowed addresses and ports. (Modern communications protocols, such as the Internet Protocol (IP), allow for the specification of source and destination fields called “ports,” in association with the source and destination addresses. Ports are often used to differentiate messages intended for separate processes running on a single computing device.) If a peer-to-peer application attempts to reach a computing device behind a firewall, the firewall may prevent communications from ever reaching the device. Even for communications directed to an open port on the firewall (e.g., port 80 is usually open), the port may be handling so much traffic from other sources that real-time response requirements cannot be met.

Another potential blocker of peer-to-peer communications is the Network Address Translator (NAT). Ideally, each computing device connected to the Internet is assigned a unique network address within the public address space. The growth of Internet connectivity, however, has rapidly depleted the supply of public addresses. To compensate, many computing devices today do not have public addresses but are, rather, assigned private addresses outside the public address space. Having disparate address spaces leads to complications, however. For example, a device with a private address cannot send a message to a device with a public address unless the private address is first translated to some public address. NATs automatically perform this translation by intercepting packets from the device with the private address and then replacing the device's private address in the packet header with the NAT's own public address. The packet is then sent along to the outside device with the public address. The NAT stores a mapping between the private address of the device behind the NAT and the public address of the device outside the NAT. When communications arrives from the outside device addressed to the public address of the NAT, the NAT refers to this mapping and replaces its own public address in the packet header with the private address of the device behind the NAT. By way of this mapping, the device behind the NAT can both send communications to and receive communications from a device in the public address space.

The NAT translation scheme is based on the premise that communications are initiated by the computing device behind the NAT. The NAT must first set up the translation mapping before it can know how to handle communications coming from the public network address space. Were a device in the public address space to attempt to initiate peer-to-peer communications by sending a message to the public address of the NAT, then, upon receiving the message, the NAT would search for a translation mapping for the sender's public address but would not find one. The NAT would discard the message, and the communications would fail. This problem is compounded when each device is behind its own NAT. In this case, neither device can initiate communications: while the NAT of the communications initiator sets up its translation mapping, the NAT of the recipient does not have an appropriate mapping and discards the incoming message. Communications never start. As NATs proliferate, this shortcoming impedes the spread of any application based on direct peer-to-peer communications.

Note that in the context of this application, “firewall” and “NAT” refer to services, not necessarily to specific devices. These services may be provided on separate hardware boxes, may be combined into one box, and may even be instantiated as software running on the computing device itself.

A known approach to the problem of NATs sets up a signaling exchange between a computing device behind a NAT and the NAT. (The discussion of the current paragraph applies as well to firewalls as it does to NATs, but only NATs are discussed to avoid repetition or having to repeatedly write “NAT/firewall.”) The device sends a message directly to the NAT. The message directs the NAT to allow the communications channel needed for a peer-to-peer application. However, this approach has its drawbacks. First, it forces the device to discover its NAT and to take the NAT's presence into account. Traditionally, devices did not need to know whether they sat behind a NAT: the NAT's operation was completely transparent. Second, because NATs operate automatically by intercepting communications and then discarding them or passing them along, no standard protocol exists to facilitate the signaling exchange. Adding that capability greatly alters the architecture of a NAT, which has often been an uncomplicated, firmware-based device. These considerations are compounded if the device sits behind a chain of multiple NATs or firewalls, some of which may be located far from it, such as at the facilities of the device's Internet Service Provider (ISP). The device may not be aware of all of these NATs and firewalls and may not have any means or permissions to communicate directly with them.

What is needed is a method for establishing communications that operates transparently to any communications blockers, e.g., firewalls, NATs, or what have you, in the communications path between peer computing devices.

SUMMARY OF THE INVENTION

The above problems and shortcomings, and others, are addressed by the present invention, which can be understood by referring to the specification, drawings, and claims. According to a first aspect of the present invention, two computing devices each establish communications with a rendezvous service. Each device can communicate with the rendezvous service regardless of the presence of communications blockers, such as firewalls or NATs, in the communications path between the device and the service. Through the rendezvous service, the two computing devices signal each other and coordinate their activities in setting up direct, peer-to-peer communications between the two devices. The signaling mechanism through the rendezvous service allows either computing device to attempt to establish communications. If both devices fail to establish direct, peer-to-peer communications, then they invoke the services of a relay service that provides the illusion of direct communications.

According to another aspect of the invention, usable separately or in conjunction with the first aspect, an originating computing device attempts to establish communications with a recipient computing device. The originating device uses an address and port number associated with the recipient computing device. If that attempts fails, possibly because a firewall is blocking communications, then the originating device retries using a port normally held open by firewalls. If this attempt also fails, then the originating device invokes the services of a proxy to negotiate a port acceptable for use by the recipient device and by any intervening firewalls.

The present invention, through its diverse aspects, enables communications to be established regardless of the presence of communications blockers in the path between two computing devices.

DETAILED DESCRIPTION OF THE INVENTION

Turning to the drawings, wherein like reference numerals refer to like elements, the invention is illustrated as being implemented in a suitable computing environment. The following description is based on embodiments of the invention and should not be taken as limiting the invention with regard to alternative embodiments that are not explicitly described herein. Section I presents devices that often stymie attempts to establish direct, peer-to-peer communications between two computing devices. Section II presents an exemplary computing environment in which the invention may run. Section III describes exemplary embodiments of the invention's methods.

I. Communications Blockers: NATs and Firewalls

Although the present invention does not involve changes to NAT or firewall functionality, it is important to understand those functionalities in order to understand the invention.FIG. 1ashows a prior art networking arrangement that is the basis for the following discussion of NATs and of the invention. In the Figure, a computing device100is connected via a local area network (LAN)102to a NAT104. The NAT also has a connection to a public address space, here represented by the Internet110. The network address106used on the LAN is a private address, that is to say, it is not valid in the public address space beyond the NAT. Because of this, device100cannot communicate with a computing device112in the public address space unless the private address106of device100is first translated. The NAT is responsible for this translation, and the mechanism of translation is described below with respect toFIG. 1b. Unlike the first device100, device112has a public network address114that needs no translation. Note that while IP addresses are a standard for the industry, the example addresses (106,108, and114) are intentionally shown in a non-IP format to indicate that the invention is not limited to any particular addressing format.

FIG. 1b, also from the prior art, shows how NAT104facilitates computing device100in setting up communications with the computing device112. Device100addresses an initial message to the public network address114of device112. The initial message follows the path116. Although the message is not addressed to the NAT, the NAT intercepts it and reads the “to address” field in the message's header. Because that field contains public network address114, the NAT knows to send the message out on its connection to the Internet110. However, the message as written by device100is not valid for the public address space because the “from address” field in the message's header contains the private network address106of device100. The NAT replaces this private address with its own public address108. The NAT also creates an address translation mapping that correlates the private network address106of device100with the public network address114of device112.FIG. 1cshows this mapping in the translation table118. Then, the NAT sends the altered initial message on its way. The initial message travels via the Internet110and is received by the destination device112.

The message path116has an arrowhead at one end to indicate that it is the path for initiating communications between computing devices100and112. That same path is traversed in the opposite direction by a response sent from device112to device100(although the exact path through the Internet110is immaterial). Device112addresses its response to the “from address” found in the header of the message it received. Because of the NAT's earlier translation, that address is actually the NAT's public address108. When the NAT receives the response message, it searches its translation table118for the message's “from address” in the column pertaining to the interface over which the NAT received the message. The response message comes over the NAT's external network connection. In the “External Network Address” column of table118is an entry corresponding to the “from address” in the response message. Having found the appropriate address translation entry, the NAT removes its own external network address from the “to address” field of the message's header and substitutes for it the internal network address indicated by the mapping. In this case, that is (1.2.3), the address of device100. In this manner, the NAT's address translation allows devices100and112to communicate with each other.

Computing devices100and112can communicate as long as the translation entry exists in the NAT's address translation table118. For the sake of security and to preserve memory resources, the NAT does not store the translation mapping forever. Some NATs remove the translation after a period of inactivity. This timeout period may depend upon the type of the communications and is typically on the order of hours for Transmission Control Protocol (TCP) communications and minutes or seconds for User Datagram Protocol (UDP) communications. Other NATs may monitor the communications flow and discard the translation when one side or the other indicates that the conversation is over.

Note that the success of the NAT's translation scheme depends upon the fact that the computing device behind the NAT, here device100, sends the initial message to initiate communications.FIG. 1d, again from the prior art, shows what happens when, instead, the computing device112attempts to initiate communications with device100. Because the private network address106of device100is invalid in the public address space of the Internet110, device112addresses its initial message to the public address108of NAT104. This initial message follows the path120. Just as when the NAT received the response message in the scenario ofFIG. 1b, the NAT looks for an address translation mapping in its table118. However, in the scenario ofFIG. 1dthe mapping shown inFIG. 1cdoes not exist because device100never sent a message through the NAT to device112. Without the mapping, the NAT cannot translate the “to address” field in the message's header to a private network address on LAN102. The message is discarded. Thus, in the prior art, a computing device outside of a NAT cannot initiate communications directly with a device behind the NAT. The problem is exacerbated when each computing device is behind its own NAT: then neither device can initiate communications with the other.

FIG. 2portrays another common communications blocker. The NAT104ofFIG. 1ais replaced by a firewall200. For purposes of the present discussion, a firewall may be thought of as blocking all communications, based on their addresses and port numbers, that have not been specifically allowed. For example, assume that the firewall is set up to allow communications between the computing device100and all devices, such as device112, in the public address space of the Internet110. However, the firewall only allows traffic directed to ports80and443. In the Figure, device100sends communications202directed to port80, address (12.9.7), the public address of device112. The firewall passes these communications unaltered. If device112were to attempt to communicate with device100on port1234, as in communications flow204, however, the firewall would prevent the communications from reaching device100. Firewalls present problems for real-time, peer-to-peer applications because, although a port can almost always be found that is open for communications through the firewall (e.g., port80is usually open), that port may be handling so much traffic from other sources that real-time response requirements cannot be met.

The similarity in the icons for NAT104introduced inFIG. 1aand the firewall200ofFIG. 2is suggestive: these two services are often provided by the same piece of hardware. In some cases, that hardware may be part of computing device100.

II. An Exemplary Computing Environment

The computing devices100and112ofFIG. 1amay be of any architecture.FIG. 3is a block diagram generally illustrating an exemplary computer system that supports the present invention. Computing device100is only one example of a suitable environment and is not intended to suggest any limitation as to the scope of use or functionality of the invention. Neither should computing device100be interpreted as having any dependency or requirement relating to any one or combination of components illustrated inFIG. 3. The invention is operational with numerous other general-purpose or special-purpose computing environments or configurations. Examples of well-known computing systems, environments, and configurations suitable for use with the invention include, but are not limited to, personal computers, servers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments that include any of the above systems or devices. In its most basic configuration, computing device100typically includes at least one processing unit300and memory302. The memory302may be volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.), or some combination of the two. This most basic configuration is illustrated inFIG. 3by the dashed line304. The computing device may have additional features and functionality. For example, computing device100may include additional storage (removable and non-removable) including, but not limited to, magnetic and optical disks and tape. Such additional storage is illustrated inFIG. 3by removable storage306and non-removable storage308. Computer-storage media include volatile and non-volatile, removable and non-removable, media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules, or other data. Memory302, removable storage306, and non-removable storage308are all examples of computer-storage media. Computer-storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory, other memory technology, CD-ROM, digital versatile disks (DVD), other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, other magnetic storage devices, and any other media that can be used to store the desired information and that can be accessed by device100. Any such computer-storage media may be part of device100. Device100may also contain communications connections310that allow the device to communicate with other devices. Communications connections310are examples of communications media. Communications media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism and include any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communications media include wired media, such as wired networks (including LAN102ofFIG. 1a) and direct-wired connections, and wireless media such as acoustic, RF, infrared, and other wireless media. The term “computer-readable media” as used herein includes both storage media and communications media. Computing device100may also have input devices312such as a keyboard, mouse, pen, voice-input device, touch-input device, etc. Output devices314such as a display, speakers, printer, etc., may also be included. All these devices are well know in the art and need not be discussed at length here.

III. The Invention in Operation: NATs, Firewalls, and Rendezvous and Relay Services

FIGS. 4a,4b, and4cpresent example scenarios in which two computing devices,100and112, attempt to establish direct, peer-to-peer communications with each other.FIGS. 5a,5b, and5c, respectively, illustrate exemplary methods that the devices may use in these scenarios. In an attempt to forestall the connection problems illustrated inFIGS. 1dand2, a rendezvous service400is provided. Computing devices can freely establish communications with the rendezvous service, typically by logging on to it. The devices can then discover other devices with which they wish to communicate and can send connection information to other devices by way of the service. This is made clearer by the examples described below. MICROSOFT'S “MSN MESSENGER” is an example of a rendezvous service.

Note that in the examples ofFIGS. 4a,4b, and4c, the communications blocker in front of computing device100is labeled “NAT/Firewall”: this represents any type of communications blocker, be it a NAT, a firewall, a combination of the two, or something else entirely. The particulars of the blocker's operation are not relevant to these examples.

In the first example, illustrated byFIGS. 4aand5a, computing devices100and112establish communications flows,402and404, respectively, with the rendezvous service400. While the corresponding steps,500and502, ofFIG. 5aare shown as occurring simultaneously, that need not be the case. Possibly using a discovery or naming service provided by the rendezvous service, device112decides to communicate with device100. In step504, device112invites device100to establish communications. The invitation is sent to the rendezvous service rather than directly to device100. In step506, the rendezvous service attempts (after possible translations not relevant to the present discussion) to pass the invitation along to device100. Even though device100is behind the communications blocker104/200, the already established communications flow402allows the invitation to reach device100. Upon receiving the invitation, device100in step508attempts to establish communications with device112. Because there is no communications blocker in front of device112, the attempt succeeds and devices100and112establish communications flow406with one another. In the parallel steps510and512, devices100and112use communications flow406to communicate directly with one other. Note the importance of the directness of communications flow406: it does not pass through the rendezvous service. That service is used only for signaling during establishment of the direct, peer-to-peer connection.

The example scenario ofFIG. 4ais not symmetric because computing device100is behind a communications blocker104/200while device112is not. The second scenario ofFIGS. 4band5bshows what may happen when, opposite to the example ofFIGS. 4aand5a, device100invites device112to establish communications. The procedure begins as before in steps500and502with the two devices establishing communications with rendezvous service400. This time, device100sends, via the rendezvous service, an invitation to device112to establish communications (steps514and516). When in step518, device112attempts to establish communications flow408, its attempt fails because of the communications blocker104/200in front of device100. (Note that the presence of a communications blocker need not doom this attempt to fail. The blocker may allow the communications in which case this attempt successfully establishes the communications flow as in the previous scenario. The procedures ofFIG. 5bonly proceeds if step518fails.) Device100becomes aware of device112's failure. That awareness may arise when the rendezvous service uses communications flow402to pass on a failure message sent to it from device112. Alternately, device100may time how long it takes device112to establish communications. If the timer goes off before communications are established, device100decides that device112failed. In any case, device100now attempts, in step520, to establish communications flow410with device112. Just as in the scenario ofFIGS. 4aand5a, this attempt succeeds because there is no communications blocker in front of device112. In the parallel steps522and524, devices100and112use communications flow410to communicate directly with one other.

Comparing the two scenarios presented so far, one may be tempted to think that the procedure ofFIG. 5bis extraneous because devices would simply choose to use the procedure ofFIG. 5aand have the device behind the communications blocker always be the one to attempt to establish the communications. The situation is not so straightforward, however, because a device cannot always know whether or not it is behind a communications blocker. The invention is designed to work regardless of whether either or both devices are behind blockers.

In the third example scenario ofFIGS. 4cand5c, a communications blocker412sits in front of computing device112. It is clear that because a blocker sits in front of each device, neither device may be able to establish direct, peer-to-peer communications, that is, the procedures of bothFIGS. 5aand5bmay fail. In this case, the devices settle for a second best solution. In step526, presumably after attempting the procedures ofFIGS. 5aand5b, one of the two devices (shown as device100but that is not significant) establishes communications flow414with a relay service416. The relay service is designed just for such situations: it accepts communications from each device and passes them on to the other. It is optimized for low delay and high throughput. The relay service sends to device100a session identifier. In step528, device100invites, via the rendezvous service400, device112to use the relay service to communicate with it. The invitation includes the session identifier. Device112establishes, in step532, communications flow418with the relay service and gives the relay service the session identifier. With this, the relay service knows to pass communications between devices100and112. In the parallel steps534and536, devices100and112use their communications flows414and418, respectively, to the relay service to communicate with one other. The arrow between these two steps has a dashed outline to indicate that the communications are indirect, being mediated by the relay service.

In sum, by proceeding through the procedures ofFIGS. 5aand5b, two computing devices can use a rendezvous service to establish direct, peer-to-peer communications even if either one of the two devices sits behind a communications blocker. If communications blockers prevent both devices from establishing direct communications with the other, then the devices can use a relay service to communicate indirectly with each other, providing the illusion of direct communications.

FIG. 6presents a scenario of communications blocking specific to firewalls. As discussed with reference toFIG. 2, a firewall may be configured to block all communications, based on their addresses and port numbers, that have not been specifically allowed. Computing device112attempts to establish communications flow600through firewall200to device100, but the firewall is not configured to accept the port number that device112is using and so discards the message.FIGS. 7a,7b, and7cportray a method that device112can use to establish communications in spite of the blocking firewall. In step700, device112attempts to establish communications flow600as it normally would, addressing the flow to device100and using a port usually open to communications. For example, port80is often open. If the attempt succeeds, then devices100and112can communicate directly with one another. Else, device112move to step702and again attempts to establish communications flow600. This time, however, device112uses a different port number, perhaps one often open on firewalls. Some firewalls open port443for encrypted communications, but will allow anything to pass through. If this attempt succeeds, the procedure is complete. Otherwise, device112proceeds to step704in which it establishes communications flow602with a proxy service604. The proxy may have privileges beyond those of device112and may be able to establish communications flow606with device100. In so doing, the proxy may use the port originally attempted by device112(e.g., port80), may use port443, or may negotiate with the firewall to use another port. This is reflected in steps706,708, and710ofFIG. 7b. If the proxy succeeds, then as shown in parallel steps712and714, devices112and100can communicate with each other through the proxy. There is nothing special about the order of steps700,702,704, and708: device112may attempt these steps in any order. Note that this procedure may be used whenever device112is having difficulty establishing direct communications with device100. In particular, it may be useful in conjunction with the procedures ofFIGS. 5a,5b, and5c.

The methods ofFIGS. 5a,5b,5c,7a,7b, and7cmay be implemented in any number of ways. They may be incorporated into network communications drivers running on the computing devices100and112. That way, the procedures become transparent to users of and applications running on the devices. In many cases, users and applications need not know whether they are using direct, peer-to-peer communications or a relay service, the originally chosen port number, another port number, or a proxy service. Of course, this information can be provided to users and application if desired.

In view of the many possible embodiments to which the principles of this invention may be applied, it should be recognized that the embodiments described herein with respect to the drawing figures are meant to be illustrative only and should not be taken as limiting the scope of the invention. Therefore, the invention as described herein contemplates all such embodiments as may come within the scope of the following claims and equivalents thereof.