IP Addresses, URLs, and Ports

IP Addresses, URLs, and Ports

Before I get started with connection strategies, I want to cover a topic that will make the rest of the chapter much easier to read and use, and that's the issue of the address you use to connect to another computer. Most of the sections in this chapter have one thing in common: you're connecting to another computer over a network (LAN, WAN, or the Internet). To make such connections, you need to know the IP (Internet Protocol) address or domain name of the target computer. You also need understand how to provide that address. Here are some issues to be aware of when dealing with IP addresses, URLs, and ports.

What's the Address?

Every computer on the Internet has its own IP address that uniquely identifies it (much like a street address for a residence). These IP addresses are formatted as x.x.x.x, where each x is a number between 0 and 255, and connecting to another computer involves providing its address to your own computer, so that it knows the exact destination it's attempting to reach. This means that if you're trying to connect to another computer or server over the Internet, you need to make sure you have the correct IP address.


In many cases (especially on the Web), you don't have to remember the actual numerical address; you only have to provide a domain name (e.g., cnn.com, apple.com, white-house.gov), and your computer and the Internet's DNS (Domain Name System) servers work together to figure out the actual IP address for you.

Unfortunately, there are a few wrinkles when it comes to IP addresses, such as issues with Internet routers and dynamic IP addresses; I covered these issues in the previous chapter. As the person connecting to another computer, these issues don't affect you as much—it's the responsibility of the server's owner/administrator to figure them out, and to simply provide you with an IP address that works. However, I mention the issue here because if for some reason you can't connect to a remote computer, keep in mind that the reason might actually be a problem with the IP address you've been given (i.e., it might not be your fault).

Finally, if you're connecting to another computer on a local network and both computers are behind an Internet router, there's a good chance the other computer will have what is known as an internal or local IP address. These addresses—in the format of 10.x.x.x, 172.16.x.x, or 192.168.x.x—are not used for Internet communication; they are reserved for traffic inside a local network.


If you're lucky enough to be on a local network with other Rendezvous-capable computers, you won't have to worry about IP addresses or domain names. In most cases connecting is as simple as clicking on a computer's name in a dialog box.

URLs: Not Just HTTP

Anyone who's surfed the Web has seen plenty of URLs—the addresses of web pages. However, most users are unaware of what that URL actually signifies, and that URLs are not at all specific to the Web.

A URL (Uniform Resource Locator) is a string of characters in a specific format that provides a standardized way of locating a resource (such as a file). Although URLs are most commonly used for websites and web pages, they were designed to be extremely versatile, and as such are used for many different types of computer-to-computer connections (and sometimes even for accessing files on your own computer). In fact, as I show you how to connect to various types of sharing services, you'll find that in many cases Mac OS X expects you to use URLs. What's more, as you'll discover later in the chapter, once you get the hang of URLs you'll find that you can use their standardized nature to your advantage by creating Internet Location files as shortcuts.

The official format of a URL is protocol://server:port/directory/file. Here's what each part means:

  • Protocol The protocol can be HTTP (hypertext transfer protocol, for websites), FTP (file transfer protocol, for FTP servers), SMB (server message block, for Samba file servers), AFP (Apple File Protocol, for servers using Apple's File Sharing), FILE (for local files), or one of a number of other methods in which data is transferred over the Internet.

  • Server The IP address or domain name of the computer hosting the resource you're attempting to access.

  • Port The specific port on the server that handles the service you're accessing. As I mentioned in the previous chapter, because a single computer can provide multiple services (web serving, e-mail, file sharing, etc.), each service is assigned a specific port number(s). These ports aren't physical ports (like Ethernet, modem, and USB ports); rather, they're a way to divide network traffic and route it to the appropriate service on a computer. For example, a connection to port 80 on most computers tells the host computer that the connecting computer is attempting to access a web page. To make things easier for users, almost every type of Internet service has a default port (http://www.iana.org/assignments/port-numbers); if a port is not included in a URL, the default port is assumed. For example if you enter a web URL into your browser, but do not include port 80, your browser automatically includes :80 in the URL when it sends a request to the web server. (See "Servers and Alternate Ports," for what to do when a server uses a nonstandard port.)

  • Directory and file Much like the path to a specific file on your computer, the /directory/file portion of a URL tells the server exactly which directory and/or file you wish to access on the remote computer/server. If no path is included, the server automatically directs you to a specific directory or file (depending on how the server is set up).


It's possible, when connecting to some servers, to include your name and password in the URL. For example, if you're connecting to a website for which you have a user account, you can often include your name and password in the URL like this: <http://username:password@server/path/.> However, this is generally risky since URLs are almost always sent over the Internet in plain text. It's better to connect and then provide your name/password, as many servers have the ability to communicate securely after the initial connection.


For more information about URLs, check out http://www.w3.org/Addressing/rfc1738.txt.

Servers and Alternate Ports

I mentioned earlier that most Internet protocols communicate over default port numbers. This ensures that computers are able to communicate easily. For example, FTP generally uses ports 20 and 21, HTTP uses port 80, and Apple's File Sharing uses ports 427 and 548. However, there are times when a server may use a different port than expected. For example, as mentioned in the previous chapter, some Internet service providers block standard file sharing/FTP ports to prevent users from sharing files over the Internet. As another example, some network administrators use firewalls to block all but the essential ports (web and e-mail, for example) to increase network security. To get around such restrictions, the owner of a server can manually configure it to use a different port for a particular service(s). If this is the case, they will most likely provide you with the correct port to use, and you should include the port number in the URL as described above.

Servers Simplified

Now that you understand what kind of address or domain name you need in order to connect to another computer, to make the rest of this chapter easier to read I'm going to refer to that address or domain name simply as the server address. For example, if I say that to connect to Personal File Sharing on another Mac, you need to type afp://serveraddress/, you should replace serveraddress with the appropriate IP address or domain name of the computer to which you're trying to connect (including the port number, if the service is using a nonstandard port on the target computer). This will save me a lot of repetitive explaining, and you a lot of confusion, later in the chapter.