From owner-freebsd-questions Mon Jan 13 7:13:42 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8473537B401 for ; Mon, 13 Jan 2003 07:13:40 -0800 (PST) Received: from ra.dweebsoft.com (ra.dweebsoft.com [209.237.40.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0937243ED8 for ; Mon, 13 Jan 2003 07:13:40 -0800 (PST) (envelope-from deckenberg@dweebsoft.com) Received: from daxhome (daxhome.dweebsoft.com [192.168.10.10]) by ra.dweebsoft.com (8.12.3/8.12.5) with SMTP id h0DFDY18032218; Mon, 13 Jan 2003 07:13:35 -0800 (PST) (envelope-from deckenberg@dweebsoft.com) Message-ID: <007701c2bb16$5784f0c0$0a0aa8c0@dweebsoft.com> From: "Dax Eckenberg" To: "Anand Buddhdev" Cc: References: <20030113114954.GQ1330@anand.org> <3E22B6B4.70401@potentialtech.com> <20030113141031.GA11679@anand.org> Subject: Re: Multiple network cards with IP addresses in the same network Date: Mon, 13 Jan 2003 07:13:34 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > I have addresses 192.168.0.1 and 192.168.0.2. I want to run different > services on the 2 different IP addresses. In a linux system, I do: > > ifconfig eth0 192.168.0.1 netmask 255.255.255.0 > ifconfig eth0:0 192.168.0.2 netmask 255.255.255.0 > > So that I have 2 different addresses bound to the same interface. > > On FreeBSD, if I do: > > ifconfig fxp0 192.168.0.1 netmask 255.255.255.0 > ifconfig fxp0 192.168.0.2 netmask 255.255.255.0 alias > > That fails. It should fail, you should enter: # ifconfig fxp0 192.168.0.2 netmask 255.255.255.255 alias In this situation you can ignore the /32 netmask, it will act as /24. > The ifconfig manpage states that a nonconflicting netmaks must be used > for the alias, and suggests to use 0xffffffff. I don't understand why, > because I don't see why one network interface cannot have more than one > address bound to it within the same network. If I use a /32 netmask for > the alias address, how will the kernel respond to arp requests for that > alias address? arp requests for .2 will be handled properly by the kernel as if it were /24. > > >2. Adding a second IP to a *different* network card in the same server > > >does not work if the second IP is within the network of the first one. > > > > Because it breaks routing and the basic concept of IP addys and netmasks. > > If you have two NICs on the same network, how is the kernel supposed to > > route packets? > > I still don't understand. In a linux system I can do: > > route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.254 dev eth0 > route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.254 dev eth1 To my knowledge, this is a Linux feature. Solaris, *BSD, and others don't let you specify the network interface when you add a route. I know for a fact under Solaris that when you have 2 interfaces which live in the same subnet, the interface with the lowest numbered IP will be the interface used for outbound traffic. > All I want to do is to have 2 different IP addresses on each of the > different interfaces in the server, where the addresses are in the > same network. I can do it in linux. Why can't I do it in FreeBSD? > Good question. I'd defer this anwser to someone a bit more intimate with FreeBSD's IP stack and routing. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message