3.2 Networking Principles

Before plunging into the details of setting up a wireless network, it's important to understand the fundamentals of networking, specifically Transmission Control Protocol/Internet Protocol, or TCP/IP, which is the networking standard used by the Internet, as well as home and office connections. TCP/IP controls how data flows across the Internet and on Ethernet networks in your home or office.

3.2.1 TCP/IP

To understand TCP/IP, you'll need to know how computers identify one another, how they talk to other computers on the same network, and how they talk to machines on other networks or the Internet. IP address

On a TCP/IP network, each computer has an IP address. This address uniquely identifies each computer (also called a host) on the network. An IP address contains four numbers separated by periods and looks like this: IP addresses are all 32 bits in length, and are broken into four 8-bit parts. This allows each part to have numbers ranging from 0 to 255. The four parts are combined in a notation called dotted quad, which just means that each 8-bit value is separated by a period.

Assigning IP addresses isn't a simple matter of starting with the number 1 and counting upwards. There are really two parts to an IP address: the network number, and the host number within that network, as shown in Figure 3-2. By using two parts to an IP address, machines on different networks can have the same host number. However, because the network number of the two networks is different, the machines are uniquely identified (the machine numbers are the same, but the network numbers are different).

Figure 3-2. IP address components

IP addresses are assigned on the basis of the size of the company or organization requesting them. In a small company, there is no need for many IP addresses within the network. On the other hand, a large corporation or educational institution may have thousands of hosts needing IP addresses. IP addresses come in five classes, indicated by the value of the first byte of the IP address (the numbers before the first period in the address). The classes that we're interested in are Class A, Class B, and Class C. There are a Class D and Class E, but they have special purposes and are not used as part of the IP address numbering.

Class A

0to 127: Each Class A network supports a maximum of 16,777,214 IP addresses. There are 125 possible Class A networks (3 network numbers are reserved).

Class B

128 to 191: Each Class B network supports a maximum of 65,534 IP addresses. There are 16,382 possible Class B networks.

Class C

192 to 223: Each Class C network supports a maximum of 254 IP addresses. There are 2,097,150 possible Class C networks.

Figure 3-3 shows the network number and host number used in each class of IP addresses.

Figure 3-3. Network and host numbers in each IP address class

Some IP address ranges are reserved for special uses, and so are not assigned to any host: to to to

There are four IP address blocks that are reserved for private networks (you'll probably use one of these for a home or small business network, especially if you have a router on your network). These private networks can be configured to see the outside world without letting the outside world see them (see the "DHCP and NAT" section later in this chapter): to to to to

When setting up a computer or a router, you will often have to enter a number called a subnet mask. There's a long explanation of subnet masks that is fascinating to network engineers and of almost no interest to the rest of us. Let's skip to the important part: if you have less than 255 hosts on your network (which will almost always be the case on a home or small business network) and you are using an AirPort Base Station or similar access point from another vendor, the subnet mask number will be

Welcome to IPv6

The IP addresses referred to throughout this book are part of an IP addressing scheme called IPv4. This 32-bit scheme, which allows for approximately 4.3 billion hosts, worked great when the Internet was young; the original architects of TCP/IP didn't imagine that more hosts would be needed. However, around 1992 it became obvious that 4.3 billion IP addresses were just not going to be enough (some people think the world will run out of IPv4 addresses as soon as 2006), and the IETF (Internet Engineering Task Force, the folks concerned with the evolution of the Internet architecture) began the process of figuring out a larger IP addressing scheme. After years of work, the base specification for the new scheme, called IPv6, was released in 1998.

IPv6 expands the IP address size from 32 bits to 128 bits, which supports a vastly greater number of hosts. How many more? Approximately 340 undecillion, which is 340 followed by 36 zeros. This should do the trick. IPv6 is designed to allow every host on the Internet to have its own unique IP address, eliminating the need for NAT and other workarounds. Consequently, IPv6 will bring about the bright future we keep hearing about in which every car, mobile phone, and refrigerator will be hooked up to the Internet. IPv6 also has built-in security features that don't exist in IPv4.

IPv6 is not just of academic interest: it's being supported in most modern operating systems, and will become increasingly widespread in the next few years. Mac OS X has supported IPv6 since version 10.2 (Jaguar), and in 10.3 (Panther) the Network pane of System Preferences shows your machine's IPv6 address and allows you to configure that address (Figure 3-4). However, applications will need to be reengineered to take advantage of IPv6. Until browsers, email programs, and chat clients support IPv6, it will remain more promise than reality. Routers

A router is a hardware device that forwards data packets between networks. Typically, you'll use a router to connect your home or small business network to your Internet Service Provider's network and the Internet. For example, let's say that you have a high-speed DSL or cable modem connection. The service provider gives you a DSL modem or cable modem that hooks up to a phone line or coaxial cable. That modem has an Ethernet connector to which you can plug in a single computer, assuming you have not been saddled with a DSL or cable modem that uses a USB cable (and if you want to connect your access point to such a modem, you'll be out of luck, so talk to your ISP about replacing it). But if you have a network of computers that you want to share the high-speed connection, you'll need a router. You connect the router to your high-speed Ethernet connection, then connect the computers on your network to the router. That last connection, from your computers to the router, can use either a wired Ethernet network, or be wireless. Devices such as the AirPort Base Stations are combinations of routers and wireless access points, which is why they are sometimes called wireless routers.

Figure 3-4. IPv6 IP address in Panther

A Dynamic Host Configuration Protocol (DHCP) server, which is usually built into your router, automatically assigns an IP address to client computers when they log onto the network. This makes up for the fact that most DSL or cable-based home networks get only a single IP address from the provider, which would mean that only one machine could connect the Internet at any one time. Since that's no fun, most home routers also support Network Address Translation (NAT). With NAT, the router uses that single IP address assigned by the Internet provider, and computers connected to the router are assigned IP addresses that are only valid within the local network (and are unusable on the Internet at large). For packets that are sent out to the Internet, the router translates the local IP addresses into the real IP address that the router has. When a data packet from the Internet arrives for a computer on the local network, the translation process occurs in reverse, and the router sends the packet on to the correct local machine.

Because computers that are using a DHCP server to get their IP addresses can have those addresses change every time the computer logs onto the network, those addresses are known as dynamic IP addresses. It's fine to use dynamic IP addresses inside your network, because your router keeps track of how to get data packets to each computer on the network. Addresses that don't change are called static IP addresses. Routers with switches

Many non-Apple wireless routers also contain switches or hubs, which allow you to plug more than one computer into the router via Ethernet. Most home routers with switches have four Ethernet ports for direct Ethernet connections to computers, plus a fifth port that connects to the WAN port (Wide Area Network, in this case the connection to the DSL or cable modem). The Apple Base Stations do not contain switches; instead, they have just two Ethernet ports: one port for the WAN, and one Ethernet port for one wired computer or a local area network (LAN).