SUB-NETTING/ NETMASKING

Dav9862

Carder
Messages
41
Reputation
0
Reaction score
27
Points
8

TCP/IP Configuration Files​

Each machine on the network gets its TCP/IP configuration information from the following TCP/IP configuration files and network databases:

  • /etc/hostname.interface file
  • /etc/nodename file
  • /etc/defaultdomain file
  • /etc/defaultrouter file (optional)
  • hosts database
  • netmasks database (optional)

/etc/hostname.interface File​

This file defines the network interfaces on the local host. At least one /etc/hostname.interface file should exist on the local machine.The file contains only one entry: the host name or IP address associated with the network interface.

For Multiple Network Interfaces​

If a machine contains more than one network interface, you must create additional /etc/hostname.interface files for the additional network interfaces. You must create these files with a text editor.

/etc/nodename File​

This file should contain one entry: the host name of the local machine.

/etc/defaultrouter File​

This file should contain an entry for each router directly connected to the network. The entry should be the name for the network interface that functions as a router between networks.

hosts Database​

The hosts database contains the IP addresses and host names of machines on your network. If you use the NIS, NIS+, or DNS name services, the hosts database is maintained in a database designated for host information. For example, on a network running NIS+, the hosts database is maintained in the host table.

If you use local files for name service, the hosts database is maintained in the /etc/inet/hosts file. This file contains the host names and IP addresses of the primary network interface, other network interfaces attached to the machine, and any other network addresses that the machine must know about.

/etc/inet/hosts File Format​

The /etc/inet/hosts file uses this basic syntax:

IP-address hostname [nicknames] [#comment]

IP-address contains the IP address for each interface that the local host must know about.

hostname contains the host name assigned to the machine at setup, plus the host names assigned to additional network interfaces that the local host must know about.

[nickname] is an optional field containing a nickname for the host.

[# comment] is an optional field where you can include a comment.

When Local Files Provide Name Service​

On a network using local files for name service, machines running in local files mode consult their individual /etc/inet/hosts files for IP addresses and host names of other machines on the network. Therefore, their /etc/inet/hosts files must contain the:

  • Loopback address
  • IP address and host name of the local machine (primary network interface)
  • IP address and host name of additional network interfaces attached to this machine, if applicable
  • IP addresses and host names of all hosts on the local network
  • IP addresses and host names of any routers this machine must know about, if applicable
  • IP address of any machine your machine wants to refer to by its host name

What is Subnetting​

Subnetting is a method for getting the most out of the limited 32-bit IP addressing space and reducing the size of the routing tables in a large internetwork. With any address class, subnetting provides a means of allocating a part of the host address space to network addresses, which lets you have more networks. The part of the host address space allocated to new network addresses is known as the subnet number.

In addition to making more efficient use of the IP address space, subnetting has several administrative benefits. Routing can become very complicated as the number of networks grows. A small organization, for example, might give each local network a class C number. As the organization grows, administering a number of different network numbers could become complicated. A better idea is to allocate a few class B network numbers to each major division in an organization. For instance, you could allocate one to Engineering, one to Operations, and so on. Then, you could divide each class B network into additional networks, using the additional network numbers gained by subnetting. This can also reduce the amount of routing information that must be communicated among routers.

Creating the Network Mask​

As part of the subnetting process, you need to select a network-wide netmask. The netmask determines how many and which bits in the host address space represent the subnet number and how many and which represent the host number. Recall that the complete IP address consists of 32 bits. Depending on the address class, as many as 24 bits and as few as 8 bits can be available for representing the host address space. The netmask is specified in the netmasks database.

If you plan to use subnets, you must determine your netmask before you configure TCP/IP.

If you are going to implement subnetting, you need to use some of the bits in the bytes assigned to the host number to apply to subnet addresses. For example, a 16-bit host address space provides addressing for 65,534 hosts. If you apply the third byte to subnet addresses and the fourth to host addresses, you can address up to 254 networks, with up to 254 hosts on each.

If a netmask 255.255.255.0 is applied to the IP address 129.144.41.101, the result is the IP address of 129.144.41.0.

129.144.41.101 & 255.255.255.0 = 129.144.41.0

In binary form, the operation is:

10000001.10010000.00101001.01100101 (IP address)

ANDed with

11111111.11111111.11111111.00000000 (netmask)

Now the system looks for a network number of 129.144.41 instead of a network number of 129.144. If you have a network with the number 129.144.41, that is what the system looks for and finds. Since you can assign up to 254 values to the third byte of the IP address space, subnetting lets you create address space for 254 networks, where previously there was room for only one.

If you want to provide address space for only two additional networks, you could use a subnet mask of:

255.255.192.0

This netmask provides a result of:

11111111.11111111.1100000.00000000

This still leaves 14 bits available for host addresses. Since all 0s and 1s are reserved, at least two bits must be reserved for the host number.

Editing the /etc/inet/netmasks File​

If your network runs NIS or NIS+, the servers for these name services maintain netmasks databases. For networks that use local files for name service, this information is maintained in the /etc/inet/netmasks file.

How to Add a Subnet to a Network​

If you are changing from a network that does not use subnets to one that is subnetted, perform the following steps:

  1. Decide on the new subnet topology, including considerations for routers and locations of hosts on the subnets.
  2. Assign all subnet and host addresses.
  3. Modify the /etc/inet/netmasks file, if you are manually configuring TCP/IP, or supply the netmask to the Solaris installation program.
  4. Modify the /etc/inet/hosts files on all hosts to reflect the new host addresses.
  5. Reboot all machines.
 
Top