From owner-freebsd-net@FreeBSD.ORG Fri Mar 16 20:50:36 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF2DB1065670 for ; Fri, 16 Mar 2012 20:50:36 +0000 (UTC) (envelope-from aboyer@averesystems.com) Received: from zimbra.averesystems.com (75-149-8-245-Pennsylvania.hfc.comcastbusiness.net [75.149.8.245]) by mx1.freebsd.org (Postfix) with ESMTP id 6EF838FC1A for ; Fri, 16 Mar 2012 20:50:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.averesystems.com (Postfix) with ESMTP id 0A809446003; Fri, 16 Mar 2012 16:53:42 -0400 (EDT) X-Virus-Scanned: amavisd-new at averesystems.com Received: from zimbra.averesystems.com ([127.0.0.1]) by localhost (zimbra.averesystems.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lp4q9zRMfsRb; Fri, 16 Mar 2012 16:53:36 -0400 (EDT) Received: from riven.arriad.com (fw.arriad.com [10.0.0.16]) by zimbra.averesystems.com (Postfix) with ESMTPSA id 1A1F98BCEDA; Fri, 16 Mar 2012 16:53:36 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Andrew Boyer In-Reply-To: <4F3F7FDF.8060202@my.gd> Date: Fri, 16 Mar 2012 16:50:29 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <3672F21A-B65A-4F55-8D02-D2C5FFFACE3D@averesystems.com> References: <1329376106.7683.YahooMailNeo@web162203.mail.bf1.yahoo.com> <4F3D0197.60100@my.gd> <37B92AD6-F745-4D26-A924-271476558D93@averesystems.com> <4F3F7FDF.8060202@my.gd> To: Damien Fleuriot X-Mailer: Apple Mail (2.1084) Cc: freebsd-net@freebsd.org, "M. V." Subject: Re: Assigning multiple IPs in the same network to an 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: Fri, 16 Mar 2012 20:50:36 -0000 On Feb 18, 2012, at 5:39 AM, Damien Fleuriot wrote: > On 2/16/12 3:39 PM, Andrew Boyer wrote: >>=20 >> On Feb 16, 2012, at 8:16 AM, Damien Fleuriot wrote: >>=20 >>> On 2/16/12 8:08 AM, M. V. wrote: >>>> hi everybody, >>>>=20 >>>> i have a problem with setting multiple IPs in the same network in = FreeBSD: >>>>=20 >>>> - suppose I assign two new IP addresses in the same network to eth0 = with ifconfig: >>>> #ifconfig eth0 add 192.168.10.1/24 >>>> #ifconfig eth0 add 192.168.10.2/24 >>>>=20 >>>> - everything works fine and the output of "netstat -r" is like what = it should be: >>>> #netstat -r >>>> .... >>>> 192.168.10.0 eth0 >>>> 192.168.10.1 lo0 >>>> 192.168.10.2 lo0 >>>> ... >>>>=20 >>>> - but now if I delete first IP address, connection to 192.168.10.0 = network will be gone. and in output of "netstat -r" the route to = 192.168.10.0 (via eth0) is gone: >>>> #ifconfig eth0 delete 192.168.10.1 >>>>=20 >>>> #netstat -r >>>> .... >>>>=20 >>>> 192.168.10.2 lo0 >>>> ..... >>>>=20 >>>> - am i missing something here? shouldn't the route to the network = remain in routing table (because we still have 192.168.10.2 assigned to = interface)? >>>>=20 >>>> Thanks. >>>>=20 >>>=20 >>> You shouldn't assign your secondary IP with a /24 mask, use /32. >>>=20 >>> You'll run into problems otherwise. >>>=20 >>> As a rule of thumb, your aliases =3D /32 >>>=20 >>=20 >> M.V. - >> What you are doing should work fine. There were a handful of routing = table bugs fixed in the last few months that corrected this behavior. = The last two were just merged to stable/8 yesterday. What release are = you running? =20 >>=20 >> -Andrew >>=20 >=20 > This is of interest to me. >=20 > Do these fixes allow one to use say /24 aliases instead of /32 without > running into problems ? >=20 Sorry for the long delay. I'm not aware of any restriction on how many = IPs or subnets you can install, as long as the subnets don't conflict. I haven't tried IPv6, though... -Andrew -------------------------------------------------- Andrew Boyer aboyer@averesystems.com