/etc/defaultrouter file (optional)
netmasks database (optional)
The Solaris installation program creates these files as part of the installation process. You can also edit the files manually, as explained in this section. The hosts and netmasks databases are two of the network databases read by the name services available on Solaris networks. Network Databases and nsswitch.conf File describes the concept of network databases in detail. For information on the ipnodes file, see /etc/inet/ipnodes File.
This file defines the network interfaces on the local host for IPv4. A minimum of one /etc/hostname.interface file should exist on the local machine. The Solaris installation program creates this file for you. In the file name, interface is replaced by the device name of the primary network interface.
If you add a new network interface to your system after the initial Solaris software installation, you must create an /etc/hostname.interface file for that interface, add the interface's IP address to the /etc/inet/hosts file, and reboot the system with the -r option. See substeps within How to Configure a Host for Local Files Mode for instructions. Also, in order for the Solaris software to recognize and use the new network interface, you need to load the interface's device driver into the appropriate directory. Refer to the documentation that comes with the new network interface for the appropriate interface name and device driver instructions.
The file contains only one entry: the host name or IPv4 address that is associated with the network interface. For example, suppose smc0 is the primary network interface for a machine that is called tenere. The /etc/hostname.interface file would have the name /etc/hostname.smc0. The file would contain the entry tenere.
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. The Solaris installation program does not create them for you.
For example, consider the machine timbuktu, which is shown in Figure 4–1. This machine has two network interfaces and functions as a router. The primary network interface le0 is connected to network 192.9.200. The IP address is 126.96.36.199, and its host name is timbuktu. The Solaris installation program creates the file /etc/hostname.le0 for the primary network interface and enters the host name timbuktu in the file.
The second network interface is le1. This interface is connected to network 192.9.201. Although this interface is physically installed on machine timbuktu, the interface must have a separate IPv4 address. Therefore, you have to manually create the /etc/hostname.le1 file for this interface. The entry in the file would be the router`s name, timbuktu-201.
IPv6 uses the file /etc/hostname6.interface at start up to automatically define network interfaces in the same way IPv4 uses /etc/hostname.interface. A minimum of one /etc/hostname. or /etc/hostname6. file should exist on the local machine. The Solaris installation program creates these files for you. In the file name, replace interface with the device name of the primary network interface. For more information about the /etc/hostname6.interface file, see IPv6 Network Interface Configuration File.
This file should contain one entry, the fully qualified domain name of the administrative domain to which the local host's network belongs. You can supply this name to the Solaris installation program or edit the file at a later date.
In Figure 4–1, the networks are part of the domain deserts.worldwide, which was classified as a .com domain. Therefore, /etc/defaultdomain should contain the entry deserts.worldwide.com. For more information on network domains, refer to System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP).
In Figure 4–1, the network interface le1 connects machine timbuktu with network 192.9.201. This interface has the unique name timbuktu-201. Thus, the machines on network 192.9.200 that are configured in local files mode have the name timbuktu-201 as the entry in /etc/defaultrouter.
The hosts database contains the IPv4 addresses and host names of machines on your network. If you use the NIS, NIS+, or DNS name services (or LDAP as a name service), the hosts database is maintained in a database that is designated for host information. For example, on a network that runs NIS+, the hosts database is maintained in the host table.
If you use local files for the name service, the hosts database is maintained in the /etc/inet/hosts file. This file contains the host names and IPv4 addresses of the primary network interface, other network interfaces that are attached to the machine, and any other network addresses that the machine must check for.
The /etc/inet/hosts file uses the basic syntax that follows. Refer to the hosts(4) man page for complete syntax information.
IPv4-address hostname [nicknames] [#comment]
IPv4-address contains the IPv4 address for each interface that the local host must recognize.
hostname contains the host name that is assigned to the machine at setup, plus the host names that are assigned to additional network interfaces that the local host must recognize.
[nickname] is an optional field that contains a nickname for the host.
[# comment] is an optional field for a comment.
When you run the Solaris installation program on a machine, the program configures the initial /etc/inet/hosts file. This file contains the minimum entries that the local host requires. The entries include the loopback address, the host IPv4 address, and the host name.
For example, the Solaris installation program might create the following /etc/inet/hosts file for machine tenere shown in Figure 4–1:
127.0.0.1 localhost loghost #loopback address 188.8.131.52 tenere #host name
In Example 5–1, the IPv4 address 127.0.0.1 is the loopback address. The loopback address is the reserved network interface that is used by the local machine to allow interprocess communication. This enables the host to send packets to itself. The ifconfig command uses the loopback address for configuration and testing, as explained in ifconfig Command. Every machine on a TCP/IP network must use the IP address 127.0.0.1 for the local host.
Some machines have more than one network interface, because they are either routers or multihomed hosts. Each additional network interface that is attached to the machine requires its own IPv4 address and associated name. When you configure a router or multihomed host, you must add this information manually to the router's /etc/inet/hosts file. See Configuring Routers for more information on configuring routers and multihomed hosts.
127.0.0.1 localhost loghost 184.108.40.206 timbuktu #This is the local host name 220.127.116.11 timbuktu-201 #Interface to network 192.9.201
The NIS, NIS+, and DNS name services (or LDAP as a name service) maintain host names and addresses on one or more servers. These servers maintain hosts databases that contain information for every host and router (if applicable) on the servers' network. Refer to System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP) and System Administration Guide: Naming and Directory Services (FNS and NIS+) for more information about these services.
On a network that uses local files for name service, machines that run in local files mode consult their individual /etc/inet/hosts files for IPv4 addresses and host names of other machines on the network. Therefore, these machine's /etc/inet/hosts files must contain the following:
IPv4 address and host name of the local machine (primary network interface)
IPv4 address and host name of additional network interfaces that are attached to this machine, if applicable
IPv4 addresses and host names of all hosts on the local network
IPv4 addresses and host names of any routers that this machine must know about, if applicable
IPv4 address of any machine your machine wants to refer to by its host name
The figure below shows the /etc/inet/hosts file for machine tenere. This machine runs in local files mode. Notice that the file contains the IPv4 addresses and host names for every machine on the 192.9.200 network. The file also contains the IPv4 address and interface name timbuktu-201. This interface connects the 192.9.200 network to the 192.9.201 network.
The ipnodes database contains the IPv6 addresses and host names of machines on your network. If you use the NIS, NIS+, or DNS name services (or LDAP as a name service), the ipnodes database is maintained in a database that is designated for host information. For example, on a network that runs NIS+, the ipnodes database is maintained in the host table. For more information about the ipnodes database, see /etc/inet/ipnodes File.
You need to edit the netmasks database as part of network configuration only if you have set up subnetting on your network. The netmasks database consists of a list of networks and their associated subnet masks.
When you create subnets, each new network must be a separate physical network. You cannot apply subnetting to a single physical network.
Subnetting is a method for maximizing the limited 32-bit IPv4 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 that is allocated to new network addresses is known as the subnet number.
In addition to making more efficient use of the IPv4 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, the administration of 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 division can also reduce the amount of routing information that must be communicated among routers.
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 bits and which represent the host number. Recall that the complete IPv4 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 plan to install the operating system as part of network configuration, the Solaris installation program requests the netmask for your network.
As described in Administering Network Numbers, 32-bit IP addresses consist of a network part and a host part. The 32 bits are divided into 4 bytes. Each byte is assigned to either the network number or the host number, depending on the network class.
For example, in a class B IPv4 address, the 2 bytes on the left are assigned to the network number, and the 2 bytes on the right are assigned to the host number. In the class B IPv4 address 18.104.22.168, you can assign the 2 bytes on the right to hosts.
If you are to implement subnetting, you need to use some of the bits in the bytes that are 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 network.
The bits in the host address bytes that are applied to subnet addresses and those applied to host addresses are determined by a subnet mask. Subnet masks are used to select bits from either byte for use as subnet addresses. Although netmask bits must be contiguous, they need not align on byte boundaries.
Netmasks can be explained in terms of their binary representation. You can use a calculator for binary-to-decimal conversion. The following examples show both the decimal and binary forms of the netmask.
If a netmask 255.255.255.0 is applied to the IPv4 address 22.214.171.124, the result is the IPv4 address of 126.96.36.199.
188.8.131.52 & 255.255.255.0 = 184.108.40.206
In binary form, the operation is as follows:
10000001.10010000.00101001.01100101 (IPv4 address)
Now the system looks for a network number of 129.144.41 instead of a network number of 129.144. If your network has the number 129.144.41, that number is what the system checks for and finds. Because you can assign up to 254 values to the third byte of the IPv4 address space, subnetting lets you create address space for 254 networks, where previously space was available for only one.
If you are providing address space for only two additional networks, you can use the following subnet mask:
This netmask provides the following result:
If your network runs NIS, NIS+, or LDAP, 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.
For compatibility with BSD-based operating systems, the file /etc/netmasks is a symbolic link to /etc/inet/netmasks.
The following example shows the /etc/inet/netmasks file for a class B network.
## The netmasks file associates Internet Protocol (IPv4) address # masks with IPv4 network numbers. # # network-number netmask # # Both the network-number and the netmasks are specified in # “decimal dot” notation, e.g: # # 220.127.116.11 255.255.255.0 18.104.22.168 255.255.255.0
If the file does not exist, create it. Use the following syntax:
Refer to the netmasks(4) man page for complete details.
When creating netmask numbers, type the network number that is assigned by the InterNIC (not the subnet number) and netmask number in /etc/inet/netmasks. Each subnet mask should be on a separate line.