### TechNote

Number: 03102-01
Date: October 1994

## TCP/IP addresses explained

### Introduction

This TechNote describes the structure of TCP/IP addresses, and the meaning of each address component.

TCP/IP uses unique 32-bit binary addresses. These are often called internet or IP addresses, and are used as universal machine identifiers. IP addresses include both the network and a host on the network. They do not specify individual machines, but a connection to a network. For more information on the principles of TCP/IP, see TechNote 03101.

### Address classes

TCP/IP addresses can be one of five classes according to the type of address. The three main classes are as follows:

- Class A allows up to 126 networks, with up to 224 hosts each
- Class B allows up to 16 383 networks, each with up to 65 534 hosts
- Class C allows up to 221 networks, with up to 254 hosts each

Consequently, each address is broken down into a network identifier (netid) and the host identifier (hostid).

A bit or bit sequence at the start of each address determines the class of the address:

- Class A is identified by a single '0', leaving 31 bits for the address
- Class B is identified by the sequence '10', leaving 30 bits for the address
- Class C is identified by the sequence '110', leaving 29 bits for the address

The address format for each of the three classes is as follows:

                0 1 2           8              16                24
    Class A    |0|    netid	    |                 hostid                       |

    Class B    |1|0|           netid            |               hostid         |

    Class C    |1|1|0|                netid                       |    hostid  |

### Dotted decimal notation

To present the addresses in a more understandable form, the 32 bits are broken down into four 8-bit groups, and are given in decimal. For example:

`142.85.7.2`

### This host

Use a hostid consisting entirely of 0s to specify "this host", and an internet address network- id of 0.0.0.0 as "this network". You should use this address only in situations where it can be interpreted unambiguously.

### Host on this network

To identify a host on the local network, use 16 zeros for the first half of the address, and the next 16 bits to identify the host. For example, 0.0.52.112 would identify an address on the same network.

### Limited broadcast

You can use limited broadcast addressing to provide a broadcast address for the whole local network independent of the assigned IP address. A local broadcast address consists of 32 1s (255.255.255.255). A host can use this address as part of a start-up procedure before it establishes its IP address for the local network.

### Directed broadcast

Use a directed broadcast address to specify broadcast on a targeted network. It consists of both a valid network-id and a hostid of all 1s. It can therefore be interpreted unambiguously at any point on an internet. For example, 100.56.255.255 .

### Loopback address

A packet sent to the network address 127 should not appear on any network. This address (127.0.0.0) is reserved for loopback and is designed for local testing and inter-process communication.

### Subnet addressing

Often in a computer network environment, an organization may have a single network address which covers a number of physical networks. The mechanism by which these are addressed is known as subnet addressing or subnet routing.

Typically, a site will have a single class-B IP network address, with two or more physical networks. The local gateway will be connected to the physical networks and can route the traffic between them.

In this situation, all gateways in the internet behave as if there is a single physical network. If the Internet tries to address 128.10.0.0, the gateway determines the subnet address of network A as, typically, 128.10.1.0, and that of network B as 128.10.2.0 .

### Summary of Address Conventions

The following diagram illustrates the address conventions described above.

The first two formats are only allowed at system startup and are not valid destination addresses. The limited and directed broadcast formats are not valid source addresses. The loopback address should never appear on a network.