From owner-freebsd-questions Wed Jun 21 8:54:28 2000 Delivered-To: freebsd-questions@freebsd.org Received: from ngo.org.uk (ngo.org.uk [193.62.43.28]) by hub.freebsd.org (Postfix) with ESMTP id 2119737BE68 for ; Wed, 21 Jun 2000 08:54:23 -0700 (PDT) (envelope-from mac@ngo.org.uk) Received: (from mac@localhost) by ngo.org.uk (8.9.3/8.9.3) id QAA17718; Wed, 21 Jun 2000 16:55:17 +0100 (BST) From: Mac Message-Id: <200006211555.QAA17718@ngo.org.uk> Subject: Re: Multiple IP's In-Reply-To: <200006211529.e5LFT6i63816@squid.tznet.com> from Scott Pilz at "Jun 21, 0 10:29:06 am" To: tech@squid.tznet.com (Scott Pilz) Date: Wed, 21 Jun 2000 16:55:16 +0100 (BST) Cc: freebsd-questions@freebsd.org X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Scott, > Is it possible (and if so, how would I go about doing this) to run multiple IP's on a single network card (FreeBSD 3.1) to work the following way: > > 10.0.0.1 is running program A on open port 6000. > 10.0.0.2 is running program B on open port 6000. > > Both ports are from different programs, upon telneting to these ports, you'll reach each different program. > Yes it's possible. > IP aliasing will *not* handle this obviously, so ifconfig is out of the picture. For example, I have tested this theory, and upon a port scan on any IP of the entire system, it will list *all* open ports on the system - thus, the same port cannot be opened for the second time using a different IP. > IP aliasing will actually be needed for this if you've only got one physical interface), but the actual answer has nothing whatever to do with aliases, and everything to do with addresses. When you set up a server somewhere you'll have:- socket() bind() listen() or similar. In that lot somewhere you'll have a INADDR_ANY, which tells the server to listen aon all IP addresses of the machine. You should instead specify the IP address you wish it to listen to and it will ignore all the others. See the man pages for those three calls and also the man page for 'tcp'. Mac To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message