Jun
24th

Airport Extreme Port Mapping

I’m not an IT guy.

So when I decided I wanted to setup my Mac’s built-in Apache server to serve up goodness on the web straight from my home office, I went looking for info on how to remap ports to get my “sites” folder visible from outside my home network — from the Internet.

I had a hell of a time finding the right information on the web, and I’m going to have to redo this when I move in the fall, so I thought I’d post the information here for myself and for any other person looking to serve information through the web from his or her Mac.

Background: Your router uses the public IP address your machine is given by your Internet provider. It hands out different IP addresses to all the machines on that network. Usually these look something like 10.0.1.2, or 172.16.1.2, or 192.168.1.2. If you try to access that IP address from the Internet, it won’t work–that’s an internal address only, sort of like your home’s little intranet. To get access to your built-in Apache folders, we need to redirect the incoming requests to the appropriate machine. We have to trick the router.

It’s actually pretty simple. Assuming you’re using an Airport Express, Airport Extreme, or Time Machine (because why wouldn’t you?), here’s what you do:

Open Airport Utility. (An easy way to find it is to hold Command and hit the spacebar, then do a Spotlight search for Airport Utility.) Once it has found your Apple wireless device, select Manual Setup.

First we need to force the router to give the machine you want to serve the data an IP address ending with a digit higher than 200. I don’t know the technical reason for this (I’m not an IT guy), but I know that we need to do it. Select Internet on the top row of icons. Next, click the DHCP button right under the row of icons. Change the last digits of the DHCP ending address to 200, for example 10.0.1.200.

Now select Advanced on the top row of icons. Just below that area, select Port Mapping.

Now you’ll see this:

Click the plus sign at the lower left of the “Allow” box to start adding values.

What you’re doing here is re-routing certain specific requests for data. As an example, let’s start with Apache. To serve web data from your Mac to the Internet, you have to get out from behind your router’s IP address. Requests for web data come in on port 80. In the Port Mapping Assistant window, (the one that comes up when you click the plus sign), enter 80 for all the UDP and TCP Ports. That leaves only the Private IP address field blank. Here, enter the IP address the router has given your machine. Don’t know it? No problem.

Open System Preferences (use the aforementioned Spotlight method or the Apple menu in the upper left corner of your screen), and click Sharing. You will see a list of sharing services. The one we need to look at is Web Sharing, so click that. Now you will see Web Sharing: On. If you don’t see that, turn it on. Your “Sites” folder isn’t accessible unless this is on. Once it’s on, it will display the following message:

Web Sharing allows users of other computers to view web pages in the Sites folders on this computer.

Your computer’s website:
some numeric URL, like http://10.0.1.200

Your personal website:
That same numeric URL appended with with your username, like http://10.0.1.200/~yourname

* NOTE: What’s the difference between these URLs? The first one refers to the location Library/WebServer/Documents and the second refers to your Sites folder, found at /~yourname/Sites (where “yourname” is the user name for the active account), so technically you have two built-in webserver folders.

Enter the IP address of the location you want to serve data to the web from (whichever folder you want to use) in the Private IP address field in the Airport Utility. Now that you have port 80 mapped to this destination, you can surf to the IP address your ISP gave you and you will be forwarded to that folder. You can now buy a domain name and forward it to that IP address, for a truly professional look. No one would ever even know they’re browsing documents on your machine–at your home.

The Mac’s built-in web serving capabilities also include PHP support, but you may need to turn PHP on.

Some good things about serving data from your Mac to the ‘Net are:

  • Easily and quickly update information–just put documents in the folder on your Mac
  • No more slow uploads for large files. Just copy them to the folder and they’re ready for download from anywhere on earth
  • It’s free! No more ISP hosting charges. All you pay is your Internet provider’s bill
  • As a final note, iChat may act up after you make this change. To fix it, you need to add more “Allow” instances in Airport Utility. Using the same IP address information, create one entry for each of the following ports:

    16393 through 16402 (yes, one for each number between 16393 and 16402 — ten values total)
    5060
    5190
    5297
    5298, and
    5678

    So you should have 16 entries in all when you’re done.

    I think that’s it. Let me know if you run into problems.

    Next up: Setting up and managing MySQL on your Mac. I’ll show you how you can create and manage databases for your sites right from your Mac with the free, open-source MySQL package.

    Jun
    23rd

    Champions and finance fools

    Filed under Daily | No Comments »

    My neighbor, whom I suspect is operating a small porn operation out of his house, plays Queen’s “We are the Champions” very loudly every morning at 7:00. Perhaps that’s a contributing factor to his success in life.

    I say he might be operating a porn ring because sometimes weird people mistakenly come to my house looking for him, and I sometimes get the impression they’re perverts. The numbers on our houses are screwy, and it appears that his is mine and mine is his. Last week someone rang my bell and stood at my door with a huge stack of raunchy VHS tape boxes. Our conversation went like this:

    Me: Hey. What’s up?
    Perv: Here. Jason wants the whole order by midnight.
    Me: Uh, you’re at the wrong place.
    Perv: Stop screwing around.
    Me: No, seriously. You want the house next door, I think.
    Perv: This box is frickin’ heavy, bean*. Jason already told me not to take any shit from you.
    Me: No, he didn’t. He told you not to take any shit from my neighbor. (closing the door)
    Perv: Dude, come on. I have tacos in the car and they’re getting cold…

    * I think bean is what he said.

    My neighbor came over to apologize for this incident the next morning — after We are the Champions. I was like, “it’s cool.”

    I got into an argument with some jerk at my local Air Force finance office today. This guy was telling me something I thought was really stupid, so I asked for a supervisor–I wanted to talk to someone else. Apparently he hates when that happens. He got stupid mad at me. He was mumbling about not having time for this crap, which is odd since I was trying to get him to turn me and my issue over to someone else. Seems like if he was really pressed for time he would have enjoyed that idea. Anyway, he was exceptionally rude and unprofessional. I never have a good time in that office. I try to stay away, but for some things I just have to go over there. It’s like hell or something. Everyone is unhappy there, most of all me. The person he passed me off to backed him up on his stupid policy, so I had to go back to my office, call some people, wait for a fax and redo some papers, but I still think they’re doing it wrong. And besides, that’s not the point. This guy is in a customer service job, for Pete’s sake. He lacked courtesy, for sure. I hope he’s better with numbers than he is with people. Somehow I doubt it.

    That’s all for now. Only a few hours until Queen starts blasting…