Bounce & FreeBSD

Subject: to bounce (redirect) tcp connections to another machine/port.

Solution: cd /usr/ports/net/bounce/ && make install distclean

Usage: bounce [-a localaddr | -b localaddr] [-p localport] machine port

This is the rc.d(8) script based on rc.subr(8) for bounce (you can safe it under the name /usr/local/etc/rc.d/bounce with rights to execute: chmod +x /usr/local/etc/rc.d/bounce):

#------- the start of the script -------

#!/bin/sh # Author: Stepan A. Baranov ( # web-site: # PROVIDE: bounce # REQUIRE: NETWORKING # KEYWORD: nojail . /etc/rc.subr name="bounce" rcvar=`set_rcvar` start_cmd="bounce_start" stop_cmd="bounce_stop" init_variables() { _b="$1" if [ -z "$_b" ]; then warn "init_variables: you must specify a bond" return fi eval bounce_vars=\"\$bounce_${_b}_vars\" } bounce_start() { for _bond in ${bounce_list} do echo $_bond init_variables $_bond /usr/local/sbin/bounce ${bounce_vars} done } bounce_stop() { killall bounce } load_rc_config $name run_rc_command "$1"

#------- the end of the script -------

To enable the start of bounce you must add, for example, following lines to your /etc/rc.conf file like these:


bounce_list="b1 b2"

bounce_b1_vars="-a localaddr -p localport1 machine1 port1"

bounce_b2_vars="-a localaddr -p localport2 machine2 port2"

©2009 Rosmir - Stepan A. Baranov

$Id: bounce.html 417 2009-01-07 16:41:34Z rosmir $