Overview of TCP/IP

Let's start with some definitions.

Clients and servers
There are two types of TCP/IP hosts: clients and servers. A client requests TCP/IP service; a server provides it. In planning your network, you must decide which hosts will be servers and which will be clients.

For example, if you want to telnet from a machine, you need to set it up as a client; if you want to telnet to a machine, it has to be a server.

Hosts and gateways
In TCP/IP terminology, we always refer to network-accessible computers as either hosts or gateways.
A node running TCP/IP that doesn't forward IP packets to other TCP/IP networks; a host usually has a single interface (network card) and is the destination or source of TCP/IP packets.
A node running TCP/IP that forwards IP packets to other TCP/IP networks, as determined by its routing table. These systems have two or more network interfaces. If a TCP/IP host has Internet access, there must be a gateway located on its network.
Note: In order to use TCP/IP, you need an IP address, and you also need the IP address of the host you wish to communicate with. You typically refer to the remote host by using a textual name that's resolved into an IP address by using a name server.
Name servers
A name server is a database that contains the names and IP addresses of hosts. You normally access a TCP/IP or Internet host with a textual name (e.g., www.qnx.com) and use some mechanism to translate the name into an IP address (e.g.,

The simplest way to do this mapping is to use a table in the /etc/hosts file. This works well for small to medium networks; if you have something a bit more complicated than a small internal network with a few hosts, you need a name server (e.g., for an ISP connection to the Internet).

When you use a name to connect to a TCP/IP host, the name server is asked for the corresponding IP address, and the connection is then made to that IP address. You can use either:

  • a name server entry in the configuration string _CS_RESOLVE


  • a name server entry in the /etc/resolv.conf file. For example:

For more information on finding TCP/IP hostnames and name servers, see /etc/hosts, /etc/nsswitch.conf and /etc/resolv.conf in the Utilities Reference.

Note: If the name server isn't responding, there's a timeout of 1.5 minutes per name server. You can't change this timeout, but many TCP/IP utilities have a -n option that you can use to prevent name lookups.
Routing determines how to get a packet to its intended destination. The general categories of routing are:
Minimal routing
You will only be communicating with hosts on your own network. For example, you're isolated on your own network.
Static routing
If you're on a network with a small (and static over time) number of gateways, then you can use the route command to manually manipulate the TCP/IP routing tables and leave them that way.

This is a very common configuration. If a host has access to the Internet, it likely added one static route called a default route. This route directs all the TCP/IP packets from your host that aren't destined for a host on your local network to a gateway that provides access to the Internet.

Dynamic routing
If you're on a network with more than one possible route to the same destination on your network, you might need to use dynamic routing. This relies on routing protocols to distribute information about the changing state of the network. If you need to react to these changes, run routed, which implements the Routing Information Protocol (RIP) and RIPv2.

There's often confusion between routing and routing protocols. The TCP/IP stack determines the routing by using routing tables; routing protocols let those tables change.