IB2IB Routers Setup Script
===========================
Rev 1.0

The bin directory holds the ib2ib_setup script that can be used to setup
configuration files required to run IB routers connected to multiple subnets. 

To perform this you will need to follow the procedure below:

1. Create a directory where you will collect all subnets data. 
2. Decide what will be the unique index of the subnet("Subnet number") in the range 0..31
3. Run the ib2ib_setup script over each ib-subnet you are connecting 
4. Obtain the ip2gid.db and hosts files which were created for each subnet.
   Join all ip2gid.db files into single file.
   Join all hosts files into single file.
5. Spread the joined ip2gid.db and hosts files over all the machines.

Example: 
--------
Assuming we want to connect 2 Subnets.
on Subnet1 we have IPs described as: 12.130.1.1/24
on Subnet2 we have IPs given explicitly in ips.txt

Define a directory $d for collecting the data which accessible 
from machines on both subnets.

- On machine connected to Subnet-1 run :
  cd $d/1
  ib2ib2_setup -d ib0 -s 1 -n 12.130.1.1/24

- On machine connected to Subnet-2 run :
  cd $d/2
  ib2ib2_setup -d ib0 -s 2 -f ipsw.txt 

cat $d/1/ip2gid.db $d/2/ip2gid.db >> $d/ip2gid.db
cat $d/1/hosts $d/2/hosts >> $d/hosts

Spread the files over all the cluster nodes. 
hosts normally goes into the /etc dir
ip2gid.db goes into /etc/rdma dir

For more info please refer to man page attached below:


==============================================================================

man(8)                       ib2ib_setup man page                       man(8)



NAME
       ib2ib_setup  - Generate files required  for preparing the network to work with IB Router.


SYNOPSIS
       ib2ib_setup [-d DEVICE] [-s SUBNET_NUMBER] [-n NETWORK_SUBNET] or [-f IPS FILES] ips_file...


DESCRIPTION
       This  program  invokes ibnetdiscover to scan the network to extract the data about host port names, 
       LIDs and GUIDs, and uses arping to scan the subnet for IPs. It then writes out
       the information into 3 separate files: ip2gid.db, guid2lid and hosts.

       ip2gid.db:
              This file holds the IP to GID mapping used by ibacm service running on each machine in the cluster.

       guid2lid:
              This  file holds the mapping of GUID to LID. It should be copied into the SM cache directory.
              At the moment it is only supported by host  based  OpenSM  or  UFM  appliance
              (switch based OpenSM does not support it).

       hosts: This file holds mapping of host name to IP and should be placed in /etc/hosts and pointed by nsswitch.conf (lathernatively use a DNS).


              NOTE: The hosts, and ip2gid.db files should be generated for each subnet and eventually joined 
					into single file to be copied into each of the cluster machines.


ARGUMENTS
       -d     "device name". For example: -d ib0. The interface through which the subnet is scanned for IP to GUID mapping using arping.

       -n     "Networks/mask  to  scan".  For  example: -n 12.1.1.1/24,24.1.1.1/24 (note:different subnet separated by comma).  
			   The flag -n is provided a set of IPs to be scanned on the
               subnet (i.e. A.B.C.D/24) or use the -f with text file holding an IP on each line.

       -s     "Subnet number" - unique number for local subnet. (on each subnet you should give different number.)


OPTIONS
       -h     "help" Print a brief help message and exits.

       -f     "filename" Specifies a file that holds IPs list. If provided avoids the scan of IPs and overrides the -n option.


EXAMPLES
       ib2ib2_setup with -a (subnet to scan):
              ib2ib_setup -d ib0 -a 61.130.1.1/24,61.130.2.1/24 -s 3

       ib2ib_Setup with -f (read IPs from file):
              ib2ib_setup -d ib0 -f my_ips_list.txt -s 3
 

BUGS
       No known bugs.

License
       This code is licensed to Mellanox Technologies LTD

AUTHOR
        Copyright (C) Raz Baussi, Mellanox LTD, Aug, 2016 All rights reserved



1.0                                Aug 2016                             man(8)
                                                                                 
