 |
Index for Section 7 |
|
 |
Alphabetical listing for N |
|
 |
Bottom of page |
|
nr(7)
NAME
nr - Redundant Array of Independent Network Adapters (NetRAIN)
DESCRIPTION
The NetRAIN virtual interface configures multiple interfaces on the same
LAN segment into a single interface. One of the real interfaces is always
active while the others remain idle. If the active interface fails, an
idle interface comes online. The failover time is adjustable depending on
your network configuration and operation.
You can configure the NetRAIN interface with the ifconfig command or with
the ioctl system call. See ifconfig for more information. You can adjust
some parameters with the sysconfig command. The SIOCIFADD ioctl parameter
creates the NetRAIN virtual interface and adds the real interfaces to this
NetRAIN set. After creating the NetRAIN virtual interface, one or more
real interfaces are attached to it. NetRAIN uses the Network Interface
Failure Finder daemon (niffd) to monitor the interfaces.
Individual interfaces cannot be added or removed from the set once they
have been created. However, the NetRAIN set can be disassembled using the
ifconfig command by specifying all the interface names in the set on the
command line. You must first bring the NetRAIN virtual interface itself
down by using the ifconfig command.
Parameters
The following list of ioctl parameters is used to configure the nr
interface:
SIOCIFADD
Creates the NetRAIN virtual interface if it has not already been
created. This parameter requires an if_nrset structure for the arg
parameter (found in the <net/if.h> file). The if_nrset structure
contains the name of the nr interface (nr0, nr1, ...) and a list of
interfaces to attach to the NetRAIN set. Upon successful completion of
this command, the NetRAIN set is configured and the monitoring thread
is activated. The list of NetRAIN interfaces is kept in a static
table. The default size is specified by the nr_maxdev kernel
attribute. The interfaces themselves are numbered from 0 to
nr_maxdev-1 (for example, nr0, nr1, ...). To change the size of this
table, change the nr_maxdev attribute for the netrain kernel subsystem
by using the sysconfig command. You must reboot the system for the new
value to take effect.
SIOCIFREMOVE
Disassembles the NetRAIN set, clears the UP flag on all members, resets
the hardware address to the default value, and clears the hardware
address for the nr interface. The nr interface may be reused in a
future SIOCIFADD command. This command requires an ifreq structure
with the ifr_name being the nr interface name (the ifreq structure is
found in the <net/if.h> file).
SIOCIFSWITCH
Forces a manual switch to another interface in the NetRAIN set. This
command requires an ifreq structure passed in the arg field
(<net/if.h>). The ifr_name field can be the nr interface name or the
name of any member in the set. If the name is the nr interface or the
active member, the next member in the set is brought online. If any
other member is specified in the ifr_name field, that interface is
brought online.
SIOCGNRSET
Retrieves the members of a NetRAIN set. This command requires an
if_nrset structure to be passed in the arg field (<net/if.h>). The
nr_name field may be the nr interface name or the name of any member of
the set. Upon return, the nr_name field contains the nr interface name
and the nr_buf field is a list of member names. This buffer must be
large enough to hold all the members or an ENOBUFS error is returned.
SIOCAUTOFAIL
Forces the active interface to switch to the next available interface
at regular intervals. It requires an ifreq structure in the arg field.
The ifr_name field must contain the nr interface name and the ifr_value
field contains an integer number of seconds between each switch
operation. A value of zero disables this feature.
The following ioctl parameter is used to control the interface monitoring
frequency. This parameter requires an mif_t structure (found in the
<net/if.h> file). The name field contains the NetRAIN interface name and
the t1 and t2 fields contain timer values.
SIOCIFNRTIMERS
Sets two NetRAIN interface timing parameters in the mif_t structure.
The t1 parameter specifies the time period, in seconds, that the
traffic monitor thread delays between reads of the interface counters
when the network is running normally. If there is no change in the
received byte count for t1 seconds, the traffic monitor thread issues a
yellow alert. The recommended t1 value is 4.
The t2 parameter specifies the traffic-free time period, in seconds,
that must pass before the traffic monitor thread declares the interface
dead. The recommended t1 value is 10 for Ethernet interfaces and 16
for Asynchronous Transfer Mode (ATM) LAN Emulation (LANE) interfaces.
The NetRAIN virtual interface supports all other ioctl parameters. The
NetRAIN driver propagates these commands to the real device driver where
appropriate. See the reference page for each individual driver for more
details.
RESTRICTIONS
See the Network Administration for information on NetRAIN restrictions.
EXAMPLE
The following example creates a NetRAIN set from the specified interfaces.
The first argument is the NetRAIN virtual interface name, nrx. The second
argument is a comma-separated list of real interfaces that are added to the
NetRAIN set.
#include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#define IFNAMSZ 16
int main(int argc, char *argv[])
{
struct if_nrset ifnrset;
char *addr;
nrset_t *buf;
int sock,i;
if (argc <= 2) {
printf("Usage: add <nrdev> <dev1>[,dev2...]0);
return(0);
}
/* Load the NetRAIN interface name */
if (--argc > 0) {
argv++;
strcpy(ifnrset.nr_name,*argv);
}
/* Count the members to be included in the NetRAIN set */
if (--argc > 0) {
++argv;
addr = *argv;
ifnrset.nr_cnt = 1;
for (i = 0; addr[i] != ' '; i++) {
if (addr[i] == ',') {
addr[i] = ' ';
ifnrset.nr_cnt++;
}
}
/* Allocate a buffer large enough to hold the interface names */
buf = (nrset_t *)malloc(ifnrset.nr_cnt * IFNAMSZ);
if (buf == NULL) {
perror("malloc: ");
return(0);
}
/* Load the interface array */
for (i=0; i<ifnrset.nr_cnt; i++) {
strcpy(buf[i].name,addr);
addr += strlen(addr)+1;
}
ifnrset.nr_len = ifnrset.nr_cnt * IFNAMSIZ;
ifnrset.nr_buf = (nrset_t *)buf;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
free(buf);
perror("socket: ");
return(0);
}
if (ioctl(sock, SIOCIFADD, (char *)&ifnrset) != 0) {
close(sock);
free(buf);
perror("SIOCIFADD: ");
return(0);
}
free(buf);
close(sock);
}
return(0);
}
ERRORS
ENXIO
Possible reasons include:
·
The NetRAIN interface name was invalid or the unit number was out of
range (0 to nr_maxdev-1).
·
The interface list contained an invalid interface type. All interfaces
must be either FDDI or Ethernet.
·
An interface that was previously specified already belongs to a NetRAIN
set.
EBUSY
A specified interface is already configured.
ENOBUFS
NetRAIN could not allocate system memory for the request.
RELATED INFORMATION
Functions: ioctl(2).
Interfaces: faa(7), fta(7), fza(7), le(7), ln(7), tu(7).
Commands: ifconfig(8), niffd(8), sysconfig(8).
Tuning: sys_attrs_netrain(5).
Network Administration
System Configuration and Tuning
 |
Index for Section 7 |
|
 |
Alphabetical listing for N |
|
 |
Top of page |
|