Managing NFS and NIS, 2nd Edition - Mike Eisler [176]
Early in the boot sequence, /etc/init.d/network executes ifconfig to set the IP address of the interface. ypbind has not yet been started, so NIS is not running at this point. ifconfig matches the hostname in the local /etc/inet/ipnodes file, and assigns the IP address found there to the interface. The network mask is obtained by matching the longest possible mask in /etc/inet/netmasks. If it is not specified, then it is based on the class of the IPv4 address, as shown in Table 13-3 later in this chapter. The default broadcast address is the address with a host part of all ones. ifconfig also sets up the streams plumbing and the link-local IPv6 addresses.
IP routing is started by /etc/init.d/inetinit when the machine comes up to multiuser mode. The host obtains its site-local, global, and multicast addresses from the network IPv6 routers that advertise prefix information. Critical network daemons, such as ypbind and the portmapper, are started next by /etc/init.d/rpc.
ifconfig is invoked again, out of /etc/init.d/inetsvc, to reset the broadcast address and network mask of the IPv4 interfaces. Now that NIS is running, maps that override the default values may be referenced. If you must override the NIS network masks, it is recommended to use the /etc/inet/netmasks file with the appropriate mask instead of hand-tailoring the values directly onto the ifconfig command in the boot script.
For example, add the desired netmask entry to /etc/inet/netmasks:131.40.0.0 255.255.255.0
The boot script updates all IPv4 up and configured network devices by invoking:/usr/sbin/ifconfig -au4 netmask + broadcast +
The netmask argument tells ifconfig which parts of the IP address form the network number, and which form the host number. Any bit represented by a one in the netmask becomes part of the network number. The broadcast argument specifies the broadcast address to be used by this host. The plus signs in the example cause ifconfig to read the appropriate NIS map for the required information. For the netmask, ifconfig reads the netmasks map, and for the broadcast address, it performs a logical and of the netmask and host IP address read from the NIS ipnodes map.
inetd-based services and RPC services such as NFS, the automounter and the lock manager are started once the network interface has been fully configured. Applications that require a fully functional network interface, such as network database servers, should be started after the last ifconfig is issued in the boot sequence.
Do not specify the hostname in /etc/hostname*.[0-9] if you plan to use DHCP to obtain your IPv4 addresses. DHCP enables your host to dynamically obtain IPv4 addresses, as well as other client configuration information over the network. By default, IPv6 address configuration is performed automatically as well. Hosts obtain their addresses and configuration information from IPv6 routers which advertise the prefix information used by the hosts to generate site-local and global addresses. Note that the host still invokes ifconfig to plumb the device and establish its link-local IPv6 address (in /etc/init.d/network), the router discovery daemon in.ndpd is later invoked in /etc/init.d/inetinit to acquire the additional site-local and global addresses.
Multiple interfaces
You can place a system on more than one network by either installing multiple physical network interfaces, or by configuring multiple logical interfaces associated with a physical network interface. In the first case, each network uses separate physical media, in the second case the networks are on the same physical media. A host that acts as a gateway between two networks is a good example of a system connected to physically separate networks. A host configured to