How to change default source address?

Bruce Simpson bms at incunabulum.net
Thu Jul 23 18:54:13 UTC 2009


Lucian at lastdot.org wrote:
> Hi guys,
>
> I need to change the default source address on a freebsd server.
> My situation is somehow similar to this
> (http://marc.info/?l=freebsd-questions&m=122535960804508&w=2).
> In linux i can easily do it like:
>
> ip ro replace default via 10.10.10.1 src a.b.c.d (where a.b.c.d is em0 alias).
>   

There is preliminary source address policy/selection support in the 
network stack, from KAME, however it is not currently fully implemented 
for IPv4.

Most users just bind their daemons to different interface addresses. As 
Julian points out, you could use a packet filter (e.g. PF, IPFW) to 
change the source address for your traffic, but I suspect you want a 
socket-layer solution.

If your applications can't be told to use different interface addresses, 
then this is the quickest way to achieve what you want. However, 
volunteers to finish the source address selection support, are more than 
welcome.

thanks,
BMS




More information about the freebsd-net mailing list