From owner-freebsd-net@freebsd.org Tue Jan 24 20:25:43 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89D74CC0407 for ; Tue, 24 Jan 2017 20:25:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (unknown [IPv6:2602:304:b010:ef20::f2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gw.catspoiler.org", Issuer "gw.catspoiler.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5B281D for ; Tue, 24 Jan 2017 20:25:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.15.2/8.15.2) with ESMTP id v0OKPX0L008680; Tue, 24 Jan 2017 12:25:39 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201701242025.v0OKPX0L008680@gw.catspoiler.org> Date: Tue, 24 Jan 2017 12:25:33 -0800 (PST) From: Don Lewis Subject: Re: inheriting fib from an interface To: eugen@grosbein.net cc: freebsd-net@FreeBSD.org In-Reply-To: <20170124095539.GA18648@rdtc.ru> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 20:25:43 -0000 On 24 Jan, Eugene Grosbein wrote: > On Mon, Jan 23, 2017 at 05:31:22PM -0800, Don Lewis wrote: > >> Let's say that I have an application running on a server that is >> connected to the Internet via two different ISPs and is using IP >> addresses (ISP A:10.0.0.10 and ISP B:192.168.1.10) delegated by those >> two ISPs on it's two interfaces. Responses to requests sent to >> 10.0.0.10 should be sent via ISP A, and responses to requests sent to >> 192.168.1.10 should be ISB B. >> >> There are a couple of different ways that I can think of to do this: >> >> 1) Put the server behind another FreeBSD box that uses policy-based >> routing to forward the outbound packets to the desired ISP. My >> understanding is that this only works for packet forwarding and not >> for locally generated packets. > > Single command "ipfw add 2000 fwd $ispgw2 ip from $ip2 to any out xmit $isp1_iface" > works for locally generated packets too. > > It "fixes" outgoing routing path for packets > from IP belonging to "non-default" ISP2 when default route points to ISP1. Thanks, that looks very promising!