From owner-freebsd-net@freebsd.org Wed Apr 20 10:19:31 2016 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 C49A0B15C17 for ; Wed, 20 Apr 2016 10:19:31 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8791217A4 for ; Wed, 20 Apr 2016 10:19:31 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-252-92.lns20.per4.internode.on.net [121.45.252.92]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u3KAJQ7S022760 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 20 Apr 2016 03:19:29 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: Assigning same ip address to different interfaces with different FIBs To: freebsd-net@freebsd.org References: <118390227.3958522.1461146303528.JavaMail.yahoo.ref@mail.yahoo.com> <118390227.3958522.1461146303528.JavaMail.yahoo@mail.yahoo.com> From: Julian Elischer Message-ID: <571757A8.8030007@freebsd.org> Date: Wed, 20 Apr 2016 18:19:20 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <118390227.3958522.1461146303528.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 10:19:31 -0000 On 20/04/2016 5:58 PM, M. V. via freebsd-net wrote: > Hello guys, > I have a problem with having multiple FIBs in FreeBSD-9.2. I've already setup 4 FIBs in kernel, and everything is OK. I assigned each interface to one FIB and I can add routes to any of FIBs I want, and everything works fine.But my problem is, I want to assign same IP address to multiple interfaces. for example: > interface em1 (in FIB-1) : 100.100.100.1/24interface em2 (in FIB-2) : 100.100.100.1/24 > this should work, bacause I want each FIB's interfaces and routes to be completely separate from other FIBs' interfaces and routes. for this I do:# sysctl net.add_addr_allfibs = 0 I think you are using the wrong tool to do this job. Fibs will "kind-of" allow you to do some of this but all fibs still 'see' all interfaces, Even if you don't set routes to them. What you want is VIMAGE/VNET Even though we've made vnet a characteristic of a jail (it wasn't always), you can still use it in the way you want if done right. Write a "how-to" when you've got it worked out :-) > # ifconfig em1 fib 1# ifconfig em2 fib 2# setfib 1 ifconfig em1 100.100.100.1/24# setfib 2 ifconfig em2 100.100.100.1/24 > but this doesn't work as expected, and 100.100.100.0/24 route is only being added to FIB-1 (second IP assignment command doesn't work, though it returns no error).# setfib 1 netstat -rn ==> this fib has 100.100.100.0/24 entry added in it# setfib 2 netstat -rn ==> nothing is added here. there are some sysctls that control some of this. have you investigated them? Though, as I say, you really want to structure your problem around using vimage. Each vimage instance can have identical interfaces etc, becasue they are effectively separate machines. You can route between them internally to the machine and at one stage you could have a process with sockets on each net but I"m not sure if you can still do that easily. > > Is there any way I can do this in FreeBSD? > Thank you. > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >