From owner-freebsd-net@FreeBSD.ORG Thu Feb 16 13:16:13 2012 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 4E12B1065670 for ; Thu, 16 Feb 2012 13:16:13 +0000 (UTC) (envelope-from ml@my.gd) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id CEC6D8FC13 for ; Thu, 16 Feb 2012 13:16:12 +0000 (UTC) Received: by bkcjg1 with SMTP id jg1so2523549bkc.13 for ; Thu, 16 Feb 2012 05:16:11 -0800 (PST) Received: by 10.205.129.141 with SMTP id hi13mr1150080bkc.7.1329398171449; Thu, 16 Feb 2012 05:16:11 -0800 (PST) Received: from dfleuriot.local (ip-100.net-82-216-199.nantes.rev.numericable.fr. [82.216.199.100]) by mx.google.com with ESMTPS id x22sm12849080bkw.11.2012.02.16.05.16.09 (version=SSLv3 cipher=OTHER); Thu, 16 Feb 2012 05:16:10 -0800 (PST) Message-ID: <4F3D0197.60100@my.gd> Date: Thu, 16 Feb 2012 14:16:07 +0100 From: Damien Fleuriot User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: freebsd-net@freebsd.org References: <1329376106.7683.YahooMailNeo@web162203.mail.bf1.yahoo.com> In-Reply-To: <1329376106.7683.YahooMailNeo@web162203.mail.bf1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlSiPU0mU2Yd2rIPU4SGar+I88QdThz7OwqBXcpldbbMlQAuNq9K8QDBah9XKhtpa7VM/vn 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: Thu, 16 Feb 2012 13:16:13 -0000 On 2/16/12 8:08 AM, M. V. wrote: > hi everybody, > > i have a problem with setting multiple IPs in the same network in FreeBSD: > > - 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 > > - 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 > ... > > - 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 > > #netstat -r > .... > > 192.168.10.2 lo0 > ..... > > - 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)? > > Thanks. > You shouldn't assign your secondary IP with a /24 mask, use /32. You'll run into problems otherwise. As a rule of thumb, your aliases = /32