Date: Wed, 21 Jun 2000 16:55:16 +0100 (BST) From: Mac <mac@ngo.org.uk> To: tech@squid.tznet.com (Scott Pilz) Cc: freebsd-questions@freebsd.org Subject: Re: Multiple IP's Message-ID: <200006211555.QAA17718@ngo.org.uk> In-Reply-To: <200006211529.e5LFT6i63816@squid.tznet.com> from Scott Pilz at "Jun 21, 0 10:29:06 am"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006211555.QAA17718>