From owner-freebsd-net@FreeBSD.ORG Sun Feb 26 10:28:02 2006 Return-Path: X-Original-To: net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F044016A420 for ; Sun, 26 Feb 2006 10:28:02 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30AC843D45 for ; Sun, 26 Feb 2006 10:28:01 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k1QARvG9086841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Feb 2006 13:27:57 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id k1QARv3u086840; Sun, 26 Feb 2006 13:27:57 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sun, 26 Feb 2006 13:27:56 +0300 From: Gleb Smirnoff To: Josef Karthauser Message-ID: <20060226102756.GE55275@FreeBSD.org> References: <20060219151435.GE15477@genius.tao.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20060219151435.GE15477@genius.tao.org.uk> User-Agent: Mutt/1.5.6i Cc: net@FreeBSD.org Subject: Re: Default gateway - wrong interface. ! 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: Sun, 26 Feb 2006 10:28:03 -0000 On Sun, Feb 19, 2006 at 03:14:35PM +0000, Josef Karthauser wrote: J> I'm guessing that this is a bug (or feature!). This is not a bug, nor a feature. This is a feature, that hasn't been implemented to the end. Historically, the routes in kernel were static. And they are static now. Historically, BSD won't permit you to install same IP addresses, or even addresses in the same subnet, on different interfaces. Now, FreeBSD permits addresses in the same subnet. But route entries are still static, and aren't reconfigring when an interface changes its flags. J> I've got a machine with a wlan interface (iwi0), with an ipv4 network J> address and a default gateway. I also have an ethernet card in the same J> machine (em0) with the same IP address. The idea is that I can bring J> the wireless down, and the wired interface up to get fast transfers when J> approriate, and be wireless the rest of the time. J> J> That works fine, apart from the default gateway: J> J> # ifconfig iwi0 down J> # ifconfig em0 up J> # arp -ad J> # netstat -rn J> Internet: J> Destination Gateway Flags Refs Use Netif J> Expire J> default 87.74.4.33 UGS 0 123 iwi0 J> 87.74.4.32/27 link#3 UC 0 0 em0 J> 87.74.4.33 00:90:d0:02:3f:16 UHLW 2 1 em0 J> 87.74.4.34 00:d0:b7:88:c8:20 UHLW 1 1191414 em0 J> 127.0.0.1 127.0.0.1 UH 0 2 lo0 J> J> Notice, the local subnet is off the em0, but the default route is still J> wired off the iwi0. J> J> # route delete default J> # route add default 87.74.4.33 J> # netstat -rn J> Internet: J> Destination Gateway Flags Refs Use Netif J> Expire J> default 87.74.4.33 UGS 0 123 iwi0 J> 87.74.4.32/27 link#3 UC 0 0 em0 J> 87.74.4.33 00:90:d0:02:3f:16 UHLW 2 1 em0 J> 87.74.4.34 00:d0:b7:88:c8:20 UHLW 1 1191414 em0 J> 127.0.0.1 127.0.0.1 UH 0 2 lo0 J> J> The default route is _still_ off iwi0; but should be off em0. J> J> There's obviously something dumb doing on here. Why does the default J> route have to be nailed to an interface? It's clear that 87.74.4.33 is J> available from em0 as far as the routing table is concerned. J> J> Joe -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE