nr - Redundant Array of Independent Network Adapters
(NetRAIN)
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(8)
for more information. You can also adjust some NetRAIN
default 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 (NIFF) traffic monitoring facility
to monitor the interfaces. See nifftmt(7) for more
information.
You can add or remove individual interfaces from the set,
or disassemble the entire set by using the ifconfig command.
Parameters [Toc] [Back]
The following list of ioctl parameters is used to configure
the nr interface: 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. If the
command fails, the name of the interface that could not be
added is copied back into the user space buffer (for error
message generation).
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. Removes one or all members
of the NetRAIN set. This command requires an ifreq
structure with the ifr_name field set to the
NetRAIN interface name (nrx) and the ifr_index
field set to the interface index of the interface
to be removed from the set (the ifreq structure is
found in the <net/if.h> file).
You can find the interface index of an interface by
using the SIOCGIFINDEX ioctl. If the specified
interface is the current active interface in the
NetRAIN set, the active interface is switched to
another NetRAIN set member. If the NetRAIN set has
only one member, removal of this member is equivalent
to disassembling the NetRAIN set.
If the ifr_index field is set to 0, the NetRAIN set
is disassembled, the UP flag is cleared on all members,
the hardware address is reset to the default
value, and the hardware address is cleared for the
nr interface. You can reuse the nr interface in a
future SIOCIFADD command. 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.
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. 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. 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 t2 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.
NetRAIN has the following restrictions: You must construct
a NetRAIN set out of interfaces that are currently idle.
This means the interfaces cannot be marked as "up" in the
Set up Network Interface Card(s) dialog box of the SysMan
Menu and they cannot have IP addresses assigned to them.
You must use two or more of the same type of network
interface (FDDI, ATM LAN Emulation, or Ethernet) dedicated
to a single LAN segment. If you use Ethernet adaptors,
theymust all be of the same speed. You cannot run LAT
over a NetRAIN virtual interface (nr) or any of the interfaces
that compose a NetRAIN set. Run separate cables
from each network interface to the appropriate hub or concentrator
to provide physically redundant paths back to
the network. This reduces the chance of network failure
due to cables being accidentally unplugged. If necessary,
you can adjust the timeout values to ensure that NetRAIN
will successfully detect and respond to network failure.
You can tune these parameters with the sysconfig command,
ifconfig command, and the ioctl system call. See nr(7),
ifconfig(8), sysconfig(8), dxkerneltuner(8), and
sys_attrs_netrain(5) for more information.
By default, these parameters are tuned for operation
over Ethernet, but it is possible that the
default values and other suggested timeout values
will not work in your environment. For example, if
you are connected to a switch, failover time will
depend on the switch and its configuration. You
must use UNI Version 3.1 when running NetRAIN over
LANE to obtain acceptable failover times with some
ATM switches, including the Gigaswitch. If you use
UNI Version 3.0, the failover time might be long
because the T309 timer is set to 90 seconds by
default on some switches. If the T309 timer is
adjustable on your switch, you can set the T309
timer to 10 seconds as in UNI Version 3.1 to try to
achieve acceptable failover times.
A specified interface is already configured. Possible
reasons include: The interface list contained an invalid
interface type. All interfaces must be either FDDI or
Ethernet. The interface list contained interfaces of different
types. Interfaces must be either all FDDI or all
Ethernet. NetRAIN could not allocate system memory for
the request. Possible reasons include: The NetRAIN interface
name was invalid or the unit number was out of range
(0 to nr_maxdev-1). An interface that was previously
specified already belongs to a NetRAIN set.
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 commaseparated
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); }
Functions: ioctl(2)
Interfaces: alt(7), bcm(7), ee(7), faa(7), fta(7), fza(7),
le(7), ln(7), tu(7)
Commands: nifftmt(7), ifconfig(8), sysconfig(8)
Tuning: sys_attrs_netrain(5)
Network Administration: Connections
System Configuration and Tuning
nr(7)
[ Back ] |