From owner-freebsd-net@FreeBSD.ORG Mon Feb 18 21:41:58 2008 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 1E0A116A41B for ; Mon, 18 Feb 2008 21:41:58 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id CE0C013C44B for ; Mon, 18 Feb 2008 21:41:57 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender:X-Spam-Status:Subject; b=WeTN3cGTTSfyJfrUkjJ6thpZaanTm6vhKPW/O/waK++rLsB0Nb63wI8P/NEdat3QZOsKquN8/72QKIBx+r0Wfulzkg8PLx9+Qul8NjhsmH75yWJGLHbV0J8DQ9Bv6TOj4ALPu93+EbxwMJD50rT6k5g4EyLzme4sSujN4NQ1LQg=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1JRDkJ-000MrW-GD; Tue, 19 Feb 2008 00:41:55 +0300 Date: Tue, 19 Feb 2008 00:41:54 +0300 From: Eygene Ryabinkin To: Nick Barnes Message-ID: References: <38308.1203368454@thrush.ravenbrook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <38308.1203368454@thrush.ravenbrook.com> Sender: rea-fbsd@codelabs.ru X-Spam-Status: No, score=-1.8 required=4.0 tests=ALL_TRUSTED,AWL,BAYES_50 Cc: freebsd-net@freebsd.org Subject: Re: Multiple default routes on multihome host 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: Mon, 18 Feb 2008 21:41:58 -0000 Nick, good day. Mon, Feb 18, 2008 at 09:00:54PM +0000, Nick Barnes wrote: > I have a multi-home host: more than one IP address. The addresses are > in separate subnets but run over the same ethernet segment (this is a > temporary situation while I switch an office network over from one > network provider to another). > > I want packets from address A1 to be sent via gateway G1, but packets > from address A2 to be sent via gateway G2. > > How do I do this? Can I just have more than one default route? I'm > remote from the machine in question, so I don't want to tinker with > the default route until I'm sure of the answer. pf's "route-to"/"reply-to" statements can do the trick for you. Use "route-to" if the packet is originating from your host and use "reply-to" for packets destined for some service at your host. You should use stateful rules with these modifiers. But if you have no pf on your remote machine, maybe you will decide not to install and enable it remotely, unless you are very sure about what you're doing. -- Eygene