DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Setting up subnets

Setting up subnets

Subnetworking becomes an important feature as your organization's networking needs grow. Subnetworking lets you divide up your pool of Internet Protocol version 4 (IPv4) addresses so you can split those addresses across several physical networks within your organization.

This section describes how to assign IPv4 addresses and network masks to implement subnetworking for UnixWare® 7 systems.


NOTE: The introduction of IPv6 greatly simplifies the configuration and administration of organizational subnets. Both global and site-local IPv6 addresses define a 16-bit field that allows you to configure up to 65,536 subnets at a site. See ``Internet Protocol version 6 (IPv6)'' for more information.

Understanding subnets

For administrative or technical reasons, many organizations choose to divide one network into several subnets. Subnetworking enables several local networks to appear as a single Internet network to off-site hosts. It divides the addresses for a single network to accommodate the fact that the network consists of several physical networks. You should consider using subnets in the following instances:

Setting up a subnet requires you to:

Subnets allow you more flexibility when assigning network addresses. For details on network address assignment and network classes, see ``Network address''.

Network masks

A network mask, or ``netmask'', is used to divide an IP address into a network address and a host address. When you set up a network, the network mask must be common to all network interfaces on that network. The default network masks are 255.0.0.0 for class A, 255.255.0.0 for class B, and 255.255.255.0 for class C networks, as illustrated here:

Subnets are created by extending the network ID portion of an address by taking some bits from the host portion to create a subnet portion. The remaining bits can be used for host addresses within the subnet. The number of subnets that can be created from an m-bits long subnet address is 2^m. The number of host addresses per subnet that are available from an n-bits long host address is (2^n)-2. Unlike the subnet portion of the network address, the host portion cannot consist of all 0's or 1's. See RFC 1812 and RFC 1878 for more information.

``Subnetting a class B network'' illustrates the effect on a class B address of extending a network mask from 255.255.0.0 to 255.255.255.0:

Subnetting a class B network

This scheme creates 256 (2^8) possible subnet addresses (0 through 255) with 254 (2^8-2) host addresses (1 through 254) per subnet. In this way, you can create subnets for class A and B networks by converting the second and third octets, respectively, from host addresses to subnet addresses. Notice how the netmask changes accordingly:

The class A network 16 can now have up to 256 subnets (16.0 through 16.255). The class B network 172.16 can also have up to 256 subnets (172.16.0 through 172.16.255). While the netmask masks the network portion of the address, the broadcast address exposes the network address and hides the host portion. For example, the broadcast address for the subnet 172.16.246, with a netmask of 255.255.255.0, is 172.16.246.255.

For more information on setting netmask and broadcast addresses using the Network Configuration Manager, see ``Basic TCP/IP configuration parameters''.

For example, if an organization has a class B network, you could assign each physical network in that network a subnet number within that network. The sixteen bits for the host ID could be allocated as eight for subnet and eight for host, or nine for subnet and seven for host, and so on. Your decision would be transparent to everyone outside that organization.

A common example of subnetworking is to apply a class C type subnet mask (255.255.255.0) to a class B network. Applying this mask to a class B network provides you with 256 possible subnets, each one of which can accommodate 254 possible hosts (the host addresses 0 and 255 are not acceptable). If you know that none of your subnets will ever have more than 126 hosts but you need more than 256 but less than 513 subnets, you could decide to use nine bits for the subnet number, and seven bits for the host addresses. The appropriate mask for this would be 255.255.255.128.

Given this scheme and a network address of, for example, 131.60, the addresses of the first and last hosts on the first subnet (131.60.0.0) would be 131.60.0.1 and 131.60.0.126. The broadcast address on this subnet would be 131.60.0.127.

Partitioning a class C address is a similar process as you must take a portion of the fourth octet as the subnet address. For example, you might partition the first three (high order) bits of the fourth octet to represent the subnet, with the last five bits representing the host:

This scheme allows for up to 8 subnets of 30 hosts each, for a total of 240 hosts. The netmask for the hosts on these subnets is 255.255.255.224. The number 224 is a decimal representation of the binary octet 11100000, which masks the subnet portion of the IP address.

Possible subnets for the class C network 221.138.62.0, with associated broadcast addresses, are:

Subnet Hosts Broadcast address
221.138.62.0 .1-.30 221.138.62.31
221.138.62.32 .33-.62 221.138.62.63
221.138.62.64 .65-.94 221.138.62.95
221.138.62.96 .97-.126 221.138.62.127
221.138.62.128 .129-.158 221.138.62.159
221.138.62.160 .161-.190 221.138.62.191
221.138.62.192 .193-.222 221.138.62.223
221.138.62.224 .225-.254 221.138.62.255
After you determine the new addresses for your hosts, you must use the Network Configuration Manager to configure them. In addition, you must configure routers between your subnets: these are hosts with multiple networking interfaces and specialized routing hardware that can serve more than one network.

Subnetting and Classless Interdomain Routing

The number of class A and B addresses that are available for allocation to new networks has been steadily diminishing over time and is now virtually exhausted. In the late 1980s nearly all of the new networks assigned were class B, and in 1990 it became apparent that class B networks would run out by 1994 if the trend continued. Class C addresses (with a maximum of 254 hosts) were hardly being used because they were too small to be useful for most organizations, while class B networks were too large to be densely populated by any but the largest organizations.

The network number allocation policies of the InterNIC were changed in 1990, to avert the class B address exhaustion. If you apply for a network number, you are likely to be assigned a set of several contiguous class C network addresses or a single subnetted class C network address, rather than a single class B address. Which of these you receive will depend on the number of hosts that will exist on your network(s).

Where an organization has a range of class C network numbers, the range provided is assigned as a bit-wise contiguous range of network numbers, and the number of networks in the range is a power of 2. All IP addresses in the range have a common prefix, and every address with that prefix is within the range. For example, an organization requiring about 1000 IP addresses would be assigned four class C network numbers. A range of addresses satisfying these rules would be 195.34.136 through 195.34.139, in which case the range would consist of all the IP addresses with the 22-bit prefix 195.34.136. This is represented by the notation 195.34.136/22 (with the trailing zeros removed). ``Subnetting with CIDR'' illustrates this scheme.

Subnetting with CIDR

However, the problem with this situation is that each network has to be routed separately as standard IP routing only understands class A, B and C network addresses. The result of using a range of class C addresses is a routing table explosion problem: a class B network of 3000 hosts requires one routing table entry, whereas the same network if it was addressed as a range of class C networks would require 16 entries.

To overcome the routing table explosion problem, a scheme known as Classless Interdomain Routing (CIDR or ``supernetting'') is used to implement address assignment. CIDR does not route according to the class of the network number, but instead routes according to the high order bits of the IP address (the ``IP prefix''). The process of combining multiple networks into a single entry is called supernetting because routing is based on network masks that are shorter than the natural network mask of an IP address.

The details of CIDR may be found in RFC 1518 and RFC 1519. As the main purpose of CIDR is to reduce the size of the routing tables for the Internet, these documents will not usually be of interest to you unless you are a service provider or you maintain Internet routing tables on your system.

Variable length subnetting

There are two types of subnetting: static length and variable length. Static subnetting, in which all the subnets in the subnetted network use the same subnet mask, has already been described in ``Subnetting and Classless Interdomain Routing''. Native IP and RIP version 1 routing only support static subnetting. Variable length subnetting allows the subnets that make up the network to use different subnet masks. A small subnet with only a few hosts needs a subnet mask that accommodates only these hosts. A subnet with many hosts may need a different subnet mask to accommodate the hosts. Variable length subnetting allows you to divide the network so that it is possible to define adequate hosts for each subnet by changing the subnet mask for each network. RIP version 2 supports variable length subnetting as well as static subnetting. RIP version 1 only supports standard class lengths.

For example, a company with the address 195.34.136.0 needs to split the address range into five separate networks, as shown in ``Variable length subnetting''. There need to be 254 hosts on 3 of the subnets and 126 hosts on 2 of the subnets. This cannot be achieved using static subnetting as it can only divide the network into four subnets with 254 hosts each or eight subnets with 126 hosts each. To divide the address into five subnets, you should use multiple netmasks. The first four subnets use the mask 255.255.255.0 and have 254 hosts each. The first subnet can then be divided into two subnets with 126 hosts each and a subnet mask of 255.255.255.128. There would be three subnets with 254 hosts each and two subnets with 126 hosts each.

Variable length subnetting


NOTE: To use variable length subnetting, you must use a routing protocol that understands netmasks that differ from the standard class networks, for example RIPv2 , OSPF , BGP 4 and VLSM.

Each time you subnet your network you lose some available addresses, as these become broadcast addresses.


Migrating to a subnetted network

To change from an internetwork that does not use subnets to one that is subnetted:

  1. Decide on the new subnet topology, including considerations for subnet routers and locations of hosts on the subnets.

  2. Allocate addresses to all hosts that have static addresses.

  3. Reconfigure all hosts and routers to use their new IP addresses.

  4. Reconfigure the services that use IP addresses. Examples are:

More information about subnets may be obtained by consulting the following RFCs:

RFC Title
1518 An Architecture for IP Address Allocation with CIDR
1519 Classless Inter Domain Routing (CIDR): an Address Assignment and Aggregation Strategy
1812 Requirements for IP Version 4 Routers
1878 Variable Length Subnet Table For IP Version 4

The Subnet Calculator Interface

The Subnet Calculator:


NOTE: The Subnet Calculator should be used for calculation only. It does not implement the limitations and rules imposed by various RFCs. For practical purposes, you must understand these limitations and rules. For example, the network 10/8 should not be advertised on the Internet and should only be used internally, however the Subnet Calculator does not distinguish this network address from others. For details on what addresses are available, see ``Network address''.

You can start the Subnet Calculator in any of these ways:

For more information on SCOadmin managers, see ``Administering your system with SCOadmin''.

Depending on the selection made in the Subnet Calculator, the main screen displays network address, network address length, subnet address, subnet address length, number of hosts, host ranges, netmask, broadcast address and comments. Use View -> Expand to examine the complete details for a selected entry in the list, and View -> Collapse to display the network address, network address length and comment. You can also expand and collapse individual entries by double-clicking on them. You can expand and collapse all entries by selecting View -> Expand All and View -> Collapse All.

You can perform many tasks by using the shortcut buttons located under the menu bar. The purpose of these is explained by the point help.

With the Subnet Calculator you can perform the following tasks:

Creating a top-level address entry

You must first define the top-level address that you want to subnet. The top-level address is derived from the network address and the network address length (mask length) in bits, supplied to you by your ISP or a NIC. The top-level address is also known as the IP prefix. See ``Subnetting and Classless Interdomain Routing'' for more details.

To create an address:

  1. Select Edit -> Add -> Address.

  2. Enter your network address in dotted decimal notation, for example, 195.34.136.0.

  3. Select the network address length in bits, for example, /22. This is also known as the mask length.

    Depending on what type of network address you enter, the network address length is automatically assigned a length in bits according to whether it is a class A, B or C address. You can use the spin buttons to select the correct network address length.

  4. Click on OK.
The top-level address entry appears in the main screen, with the mask length for that address. You can also add a comment to identify the top-level address.

Creating subnet entries

Once you have defined a top-level address entry, you can add subnets to it, or you can further divide a subnet into other subnets (known as variable length subnetting). See ``Variable length subnetting'' for more details.

To add a subnet:

  1. Select the top-level address or subnet.

  2. Select Edit -> Add -> Subnets.

  3. Choose a subnet mask length (in bits) from those listed in the Length column.

  4. Select subnet ranges from those listed in the Subnet column.

    The Subnet column displays the mask length of the subnet and also displays the number of hosts and host ranges.

    For a particular subnet mask length, you can select all the subnet ranges in the list by clicking on Select All.

  5. Click on Yes to automatically assign hosts to subnets.

    You can also add hosts after you have assigned all the subnets. See ``Creating host entries''.

  6. Click on OK.

Creating host entries

To view the host address ranges that are available for a top-level address or subnet:

  1. Select a subnet or a top-level address.

  2. Select Edit -> Add -> Hosts.


NOTE: You can only add hosts to one subnet or top-level address at a time.

To add hosts to a top-level address which already has been assigned subnets:

  1. Select the top-level address.

  2. Select Edit -> Add -> Hosts.

  3. Select the host ranges.

    The number of hosts and host ranges are also displayed.

    You can select all the host ranges in the list by clicking on Select All.

  4. Click on OK.

Adding and modifying comments

Comments allow you to label subnets and top-level addresses as they will be allotted within an organization. For example, you could identify a subnet as belonging to ``Manufacturing''.

To add a comment:

  1. Select the top-level address or subnet.

  2. Select Edit -> Modify -> Comment.

  3. Enter a comment in the field.

  4. Click on OK.
You can add comments to a subnet whether or not it has any hosts configured for it. You can also modify existing comments.

Removing host entries

To remove hosts configured on a subnet, leaving the subnet intact:

  1. Select the subnet.

  2. Select Edit -> Add -> Subnets.


NOTE: You can only remove hosts that are configured on a single subnet.

Deleting a subnet entry

To delete a subnet, removing the whole subnet selected and any hosts configured on it:

  1. Select the subnet.

  2. Select Edit -> Delete.

  3. Click on OK.


NOTE: You can only delete one subnet at a time.

Deleting a top-level address entry

To delete a top-level address together with any subnets or hosts configured on it:

  1. Select the top-level address.

  2. Select Edit -> Delete.

  3. Click on OK.


NOTE: You can only delete one top-level address at a time.

Saving a subnet calculation

To save a new subnet calculation:

  1. Select File -> Save , or File -> Save As...

  2. Enter the filename.

    The default filename is untitled.nsc.

  3. Click on OK.
If you have already saved a subnet calculation, selecting File -> Save, automatically saves the file, without entering the ``Save As'' screen.

Loading a subnet calculation

To open a previous subnet calculation:

  1. Select File -> Open.

  2. Select the filename.

  3. Click on OK.
To open a new subnet calculation:

  1. Select File -> New.

  2. Enter the filename in the Selection field.

  3. Click on OK.

Printing reports

To print reports to a printer, or save them to a file as text or as a TCL list:

  1. Select the entry.

  2. Select File -> Print.

  3. Select one of these options:

    All
    Print a report containing all subnets and hosts configured in the Subnet Calculator.

    Selected
    Print a report containing only a selected subnet or host.

  4. Select a print style for the report:

    All
    Produces a report containing the subnet, host ranges, netmask, broadcast and number of hosts.

    Subnets only
    Produces a report containing the subnet, netmask, broadcast and number of hosts that are assigned or free.

    Hosts only (short)
    Produces a report containing the host ranges, subnet, netmask, broadcast and number of hosts.

    Hosts only (long)
    Produces a report containing the host ranges, subnet, netmask, broadcast and the number of hosts. The IP addresses of the hosts are also noted at the bottom.


    NOTE: The report content is affected by the list in the Subnet Calculator. For example, if you define one top-level address with no subnets, selecting Subnets only would not produce a worthwhile report.

  5. Select the destination for printing:

    Printer
    Enter the print command.

    A useful command to enter in this field is cat, as the output will then appear in a separate window. This means the information can be viewed easily and it also enables checking of the output. The pipe operator (|) is also supported.


    File
    Select the print format: Text or TCL Lists.

    The TCL Lists option allows you to save the data in a format that is suitable for later use by a Perl or TCL script.

    Enter a filename. You can also use Browse to select a file.

    The filename ending that is assigned depends on the print format.

  6. Click on OK.

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004