#This is the config file for the JBM Electronics #script ipfallback.pl # This file should be at /etc/ipfallback.conf # #lines with a # in the front are comments # #Script that uses this config file will attempt to: # #Fallback from PRIMARY Ethernet to SECONDARY Ethernet (on same subnet) # when the PRIMARY ethernet gateway cannot be reached (like if the PRIMARY # Ethernet goes bad). # #Fallback from PRIMARY ethernet to SECONDARY ethernet (on different subnets) # when the PRIMARY ethernet gateway cannot be reached. When the PRIMARY gateway # can be reached again, it will fallback to the original state. # #Fallback from PRIMARY ethernet to SECONDARY ppp dial when the PRIMARY ethernet # gateway cannot be reached. SECONDARY PPP will be brought down when the PRIMARY # gateway can be reached again. # #Fallback from PRIMARY ppp dial to SECONDARY ppp dial. # # # Notes: # # The script will attempt to ontrol the PRIMARY and SECONDAY ethernet interfaces # - bring interfaces up/down when on the same subnet # - Add remove default routes when on different subnets # # The script will attempt to Control PPP commands when falling back. PPP for # either PRIMARY or SECONDARY should NOT be started manually. # # The pppd command must write its pid files to /var/run/ in the format /var/run/pppN.pid # where pppN is the ppp interface name. This is how the script determines which PPP interface # belongs to which dial command. # # Currently this script will only work with Static IP addresses on the ethernet # interfaces. # *** No DHCP or PPPoE. # # Configuration variables are below: #PRIMARY_TYPE= ethernet | ppp #Cannot be type "ppp" if the SECONDARY_TYPE=ethernet #if the type is ethernet, then IP info PRIMARY_IP_GATEWAY=x.x.x.x #The IP information will be read from /etc/sysconfig/network-scripts/ifcfg-PRIMARY_INT #If the matching file does not exist, the script will fail. #this value must be defined PRIMARY_TYPE=ethernet #PRIMARY_INT= eth0 | eth1 | ... | ethN #If PRIMARY_TYPE=ethernet then an ethN interface must be specified here. #The IP information will be read from /etc/sysconfig/network-scripts/ifcfg-PRIMARY_INT #If the matching file does not exist, the script will fail. #If PRIMARY_TYPE=ppp then this field is ignored PRIMARY_INT=eth0 #PRIMARY_IP_GATEWAY=x.x.x.x ( an IP address) #If PRIMARY_TYPE=ethernet then a gateway to ping must be specified here. #The PRIMARY_IP_GATEWAY must be within the same subnet as the interface defined above. #The gateway IP must be pingable. #If PRIMARY_TYPE=ppp then this field is ignored PRIMARY_IP_GATEWAY=x.x.x.x #PRIMARY_COMMAND=/bin/pppd call someisp #where someisp is a ppp file #probably located in /etc/ppp/peers/ (or wherever pppd normally looks for it) #This is the pppd command to run to bring up a PPP interface. #This command should be tested and proven to work prior to using #it in this script, where it will be controlled from. #If both PRIMARY and SECONDARY are PPP, make sure this is not the same command file #If PRIMARY_TYPE=ethernet then this field is ignored PRIMARY_COMMAND=/bin/pppd call someisp #SECONDARY_TYPE= ethernet | ppp #Cannot be type "ethernet" if the PRIMARY_TYPE=ppp #if the type is ethernet, then IP info SECONDARY_IP_GATEWAY=x.x.x.x #The IP information will be read from /etc/sysconfig/network-scripts/ifcfg-SECONDARY_INT #If the matching file does not exist, the script will fail. #this value must be defined SECONDARY_TYPE=ethernet #SECONDARY_INT= eth0 | eth1 | ... | ethN #If SECONDARY_TYPE=ethernet then an ethN interface must be specified here. #The IP information will be read from /etc/sysconfig/network-scripts/ifcfg-SECONDARY_INT #If the matching file does not exist, the script will fail. #If SECONDARY_TYPE=ppp then this field is ignored SECONDARY_INT=eth1 #SECONDARY_IP_GATEWAY=x.x.x.x ( an IP address) #If SECONDARY_TYPE=ethernet then a gateway to ping must be specified here. #The SECONDARY_IP_GATEWAY must be within the same subnet as the interface defined above. #The gateway IP must be pingable. #If SECONDARY_TYPE=ppp then this field is ignored SECONDARY_IP_GATEWAY=x.x.x.x #SECONDARY_COMMAND=/bin/pppd call someisp2 #where someisp2 is a ppp file #probably located in /etc/ppp/peers/ (wherever pppd normally looks for it) #This is the pppd command to run to bring up a PPP interface. #This command should be tested and proven to work prior to using #it in this script, where it will be controlled from. #If both PRIMARY and SECONDARY are PPP, make sure this is not the same command file #If SECONDARY_TYPE=ethernet then this field is ignored SECONDARY_COMMAND=/bin/pppd call someisp2 #USE_RESET_JBM_WAVECOM= yes | no #This should only be set to "yes" on a JBM Electronics Embedded unit. #If the PRIMARY is ppp and is a JBM Wireless Wavecom modem, then set to "yes". #If the PRIMARY is ethernet, SECONDARY is ppp and is a JBM Wireless Wavecom modem, then set to "yes". #This will run a program to Reset the Wavecom modem after it fails MAX_PPP_TRY times when both #are set to "ppp", or every 3 failures whn PRIMARY is ethernet, and SECONDARY is ppp. #This is Ignored if a JBM Embedded Wavecom modem is not detected. USE_RESET_JBM_WAVECOM=yes #MAX_PPP_TRY= ranges 1-5 , valid only when both connections are PPP (not Ethernet) #This is the max number of tries to attempt to bring up a PPP connection #before switching to the backup PPP connection. MAX_PPP_TRY=3 #Number of seconds to wait between checking an interface #for problems #minimum of 10, max 600. Needs to be 30 or higher for PPP connections (set to 30 if lower) #so the connections have time to come up ( dial, authenticate, get IP info, bind, etc...) CHECK_INTERVAL=30 #PACKET_LOSS_LIMIT=NN % packet loss to say this is down, and switch to the backup #Valid Ranges are 10-100. Might want this at 70-100 for PPP connections #since they are slower. PACKET_LOSS_LIMIT=70 #SNMP_HOST=x.x.x.x where x.x.x.x is a host running snmpd #SNMP_COMMUNITY=public where public is the community name #This might not work. If the unit this script is running on has snmptrap #for generating traps, then this can be tried. The script will use the command like: #This can only be enabled if the PRIMARY is ethernet. The IP of the PRIMARY ethernet #will be sent in the trap #/path/to/snmptrap -v 1 -c SNMP_COMMUNITY SNMP_HOST 1 PRIMARY_IP 2 0 '' 1 s "eth0 down, fallback to eth1" #SNMP_HOST=x.x.x.x #SNMP_COMMUNITY=public #Debug level (set to 2 or higher for testing if wanted) # 0 for minimal ( goes to syslog via the 'logger' program if available) # 1 for more ( goes to syslog via the 'logger' program if available) # 2 or higher: same as 1, but also sends logging info to STDOUT # If the program "logger" is not found, then all info goes to STDOUT DEBUG_LEVEL=2 #end ipfallback.conf config file