RADIX_MPATH usage information

Brandon Gooch jamesbrandongooch at gmail.com
Sun Oct 17 18:27:39 UTC 2010


On Fri, Aug 27, 2010 at 10:47 AM, Li, Qing <qing.li at bluecoat.com> wrote:
> There are a couple of items I need to take care of
> in this area, including the documentation, so I will get
> it done this weekend.
>
> --Qing
>
>
>> -----Original Message-----
>> From: owner-freebsd-net at freebsd.org [mailto:owner-freebsd-
>> net at freebsd.org] On Behalf Of Zeus V Panchenko
>> Sent: Thursday, August 26, 2010 11:25 PM
>> To: freebsd-net at freebsd.org
>> Subject: Re: RADIX_MPATH usage information
>>
>> +1
>>
>> --
>> Zeus V. Panchenko
>> IT Dpt., IBS ltd                                      GMT+2 (EET)

Qing, I've been looking for the documentation regarding this new
feature, as I have the requirement of needing an ipfw(8) (or other
firewall) setup. Unfortunately, I could find nothing, aside from the
source code (which I'm attempting to read ATM).

I have a computer with one em(4) interface with multiple VLANs running
on top. I let the em0 interface configuration happen via DHCP, and I
set the VLAN interfaces manually. I run 3 instances of sshd(8) on each
separate VLAN interface, but I run into the issue of having the
connection to each VLAN's sshd(8) instance attempt the return
connection to the client via the default gateway of em0. So I've
simply created an rc(8) script to handle manually configuring the
routing table for each fib, something like a "my_networks.sh":

#!/bin/sh
#
# PROVIDE:      my_networks
# REQUIRE:      dhclient netif routing cleanvar
#

. /etc/rc.subr

name="my_networks"
rcvar=${name}_enable
start_cmd="my_networks_start"
stop_cmd="my_networks_stop"

my_networks_start()
{

setfib 1 route add default 192.168.1.1 -ifp vlan10
setfib 3 route delete 192.168.2.0/24
setfib 3 route delete 192.168.3.0/24
setfib 2 route add default 192.168.2.1 -ifp vlan20
setfib 3 route delete 192.168.1.0/24
setfib 3 route delete 192.168.3.0/24
setfib 3 route add default 192.168.3.1 -ifp vlan30
setfib 3 route delete 192.168.1.0/24
setfib 3 route delete 192.168.2.0/24

setfib 1 /usr/sbin/sshd -f /usr/local/etc/sshd_config_fib_1
setfib 2 /usr/sbin/sshd -f /usr/local/etc/sshd_config_fib_2
setfib 3 /usr/sbin/sshd -f /usr/local/etc/sshd_config_fib_3

}

my_networks_stop()
{
setfib 1 route flush
setfib 2 route flush
setfib 3 route flush
killall sshd
}

load_rc_config $name

: ${my_networks_enable="NO"}

run_rc_command "$1"

...and it seems to work. I'm not sure how technically sound this
method is, but I haven't found or read anything to confirm, condone or
condemn the methodology.

If I were to use the RADIX_MPATH option in the kernel, would this
eliminate the need to delete routes from the "foreign" VLAN
interfaces' routing table (to prevent return connection packets
heading out the default gateway of em0, configured via DHCP)?

Thanks!

-Brandon


More information about the freebsd-net mailing list