# IPFW + setfib + 2 providers



## fromRussia (Jul 25, 2015)

All the good days. There freevsd FREEBSDFreeBSD 10.1.
There are 2 internet. 1 LAN. You must selectively using IPFW setfib one user to send one Internet and one user to another internet. Please help me understand how to bind a user to a specific table setfib?
I'm from Russia, my English is very bad, write for the child =).


----------



## junovitch@ (Jul 26, 2015)

I can't help with IPFW but hopefully I can provide some helpful information on setfib(1).  The first thing is you cannot bind a user to a specific routing table.  setfib(1) works by binding a process with a specific routing table.  You can bind a tree of processes in the form of a jail to a specific routing table.  But there is not means to just say a specific user gets one a specific routing table.

Assuming you want a service to use a different routing table, a simple set-up for two routing tables would start with something like this:

Set 2 routing tables.  You'll need to reboot after setting this tunable.
`echo 'net.fibs=2' >> /boot/loader.conf`

Assign the default route for that FIB for the VPN in /etc/rc.conf

```
static_routes="fib1default"
route_fib1default="default x.x.x.1 -fib 1"
```

Finally, set the service you want to use that FIB to use it in /etc/rc.conf.  As an example.

```
nginx_fib="1"
```

More syntax guidance is in rc.conf(5).


----------

