Thanks to
PhoenixHelp I is able to setup multiple default routes, or a default route per Network/interface to being precise, in debian/l Inux It is as simple as that:
/etc/network/interfaces
Code:
Iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0 gateway 10.0.0.254iface eth1 inet Static Address 20.0.0.1 netmask 255.255.255.0 Gateway 20.0.0.254
That would was example topology (but more then 2 interfaces was also possible).
Code:
NETWORK0 NETWORK1 \ / \ / \ / \ / \ / ROUTER0 ROUTER1 10.0.0.254 20.0.0.254 \ / +------\----------------/------+ | \ / | | Em0 em1 | | 10.0.0.1 20.0.0.1 | | | | FREEBSD BOX | | | +------------------------------+
Now, you can don't use the ' casual 'defaultrouter= "X"cause it 'll be is only for one network.
We 'll have the use
setfib (1)To create both (or more) Separete routing tables per network/interface.
ADD these lines to/boot/loader.confFile:
Code:
Ipfw_load= "YES" net.fibs=16
It'll unfortunately require kernel recompile, but it 's not as this hard:
Code:
# cd/usr/src/sys/$ (uname-m)/conf# cp generic/root/routes# ln-s/root/routes# echo "Options routetables=16" >> routes# cd/usr/src# make No_modules=1 kernel kernconf=routes kodir=/boot/routes# mv/boot/routes/kernel/boot/kernel/ kernel# reboot
We can of course set 2 instead of a, but you'll at least has to recompile Your kernel again and reboot which are no T very handy ...
Nest Set your networks/interfaces as usual in/etc/rc.confFile:
Code:
ifconfig_em0= "inet 10.0.0.1/24" ifconfig_em1= "inet 20.0.0.1/24" # check/etc/rc.local for default routes
All the rest of the configuration resides in/etc/rc.localFile:
Code:
# define default ROUTESSETFIB 0 route Delete defaultsetfib 0 route add default 10.0.0.254setfib 1 route Delete default Setfib 1 route Add default 20.0.0.254# assing route tables to interfacesipfw-f FLUSHIPFW add allow IP from any to Any via LO0IPFW add SETFIB 1 IPs from any to all via EM0IPFW add SETFIB 0 IP from any to all via EM1IPFW add Allow IP From any to any
these would is handy for restarting:
Code:
#/etc/rc.d/netif restart#/etc/rc.d/local Restart
Source: >
From for notes (Wiz)
Howto:multiple Default Routes