From owner-freebsd-net@freebsd.org Fri Jun 16 16:12:41 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 64642C77686 for ; Fri, 16 Jun 2017 16:12:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x22c.google.com (mail-yw0-x22c.google.com [IPv6:2607:f8b0:4002:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 19D4F1562 for ; Fri, 16 Jun 2017 16:12:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x22c.google.com with SMTP id l75so21728563ywc.3 for ; Fri, 16 Jun 2017 09:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=c3EvWlotqz8Wqbdjg2d5qveZXkK4L8RYgym5yMyhGFE=; b=KP0ErIGcv/MA72/OxL700gOmJelOo41joAjm0XlQddn+O7VwV27wBqtQZDvmx+Ld50 m2YSHpXG1uwmqOltMeWhj9t7KxYmg/g2xBdilFPonsB7zriy+Ax2g0cUmVxYHf0tDnbC OZ5BRbkGojKqywn3Ny60042+myDjgvFgLaOuXBkvSdWcIMYIVNYyIsnu/gVojV477z/6 Z23P9H15+m0oyA17prtFiHa33rKqO5+SNqQtGI932a9jrx4Y1TKL6W4BaWChrNeOXQa0 90mmAhUW3lmMAicjcMb+owWc5z2UQvJ4/KqWfEQMgOUdzOPHm8YflesiNpFrPUfQHt2n GMhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=c3EvWlotqz8Wqbdjg2d5qveZXkK4L8RYgym5yMyhGFE=; b=C/tqNN+Vetv0C5jpf+NUgM5e8oR1L76SlMTgxaTjIGs1nd/KnO+Nq6TxMbJv522uwM pVfASgaXkC47pFMsba1CxTk1HYY7DP3puELnHC4YSr1Rxl150uirAUBSsE0vamCs7C9b TdommBfrCfRd2AvY1mJPpwK39lCVdX3rJBUy0eGScyP1/xBayjsywSKI+V3IwLxdeXos vdIXMNZHDWqAje0p/AR+pKgZDFup14t/WycUk+2hzV6RP4GkjYccr6BbXrtkm4mBSri3 gXfQ/Gzf9dK16y8iYjVlusH/q4j7dbesYdyx5AkoPiNCXqn15jEOsXoPPXjLbJHyBuXm k49w== X-Gm-Message-State: AKS2vOzpLzagOvFoO2d2yCGrhWozQG4fQMLMq3qx+pUCIQoNRwL6ilo7 WyYxM6BlIc7XyoOREo0B86jRiJKRMLlK X-Received: by 10.129.175.33 with SMTP id n33mr9177769ywh.279.1497629560180; Fri, 16 Jun 2017 09:12:40 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.13.206.199 with HTTP; Fri, 16 Jun 2017 09:12:39 -0700 (PDT) In-Reply-To: References: From: Alan Somers Date: Fri, 16 Jun 2017 10:12:39 -0600 X-Google-Sender-Auth: LktwNdlAQ8wNTz5i7tgOnL75X0c Message-ID: Subject: Re: Possible bug in ifconfig regarding ip addresses and fibs To: Steven Crangle Cc: FreeBSD Net Content-Type: text/plain; charset="UTF-8" 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: Fri, 16 Jun 2017 16:12:41 -0000 On Fri, Jun 16, 2017 at 10:00 AM, Steven Crangle wrote: > > Hi, > > > I've been configuring a device with the following rc.conf lines: > > > ifconfig_le6_name="manee" > ifconfig_manee="fib 5 up" > ifconfig_manee_alias0="inet 185.100.174.221 netmask 255.255.255.0" > ifconfig_manee_alias1="inet 172.31.4.216 netmask 255.255.255.128" > ifconfig_manee_alias2="inet 192.168.124.216 netmask 255.255.255.128" > > The result I would have expected is as follows: > > > manee: flags=8843 metric 0 mtu 1500 > options=8 > ether 08:00:27:d3:83:da > inet 185.100.174.221 netmask 0xffffff00 broadcast 185.100.174.255 > inet 172.31.4.216 netmask 0xffffffc0 broadcast 172.31.4.255 > inet 192.168.124.216 netmask 0xffffff80 broadcast 192.168.124.255 > nd6 options=29 > media: Ethernet autoselect > status: active > fib: 5 > > > Instead I get the following on boot of the box: > > > manee: flags=8843 metric 0 mtu 1500 > options=8 > ether 08:00:27:d3:83:da > inet 185.100.174.221 netmask 0xffffff00 broadcast 185.100.174.255 > inet 172.31.4.216 netmask 0xffffffc0 broadcast 172.31.4.255 > nd6 options=29 > media: Ethernet autoselect > status: active > fib: 5 > > > I then tried to run the following command: > > ifconfig manee alias 185.100.174.221 netmask 255.255.255.0 > ifconfig manee alias 172.31.4.216 netmask 255.255.255.128 > ifconfig manee alias 192.168.124.216 netmask 255.255.255.128 > > Which resulted in the following output: > > > ifconfig: ioctl (SIOCAIFADDR): File exists > > After this I tried: > > ifconfig manee -alias > > Which seemed to wipe all addresses fro mthe device as expected. > > > I then started again using ifconfig lines to assign the aliases to the device, they all succeed apart from when I get to the 192.168.124.216 one. Which again outputs the following: > > > ifconfig: ioctl (SIOCAIFADDR): File exists > > Even though running ifconfig only shows the first two addresses configured. > > > Note: I also have a mgmt interface on fib 0 configured with the ip : 192.168.124.250 > > From investigation it seems to somehow be clashing with this, as I am able to add a 3rd alias with the following line: > > > ifconfig manee alias 192.168.125.216 netmask 255.255.255.128 > > Is it not possible to have two IP Addresses on the same range, but different addresses on seperate fibs? > > Thanks for any help! > > Steven There is some subtlety with using multiple fibs. Your problem is that you naturally assumed that by assigning fib 5 to the manee interface, that fib would also be used for all of its addresses. However, that's not the way it works. The interface fib actually isn't very important. It's only used for packet forwarding. The fib of an interface address is more important, and each address can have a different fib, even when they share an interface. In order to set the interface address fibs, do this: ifconfig_manee_alias0="inet 185.100.174.221 netmask 255.255.255.0 fib 5" ifconfig_manee_alias1="inet 172.31.4.216 netmask 255.255.255.128 fib 5" ifconfig_manee_alias2="inet 192.168.124.216 netmask 255.255.255.128 fib 5" You can't assign the same address to multiple interfaces with the same FIB. -Alan