标签:des http ar io color os sp for on
Thanks to phoenix help I was able to setup multiple default routes, or a default route per network/interface to be precise, in Debian/Linux it is as simple as that:iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0 gateway 10.0.0.254 iface eth1 inet static address 20.0.0.1 netmask 255.255.255.0 gateway 20.0.0.254
NETWORK0 NETWORK1 \ / \ / \ / \ / \ / ROUTER0 ROUTER1 10.0.0.254 20.0.0.254 \ / +------\----------------/------+ | \ / | | em0 em1 | | 10.0.0.1 20.0.0.1 | | | | FREEBSD BOX | | | +------------------------------+
ipfw_load="YES" net.fibs=16
# 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
ifconfig_em0="inet 10.0.0.1/24" ifconfig_em1="inet 20.0.0.1/24" # check /etc/rc.local for default routes
# define default routes setfib 0 route delete default setfib 0 route add default 10.0.0.254 setfib 1 route delete default setfib 1 route add default 20.0.0.254 # assing route tables to interfaces ipfw -f flush ipfw add allow ip from any to any via lo0 ipfw add setfib 1 ip from any to any via em0 ipfw add setfib 0 ip from any to any via em1 ipfw add allow ip from any to any
# /etc/rc.d/netif restart # /etc/rc.d/local restart
HOWTO: multiple default routes
标签:des http ar io color os sp for on
原文地址:http://www.cnblogs.com/lioaric/p/c8551c245c0cdfc28f1234576753e2a9.html