BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


Networking with TCP/IP
Pages: 1, 2, 3

Once TCP/IP has determined which application you wish to use and how that application wishes to transport its data, it needs a mechanism to make sure the data makes it to the right computer. In other words, it needs an addressing scheme. The only type of address TCP/IP understands is an IP address; if your computer does not have an IP address, you can't use TCP/IP. Most operating systems use IPv4 (IP version 4) IP addresses, but this will be changing within the next few years as the Internet is slowly transitioned over to IPv6. If you are running FreeBSD 4.0 and above, your system understands both versions of IP addresses.



In IPv4, an IP address is divided into two parts: one part indicates the address of the network and the second part indicates the address of the host. (In TCP/IP, anything with an IP address is called a host, or sometimes a node.) All IPv4 addresses contain four numbers ranging from 0-255 separated by three periods; this is called dotted decimal notation. Each number is the decimal equivalent of eight binary bits, so it really represents an octet, or eight numbers. Which octets represent the network and the host addresses depends upon the class of IP address, as seen in the following table:

Class

Network ID

Host ID

Range

A

first octet

last three octets

1-126

B

first two octets

last two octets

128-191

C

first three octets

last octet

192-223

To determine the class of an IP address, compare the number in the first octet to the Range column of the table. For example, 163.48.92.47 is a Class B address, since the 163 in the first octet falls within the range of 128-191. Because it is a Class B address, the first two octets, 163.48, represent the network address, and the last two octets, 92.47, represent the host address.

TCP/IP was designed to use a globally unique addressing scheme. This means you can't just make up an IP address for your computer, because it may conflict with an IP address that someone paid money to use. Network portions of an IP address are purchased to guarantee they are unique; once you have a network address, you can do whatever you want with the host addresses as long as no two computers in your network have the same host address.

Fortunately, each class of IP address also has a reserved private range. Anyone can use a private range network address for their own network; the only caveat is that you'll need a real (or purchased) IP address if you want to leave your network: for example, if you want to access the Internet. The following table shows the private ranges:

Class

Private Range

A

10.x.x.x

B

172.16.x.x to 172.31.x.x

C

192.168.x.x

It is a good thing to use one of the private ranges on your network; which class you use is up to you. Most networks use a combination of private range IP addresses and NAT, or Network Address Translation. NAT is a software mechanism that allows a network of private addresses (which can't go on the Internet) to share a real IP address (which can go on the Internet).

Every IPv4 address must also have a subnet mask. I won't get into subnet masking in this article as that topic alone would fill a whole other article. If you're curious about subnet masking, 3Com's article on Everything You Ever Wanted to Know about IP addressing is a must-read.

Pages: 1, 2, 3

Next Pagearrow





Sponsored by: