LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-12-2008, 04:01 PM   #1
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 11, Ubuntu 9.10, Ubuntu Server 9.10, DamnSmallLinux 3.4.4, FreeDOS 1.0, OpenBSD 4.5
Posts: 192

Rep: Reputation: 31
binding to one specific IP


Hi!

I've got a program here, that should listen on a port, say port 2000.
Now, it is impossible to configure that program to bind to one IP out of many, that my machine has.

This program binds to every IP, but I don't want that, since I have different servers running on the same port, but on different IPs.

What I need, is an "external" way of controlling, to what IP that program may bind.

Is there such way, and if yes, what is that?

--polemon
 
Old 04-13-2008, 01:26 PM   #2
theNbomr
Senior Member
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 4,503

Rep: Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602Reputation: 602
I doubt very much that what you what can be done. At the lower internal levels of TCP/IP communication, the address to which an server socket is bound is a deliberate parameter chosen by the programmer/designer. Once the program has been compiled, it is not generally possible to alter the object code.
--- rod.
 
Old 04-13-2008, 01:41 PM   #3
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,181

Rep: Reputation: 468Reputation: 468Reputation: 468Reputation: 468Reputation: 468
By "external" I assume you mean an external connection being initiated to the port 2000 listening on the server.

You can control which IP answers simply by insuring that each of your NICs is on a specific network (separate VLANs) so that traffic between that external connection and your server can only find a route that way.

You can fine tune that by using iptables to specify which external IP can connect to which internal IP. iptables is the firewall software built into most Linux system. It can be used for far more than basic firewall.
We do something similar to systems where we allow ssh traffic into the server on our internal facing NIC but NOT on the externally NATed NIC that is visible to the internet.
 
Old 04-13-2008, 04:04 PM   #4
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 11, Ubuntu 9.10, Ubuntu Server 9.10, DamnSmallLinux 3.4.4, FreeDOS 1.0, OpenBSD 4.5
Posts: 192

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by jlightner View Post
By "external" I assume you mean an external connection being initiated to the port 2000 listening on the server.
Um, no, by "external" I meant a tool, or something like that, with which I could force a program to bind to a specific IP. The program, that uses the TCP/IP connection, can bind to an IP address itself, but I want to control that from outside the program.

Anyway, I like your suggestion, though. This would need us to restructure things but maybe this is just what I am looking for, thanks for that.

--polemon
 
  


Reply

Tags
binding, port


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Way to make autofs mount to specific USB flash drive to specific folder? utahnix Linux - Software 2 11-24-2010 05:27 PM
Bouncing specific domain with specific message dlublink Linux - Software 1 08-21-2006 02:29 PM
Q: Binding applications to a specific cpu Lazy Linux - Software 1 03-02-2006 07:42 AM
How to make a specific command(s) work for specific users or group only naren_0101bits Linux - General 3 08-28-2005 05:22 PM
How to make a specific command(s) work in a specific shell only naren_0101bits Linux - Newbie 3 08-28-2005 01:24 PM


All times are GMT -5. The time now is 09:06 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration