Home arrow Journal arrow FreeBSD Multiple Default Gateways
FreeBSD Multiple Default Gateways PDF
Sunday, 17 July 2011
You can have multiple routing tables in FreeBSD so then you can also have multiple default gateways.

To achieve that we use FreeBSD's setfib utility.

To add support for multiple routing tables (up to 16) recompile the kernel with the following option:

  options ROUTETABLES=5

To add a default route for slot 1 use:

  setfib 1 route add default

To delete the default route saved on slot 1 we use:

  setfib 1 route delte default

To see the routing table for 1 use:

  setfib 1 netstat -nr

If we want to add to default gateways we edit /etc/rc.local and add there:

  setfib 0 route delete default
  setfib 0 route add    default
  setfib 1 route delete default
  setfib 1 route add    default

  If you want to use squid to go to different geteway you can add squid_fib=FIB_NR in /etc/rc.conf where FIB_NR is the setfib table number.
IF this does not work in squid 3.1 (a bug?) then edit /usr/local/etc/squid/squid.conf and add there tcp_outgoing_address this IP being on network card and fib number you want to use for squid.

Last Updated ( Sunday, 17 July 2011 )
< Prev   Next >

Other BSD Systems





Best BSD firewall?