From owner-freebsd-net@FreeBSD.ORG Thu Jul 23 18:54:13 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68DA9106566C for ; Thu, 23 Jul 2009 18:54:13 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 3D1518FC13 for ; Thu, 23 Jul 2009 18:54:13 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 6381E3ACFB4; Thu, 23 Jul 2009 14:54:12 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 23 Jul 2009 14:54:12 -0400 X-Sasl-enc: qV72+YNbDoTbj7xSsX6dBCDvprM85JLfJEuhxobSfISf 1248375252 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id D0162B60E; Thu, 23 Jul 2009 14:54:11 -0400 (EDT) Message-ID: <4A68B1D2.5080201@incunabulum.net> Date: Thu, 23 Jul 2009 19:54:10 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: "Lucian@lastdot.org" References: <5a3c8f450907230757j21191a11n6cae4699ec8a76e1@mail.gmail.com> In-Reply-To: <5a3c8f450907230757j21191a11n6cae4699ec8a76e1@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: How to change default source address? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2009 18:54:13 -0000 Lucian@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