previous contents up next

Unix for Advanced Users

13. Unix Networking

13.2. How Hosts Connect Across Subnets

First, we need to understand what subnets are.

13.2.1. What is subnetting?

Class A, B, C IP Addresses: Each site which wants to connect to the internet registers with a central authority to obtain a class A, B, or C internet address. Here is how you determines which class it is:

The practical difference between the three classes is that

Subnet Table

Decimal

Subnets

# Class A Hosts

# Class B Hosts

# Class C hosts

.192

2

4,194,302

16,382

62

.224

6

2,097,150

8,190

30

.240

14

1,048,574

4,094

14

.248

30

524,286

2,046

6

.252

62

262,142

1,022

2

.254

126

131,070

510

NA

.255

254

65,534

254

NA

There are no more class A addresses are to be had (because there are so few). Most large institution have one or more class B addresses (for example, IU-Bloomington has 129.79 and 149.?) and most small institutions have a class C.

Subnets or no Subnets? Assume that you have a class B address. As a network designer, you have two choices: a) design a flat network with 65,534 hosts, or b) divide the class B further across departments or institutional subunits. The latter is almost universally chosen for practical and/or political convenience even though this act, called subnetting, reduces slightly the number of IP addresses available for assignment to hosts. A subnet becomes the next to least reduceable (hostname being the least reduceable) unit of a class B network. A subnet is usually implemented as a single LAN segment (though sometimes repeaters or bridges are used to extend it).

Subnet Mask: If a network is implemented as a collection of subnets, there has to be some way to tell it apart from a flat (non-subnetted) network.

Usually, that part of an IP address which defines the network is called the network address; the rest is the host address. In our previous example of a class B network, the host address is represented by the last two octets in a flat class B (giving you 65,534 hosts).

A subnetted IP address is represented by assigning a bit mask for each bit in the IP address. If the bit mask is on (i.e. 1), that part of IP address is considered part of the network address; if off (i.e. 0), part of the host address. So, for a class B subnetted network, the subnet mask is 255.255.255.0. All the bits are zero for the last octet, hence this part of the IP address represents the host address on a subnetted class B. The first three octets represent the network address (since the bit masks are all on. (The third octet in this case represents the subnet number.)

128

10000000

64

01000000

32

00100000

16

00010000

8

00001000

4

00000100

2

00000010

1

00000001

previous contents up next