Set up Port Forwarding on your Router


Set up Port Forwarding on your Router

Port forwarding is how you tell the router to relay requests from the internet to the Mac with the server.

There are two ways to do this: You can set up your Mac as a "DMZ" to forward all ports to a single Mac which is exposed to the entire internet.

Forwarding individual ports is a more selective. It allows you to use more than one Mac as a server, and retains most of your Router's inherent firewall protections.

The LinkSys Router sets up the port forwarding from the Advanced area's Forwarding screen. Just fill in a short description, the port range (if only one port, use the same number twice), and the local/private IP Address of the Mac with the server, and be sure to check TCP and Enable boxes. The click Update.

LinkSys Port Forward Screen

Apple's Airport admin utility has a Port Mapping screen (click "Show all Settings". Just click the Add button, then fill in the port (Apple let's you change the port number, though you usually won't want to, so fill in the same port number in both Public and Private port fields) and local/Private IP Address of the Mac running the server.

Airport Port Mapping Screen

The IP Address 10.0.1.20 shown here is the static IP address I assigned to my Mac on the Airport network (see here.) Port 548 is the port for Apple's personal file sharing.

Other router brands use other terms for port forwarding. Netgear sensibly call it Port Forwarding from the Advanced sub-menu. The D-Link routers use the Advanced Virtual Server screen to configure this feature. The Belkn routers use the Virtual Server screen under the Firewall settings page to configure this feature. If you can't find it for your router, loop up your router brand at this site.

Here's a list of some of the more common ports for other services you might want to set up:

PortService
548, 427Apple Personal File Sharing
139Windows File Sharing
20-21 and 1025-65535FTP  (read more about FTP ports)
80Web server (HTTP)
443Secure Web server (HTTPS)
3283Apple Remote Desktop (check UDP, too.)(See Apple KBase Article)
6346Gnutella file sharing
6881-6889BitTorrent file sharing
5060, 5190, 5297, 5298 and 16384-16403 iChat AV(See Apple Kbase Article 93208)
Most of these are pre-configured and named in OS X's Sharing Preference pane's Firewall tab.
Apple lists all the port used by OS X in this Knowledge Base Article. You can find ports for popular non-Mac applications (in case you have a PC on your LAN) at this site. You can find a complete list of internet port registrations IANA.

Setting up a DMZ

If you really want, you can use a DMZ instead of forwarding only one (or a group of) port.

You can designate one computer on your home network as a DMZ (DeMilitarized Zone, an odd reference to a system completely unprotected by the Router's inherent firewall and exposed to the internet.) This forwards all ports, UDP and TCP, to that single Mac. It can be used if you have only one Mac running a server on your LAN, and if you don't mind that it removes the firewall protections of your Router from that Mac.

On a LinkSys router, go to the Advanced settings and use the DMZ tab. Enter the local (private) IP Address you assigned to the server Mac.

Airport Port Mapping Screen

With the Apple Airport (Extreme) Base Station you establish a DMZ host with the Airport Admin Utility, on the Airport tab, click "WAN Privacy..." button. Check the Enable Default Host box and enter the IP address of the Mac you want to use. (This is not available with old Airport Base Station firmware.)

Personally I much prefer forwarding individual ports to using a DMZ for the added security and flexibility. But, there's no denying this is easier to set up. If you do this, be sure to turn on the Mac OS X Firewall.

More than One Mac Server

If you have more than one Mac on your LAN running a server, and you want to allow access to both from the internet, you have another problem: Port Forwarding (and the DMZ) can only specify one Mac for any given port. So, how do you get at either Mac server?

You have to use a different external port for each server. How you change the port for the server on the Mac, and how you access different ports from the netowrk client, depends on the service.

For example, you can change the port of your Mac OS X WebServer.

rest TBS - sorry


BACK (Assign a Static IP Address)           Top           NEXT (Find your Public IP Address)