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 10.0.0.2

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

  setfib 1 route delte default 10.0.0.2

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 10.0.0.1
  setfib 1 route delete default
  setfib 1 route add    default 192.168.1.1


Tips:
------
  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 192.168.1.127 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

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?