Contact Us
24/7
Python BlogDjango BlogSearch for Kubernetes Big DataSearch for Kubernetes AWS BlogCloud Services

Blog

<< ALL BLOG POSTS

Adventures with FreeBSD and Advanced Networking

|
March 10, 2011

It appears that, if you use some of the more advanced networking technologies built into FreeBSD, it is possible to put yourself into a bit of a pickle. More specifically, if you're running CARP on LAGG (LACP) network interfaces and use iSCSI, it is possible for the server to put itself into a loop at boot that is not recoverable.  As the system comes up, the CARP interface comes up, but is not yet in state MASTER. The boot loader continues. This causes iSCSI to attempt to mount without a network connection, which then moves to MySQL starting without its data store. All in all a sub-optimal situation.

Fortunately a solution presented itself! We wrote a quick and dirty rc.subr script called Liveping. This script starts before the iSCSI Intiator and starts pinging a known service on our network.  Liveping will not exit until it gets a response from a remote machine verifying that networking is in a state ready to use.

### SCRIPT
#!/bin/sh
# PROVIDE:liveping
# REQUIRE: netif routing
# BEFORE: NETWORKING

# Liveping: Stall the boot process until we can either ping the
# host set in rc.conf or the nameserver to be sure we are ready to
# start network services and mount NFS.  Timeout after 60 seconds
# unless specified otherwise.
#
# Add the following line to /etc/rc.conf to enable liveping:
#
#  liveping_enable="YES"
#  # optional
#  liveping_target="192.168.1.1"
#  liveping_timeout="60"
#

detected_nameserver=`sed -n "s/nameserver //p" /etc/resolv.conf`

. "/etc/rc.subr"

# Set some defaults
liveping_enable=${liveping_enable:-"NO"}
liveping_target=${liveping_target:-"$detected_nameserver"}
liveping_timeout=${liveping_timeout:-"60"}

name=liveping
rcvar=`set_rcvar`
load_rc_config $name
command=/sbin/ping
command_args="-o -t ${liveping_timeout} ${liveping_target} > /dev/null 2>&1"

run_rc_command "$1"
### END
This allowed us to bring up the server while guaranteeing MySQL starts with proper iSCSI data store. More information about RC.SUBR available on FreeBSD site
 
Ever experience issues like this?  Do you have alternative options to solve this issue?
How can we assist you in reaching your objectives?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.