How to change default source address?

Julian Elischer julian at elischer.org
Fri Jul 24 13:27:50 UTC 2009


Vladimir Grebenschikov wrote:
> Hi 
> 
>  
>> you could set up 2 routing tables and assign different apps to use 
>> different tables
> 
> Is it possible to select routing table by ipfw setfib X ?
> 
> someting like:
> 
> ipfw add setfib 1 ip from a.b.c.d to any out xmit em0
> setfib 1 route add default 10.10.10.1 

no that wouldn't work for 2 reasons.
1/ for local sockets, the routing decision is made already before it 
gets to the firewall
2/ for non-ocal packets (from another machine that you are routing)
the packet needs to b etested on the recv (in) side of things
but by then the sending machine has aready decided on a local address too.
The only way to do this would be to do: setfib -1 my_aplication
so that the sockets were created looking at fib 1
or:
setfib -1 /bin/sh
so that all children used fib 1


> 
> 
> PS:
> you may need to compile kernel with 
> options ROUTETABLES=2
> 
> PPS:
> why there is not sysctl way to specify number of routing tables ? 
> 



More information about the freebsd-net mailing list