TCP/IP Server Setup

From Wiki99

Jump to: navigation, search

↑ Computers ↑
← prev: TCP/IP Ports next: Mail Theory →


Server TCP/IP Addressing

Now that we've told the base station what to do, we, of course, need to set up our server to have fixed IP address 10.0.1.201.

  • Go to the Network control panel.
  • Create a new location called something like "Home Server".
  • Choose the Airport interface,
    • choose the TCP/IP tab, and
    • change the popup menu for IPv4 addressing from DHCP to Manual.
      • For the IP address, use 10.0.1.201
      • For the subnet mask use 255.255.255.0
      • For the router use 10.0.1.1
      • For the DNS servers, type in the two DNS server entries I told you to copy from the Airport base station a few paragraphs ago.

(Note that if you want to connect your server to your base station using ethernet rather than wireless, you can certainly do so. This is certainly preferable if your networking hardware supports it, ie your base station has an ethernet out jack.
Obviously in the above as you set up your new "Home Server" location, you'll use the Ethernet interface rather than the Airport interface.)

You can leave "Search Domains" blank unless you have a good reason to put something in there.

One good choice for the search domains is the string "local" (type it in the text field without the quotes). This allows you to refer to machines on your local subnet named using Bonjour without having to type in the .local suffix. [If this makes no sense to you, ignore it. After you have some experience, it will make sense.]

Those of you who are slightly savvy might wonder why I didn't just use DHCP with manual addressing, which should mean I only have to type in one IP address. Well the sad answer is that, with my base station, it doesn't work, specifically the DNS server entries don't get set properly. So we have to go with a full manual setup. Maybe one day Apple will fix the problem, whether it's in the base station or in the Network prefs panel, so this works the way it should.


Server Ports

At this stage we now have everything set up so that the outside world can contact our server using ssh, smtp, or http. But if they try to do so, nothing useful will happen. Why not? Because when the packets targeting ssh or smtp or whatever reach our computer, there's no program listening to the port to which they are addressed.

The first step is to go to the Sharing prefs panel and, under the Services tab, activate Remote Login and Personal Web Sharing. These will, as the name suggests, install software that listens to packets addressed to port 22 (the ssh port) and 80 (the web port) and do something appropriate when those packets arrive.
In the case of ssh this means that, on typing in a password, you should be able to communicate with the server.
In the case of http this means that, on pointing your web browser at your server you should see a very unexciting "Apache is working" test page.

As long as your computer is behind the Airport base station and thus protected by NAT, (and you don't turn on any extra port mappings in the Airport base station) you can switch on any other sort of sharing that you want as well, for example you may want to plug your USB printer into the server and switch on Printer Sharing. You may want to switch on File Sharing.

The third tab in the Sharing prefs pane labelled Internet, sets up your Mac as a router. By now you should know enough about the low-level details of how the internet works to understand how to configure it if you ever need to.

The rest of the essays in this series deal with setting up software that will listen to various ports and do something useful.


← prev: TCP/IP Ports next: Mail Theory →

Personal tools