[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

rc.net File Format for TCP/IP

Purpose

Defines host configuration for network interfaces, host name, default gateway, and static routes.

Description

The /etc/rc.net file is a shell script that contains configuration information. The stanzas allow you to enable the network interfaces and set the host name, the default gateway, and any static routes for the current host. This file can be used as a one-step configuration alternative to using individually the set of commands and files necessary to configure a host.

The rc.net shell script is run by the configuration manager program during the second phase of configuration. If TCP/IP is installed, a second script, rc.tcpip, is run from the init command after the second phase of configuration has completed and after the init command has started the SRC master.

Stanzas in the file should appear in the order in which they are presented here.

The rc.net shell script may also be run by the configuration manager program (cfgmgr) if cfgmgr is run after system configuration is completed. It is often run at other times to configure new devices that have been added to the system since boot time. If cfgmgr runs rc.net, both the configuration methods and rc.net itself check to see if networking devices are already in the Available state. If so, the values of device attributes are not changed to avoid overwriting any configuration changes that have been made since boot time.

If /etc/rc.net is run without cfgmgr, device attributes will be reset to the values in the ODM database regardless of the states of the devices. This allows a system's configuration to be restored to the values specified in the ODM database.

Using the Configuration Methods

These stanzas use the configuration methods for TCP/IP to manipulate the ODM database.

Configuring Network Interfaces

For each network adapter that has been previously configured, a set of stanzas is required. The following stanzas define, load, and configure the appropriate network interfaces for every configured network adapter. These configuration methods require that the interface and protocol information be entered in the ODM database, using either SMIT or high-level configuration commands such as the mkdev command. The network interface configuration information is held in the running system only and must be reset at each system restart.

/usr/lib/methods/defif >> 
$LOGFILE   2>&1
/usr/lib/methods/cfgif    $* >> $LOGFILE 
  2>&1

The defif method defines the network interfaces. The cfgif method configures the network interfaces in the configuration database.

The second part of the stanzas indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Along with the network interface configuration, additional commands must be executed for X.25 and SLIP interfaces: the x25ip command for X.25 interfaces and the slattach command for SLIP connections. The x25ip command loads the X.25 translation table into the kernel and the slattach command is used to assign a TTY line to an interface for SLIP. For each SLIP interface, the slattach command must be executed for the appropriate TTY.

At times, when diskless clients reboot using these configuration methods they hang on LED 581. This happens because diskless clients use server disk space to store the logging information. To get the client to reboot when this happens, execute the /usr/lib/methods/cgfig configuration method in the client rc.net file that resides on the server without message logging as follows:

/usr/lib/methods/cfgif   $*

Setting the Host Name, Default Gateway, and Any Static Routes

The following stanzas set the host name, default gateway, and static routes, using the definet and cfginet subroutines to alter the ODM database for the inet0 object.

/usr/lib/methods/definet >> 
$LOGFILE 2>&1/usr/lib/methods/cfginet >> $LOGFILE 
2>&1

The second part of the stanzas indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Using Traditional Configuration Commands

These stanzas use configuration commands for TCP/IP to set configuration values.

Configuring Network Interfaces

The following stanza defines, loads, and configures the specified network interface:

/usr/sbin/ifconfig Interface inet 
InternetAddress up>>$LOGFILE 2 &1

The Interface parameter should specify the type and number of the interface, for example, tr0. The InternetAddress parameter should specify the Internet address of the interface, for example, 192.1.8.0.

The last part of the stanza indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Setting the Host Name, Default Gateway, and Any Static Routes

These stanzas should follow any stanzas for the network interfaces. These stanzas use the hostname command to set the host name and the route command to define the default gateway and any static routes. The static route information is held in the running system only and must be reset at each system restart.

/usr/bin/hostname  Hostname >>
 $LOGFILE 2>&1/usr/sbin/route  add  0 
 Gateway >> $LOGFILE 2>&1
/usr/sbin/route  add  DestinationAddress  
Gateway >>$LOGFILE 2>&1

The add variable for the route command adds a static route to the host. This route can be to the default gateway (by specifying a hop count, or metric, of 0), or to another host through a gateway.

The last part of the stanzas indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Miscellaneous Functions

Use these stanzas to set the host ID and user name. By default, the host ID and user name are set to the host name. However, these stanzas can be altered to customize the host ID and user name.

/usr/sbin/hostid `hostname'
/usr/bin/uname -s `hostname | sed -e 's/\..*$//'`
 >> $LOGFILE 2>&1

To customize these stanzas, replace the hostname entry in single quotation marks with the desired host ID or user name.

The second part of the user name stanza indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Load Network File System (NFS)

If you have the Network File System (NFS) installed on the current host, the following stanza loads and configures the NFS kernel extension:

if [ -x /usr/sbin/gfsinstall -a
 -x /usr/lib/drivers/nfs.ext ] ; then
    /usr/sbin/gfsinstall -a /usr/lib/drivers/
nfs.ext >>$LOGFILE 2>&1fi

The last part of the NFS stanza indicates that output should be sent to a log file. The log file must include the full path name. If no log file is specified, the default log file is /dev/null.

Examples

  1. To set up a Token-Ring interface, using the ifconfig command, include the following stanza:

    /usr/sbin/ifconfig tr0 inet
     192.1.8.0 up >>$LOGFILE 2>&1

    This stanza defines Token-Ring interface tr0, with the Internet address 192.1.8.0.

  2. To set the host name, using the hostname command, include the following stanza:

    /usr/bin/hostname robo.austin.century.com
       >>$LOGFILE 2>&1

    This stanza sets host name robo.austin.century.com. The host name in this example includes domain and subdomain information, which is necessary if the host is using the domain naming system.

  3. To set up a default gateway, using the route command, include the following stanza:

    /usr/sbin/route add 0 
    192.100.13.7    >>$LOGFILE 2>&1

    The value 0 for the Metric parameter means that any packets sent to destinations not previously defined and not on a directly connected network go through the default gateway. The 192.100.13.7 address is the default gateway.

  4. To set up a static route, using the route command, include the following stanza:

    /usr/sbin/route add net 
    192.100.201.7 192.100.13.7>>$LOGFILE 2>&1

    The 192.100.201.7 address is the receiving computer (the Destination parameter). The 192.100.13.7 address is the routing computer (the Gateway parameter).

Files

/etc/rc.tcpip Initializes daemons at each system restart.

Related Information

The hostname command, ifconfig command, init command, mkdev command, route command, sendmail command, slattach command.

The cfgif method, cfginet method, defif method, definet method.

The rc.tcpip file.

The inetd daemon.

Installation and Configuration for TCP/IP in AIX 5L Version 5.2 System Management Guide: Communications and Networks.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]