OS X networking explained
12th Dec 2010 | 10:00
How to set up and troubleshoot an OS X network
OS X networking explained
Networks can be complex. They're a lot better than they used to be, but they're still the most complicated part of your Mac.
When you send a document to a networked printer, it's handed down from one protocol to another, broken into chunks, each with their own addressing scheme, until eventually it's transmitted as radio signals to represent those bits and bytes. As your print job flies through the air, it encounters interference and cross-talk from mobile phones, microwaves and power tools.
Your Wi-Fi access point plucks this signal from the air and reassembles the scrambled mess. Small errors are corrected, large errors are replaced with valid data, patiently re-sent. Your router reads the address on each packet and chooses the best way to pass it to its destination.
At the printer, the packets of data are placed in the correct order, the envelopes are opened and the wrappers discarded. As your document is finally translated from electricity to ink, the printer sends you a confirmation message that this miraculous endeavour has succeeded. And to get to you, that message makes the same incredible journey back through the protocol layers and across the airwaves to reach your Mac. At least, that's what you hope happens.
With so many different steps, it's no wonder that things sometimes go wrong. Network problems can feel daunting, with intermittent faults and error messages. But we're going to put a stop to all that. With our guide, we'll show you how your network is put together and where the choke points are. We'll cover how to set up a new network and why some networks are more error-prone than others. We'll tell you what kit to buy and what to avoid.
Despite all this, your network may still sometimes break. Long after death and taxes have both been abolished, network problems will remain. Home networking is a rough neighbourhood and you're always going to get shot at. But armed with the next few pages, you'll be able to roll for cover and return fire.
When you get broadband, your internet service provider (ISP) normally supplies you with a broadband modem. This, plus your Mac, is the simplest network you can have, and for lots of people it's all the network they need.
If you have ADSL broadband – the most common kind – it's delivered to your house through the phone line. At the phone socket, you plug in a filter that splits the frequency range, so that the lower 4KHz is used by voice phone calls and the rest is sent to the modem. The modem takes the analogue electrical signal from the phone line and extracts the digital data stream encoded within it.
This data takes the form of network 'packets' that are wrapped up using an addressing protocol called TCP/IP. (This is a fairly meaningless acronym, so don't bother trying to remember what it stands for.) Each TCP/IP packet contains a small piece of a website, or a graphic, or a downloaded file, or whatever is being sent from the internet. And every packet has a number, called an IP address, which identifies which computer or device it's intended for.
Your broadband modem has an IP address assigned to it by your ISP and, if you have a modem that plugs into a USB port on your Mac, then this IP address is available exclusively for the use of that Mac.
But if you want to connect more than one computer through the same broadband connection, you need a router – if you're not sure where yours is, that's because most modern broadband modems have a router built-in. If your modem has sockets for Ethernet cables, then it is actually a modem/router.
Router vs modem
The router is like a telephone exchange; it assigns separate IP addresses to all the computers connected to it and acts as a single point of contact for the wider network beyond it. When an incoming TCP/IP packet arrives from the internet, the router opens it and re-addresses it using the local IP addresses of your home network. This process is called Network Address Translation, or NAT.
As well as enabling your broadband connection to be shared among many computers, NAT provides a measure of security from hackers, as the IP address of your Mac is never exposed to the wider internet. Only the router uses the external IP address provided by your ISP.
This anti-hacking function is called a firewall. By itself, NAT already does quite a good job, but almost all routers nowadays have much more sophisticated hardware firewalls that actively block probing attacks and make it hard for a hacker to tell that you're actually connected to the internet at all.
A broadband/router with a Mac connected via an Ethernet cable is the simplest configuration. But your phone socket doesn't generally come into the house right next to the Mac and most of us would rather not have to start tacking Ethernet cable around the skirting board. The solution is wireless networking, also called Wi-Fi or AirPort.
A Wi-Fi connection is provided using a wireless access point and, again, most broadband modems include this in the same device. Instead of converting the TCP/IP packet into an electrical signal to transmit it along an Ethernet cable, a wireless access point broadcasts it as a radio signal. This is received by the Wi-Fi antenna in your Mac.
There are several international standards for Wi-Fi devices. They are cryptically labelled as 802.11a, 802.11b and so on, but they are usually just referred to by the last letter – as 'wireless b', for example. The most widely used systems are b, g and n. The later letters are faster, or more reliable, or both, but they are backwards-compatible with earlier Wi-Fi standards.
Generally, the slowest point in your network is your broadband connection, so unless you do a lot of transfers between devices on your network (to and from a networked disk, for example) it's a non-issue.
If you want to print across your network, you can always connect the printer to one of your computers and share it from there. But this only works when that computer is running. Some printers are network-aware and can be connected to your router directly. Otherwise, you can use a print server.
Your printer is served
This device connects to your router with a wired or wireless connection and lets you plug in one or more printers. It keeps its own queue of print jobs and makes sure they go to the right printer.
Apple's own-brand network devices are the AirPort Extreme Base Station, the Airport Express and the Time Capsule. An AirPort Extreme is a router with a wireless access point built-in. This is the same as the Wi-Fi router/modem from your ISP, except that it doesn't have the modem part.
There are still some reasons why you might want to add an AirPort Extreme though. It has a USB port that you can use to add an external hard disk or a printer (or both if you use a USB hub); these will then be accessible across the network, from your Mac.
The AirPort Express is a cut-down version of the Extreme. It only supports 10 simultaneous wireless devices instead of 50, and only one wired connection instead of three. The USB port on the Express can only be used to network a printer, not a hard disk, but it does include a stereo speaker jack that you can use to connect speakers or an amplifier and stream your music wirelessly from your iTunes library on your Mac.
Time Capsule is an AirPort Extreme with a hard disk actually built-in. You can use the disk for overflow storage or you can allocate it for use with Time Machine backups. You can also do this with a USB drive plugged into an Airport Extreme, but it's a setup that isn't officially supported by Apple, and using a Time Capsule is a little tidier.
Fixing OS X networking problems
When a network problem strikes, it isn't always immediately obvious. It's rare to get a clear message on the screen and it's easy to imagine that your Facebook app has simply crashed or a website is temporarily offline.
A good first check is to open a new window in Safari and try pointing at www.google.com. The web requires the least complicated protocols of any of the services that run over the internet, and Google has a nice fast web page that is always up.
The front page itself could be loading from Safari's internal cache, of course, so test your live connection to the internet by typing something random into the search box to force it to query the server. If you get a page of results, then you have an internet connection, at least.
If you get a progress bar that goes nowhere, followed by a 'Safari can't find the server' page, you've got problems.
If you have a wireless connection to your broadband router, cast a glance up at the menu bar on your Mac. The 'stripy slice of pie' icon on the right-hand side should be black. If it's greyed out, right-click it and see if you're connected to the right network.
Sometimes you'll see your Wi-Fi network listed in the 'available' section, but it won't have a tick against it to show that it's selected. This is because the network briefly disappeared from the radar and OS X hasn't automatically reconnected when it came back up. Just click it on the list to reconnect.
If your Wi-Fi link looks okay but you still have no internet connection, it's time to take a look at the router. Broadband modem/routers are little computers running an embedded operating system and they can crash just like any other computer.
If none of the lights on the front are flickering – either because they are all stuck on or they are all switched off – turn the modem off at the wall. Actually, do this even if your modem lights look normal – different modems use different light sequences to indicate problems and rebooting the modem is an easy and quick way to rule out a crash.
When your modem starts up it will begin with a power-on self-test, which is normally indicated by the power light flashing steadily. After about five seconds of this, the power light will change to steady. Next to light up will be the LAN lights for any wired Ethernet connections that are active, closely followed by the WLAN light, which should start blinking away.
After that there will be a pause as your modem logs in to your ISP and then the light labelled 'broadband', 'ADSL' or just 'DSL' will come on. After that, there should be another pause before the internet light comes on to indicate that the router has been allocated an external IP address from the ISP. If all the lights come on in more or less this sequence, then you can be confident that the broadband modem is working fine.
If any of the lights are yellow or red, or if the broadband or internet lights don't come on at all, then it could be that your modem is damaged. This can happen if the modem isn't ventilated and has overheated, or if the phone lines near your house are struck by lightning, sending a power surge to the modem. (This is why it's a good idea to disconnect the phone line from the modem if you have a big thunderstorm nearby.)
Alternatively, your ISP may be having technical problems at your exchange. Try calling their support hotline to check this.
Assuming that the modem restarts correctly but your network problems remain, the next step is to take as much complexity out of your network as you can. This will help you identify which link in the chain is failing.
Does your iPod touch or iPad still connect through Wi-Fi? If so, it's a sign that the problem lies with your Mac. If none of them can connect, try a wired connection. There are lots of things that can cause Wi-Fi networks to suddenly break, but most of them boil down to either incompatibility with another network device or problems with wireless security.
If you have recently changed broadband provider your wireless security key will have changed, but the new modem/router might also be using a different wireless security protocol. Some older network devices and computers have problems with the newer WPA2 protocol. Try temporarily turning security off and see if that makes a difference.
It's possible you might need to fall back to the older WEP protocol. This is less secure than WPA or WPA2, but it's still better than nothing. Wireless security is only to protect yourself from hackers within physical wireless range of your network, so depending on your neighbours you might not really need more than WEP.
Every device on your network must have a unique IP address. These take the form 192.168.1.n, where n is a number between 0 and 255. When you install a device, you can either choose a number for it yourself or you can let the router allocate one automatically, using a service called DHCP.
Using DHCP for all devices is usually the easiest option, but some devices don't support it or behave oddly with it. If you assign static IP addresses to some of your network devices, make sure that you restrict the address range that the DHCP server on your router can use, and assign static IP addresses that do not lie in this range.
First published in MacFormat Issue 228
Liked this? Then check out How to share files over a network in OS X
Sign up for TechRadar's free Weird Week in Tech newsletter
Get the oddest tech stories of the week, plus the most popular news and reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register