472,973 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 software developers and data experts.

Determine IP address of Network Load Balanced server at runtime

BA

Hi Everyone,

I have an application that sits behind a server farm, the application needs
to pass its NLB IP address in the message that it sends to another service.
From C# code, how can I determine the IP address of the network load
balanced machine that the message is generated from?

So, in essence, I have server1, server2 and server3 sitting behind the NLB
IP address 100.1.2.100, then I have server4 and server5 sitting behind NLB
IP 200.1.2.200 how can server1 figure our what IP address its sitting behind
so it can pass that info (100.1.2.100) into the message I want to send?

Thanks!


Jun 27 '08 #1
6 3364
On Apr 30, 1:40 pm, "BA" <biztalk.archit...@gmail.comwrote:
Hi Everyone,

I have an application that sits behind a server farm, the application needs
to pass its NLB IP address in the message that it sends to another service.
From C# code, how can I determine the IP address of the network load
balanced machine that the message is generated from?

So, in essence, I have server1, server2 and server3 sitting behind the NLB
IP address 100.1.2.100, then I have server4 and server5 sitting behind NLB
IP 200.1.2.200 how can server1 figure our what IP address its sitting behind
so it can pass that info (100.1.2.100) into the message I want to send?

Thanks!
I am not sure if that is possible. There could be some way of
querying the LB.. may be web scrap the LB admin site..

but what you can do is create a domain name that points to
100.1.2.100 and resolve it and pass to the other server..
Jun 27 '08 #2
BA wrote:
>
Hi Everyone,

I have an application that sits behind a server farm, the application
needs to pass its NLB IP address in the message that it sends to another
service. From C# code, how can I determine the IP address of the network
load balanced machine that the message is generated from?
So, in essence, I have server1, server2 and server3 sitting behind the
NLB IP address 100.1.2.100, then I have server4 and server5 sitting
behind NLB IP 200.1.2.200 how can server1 figure our what IP address its
sitting behind so it can pass that info (100.1.2.100) into the message I
want to send?
Unless you are doing NLB without NAT/IP Masquerading, you probably can't.

As I understand it, your setup is:

A - { server1, server2, server3 }
B - { server4, server5 }

A has IP 100.1.2.100, B has IP 200.1.2.200.

Scenario:
- server1 sends a message to B, not a specific server behind it.
- server5 winds up servicing the request, but as far as it can tell, it's coming
from A**

When a request is served through A (NLB)it will look like it is coming from
100.1.2.100, and when the response is served back from B (NLB) it will look like
it's coming from 200.1.2.200.

You may want to provide additional details, as depending on the type of load
balancing, it may be possible. Frequently though, load balancing is done at the
network layer with the traffic itself being routed round-robin style.

With more details of your current setup and what you're looking to accomplish
I'm sure you will get a better answer.

Chris.
Jun 27 '08 #3
BA

"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:Ox**************@TK2MSFTNGP05.phx.gbl...
BA wrote:
>>
Hi Everyone,

I have an application that sits behind a server farm, the application
needs to pass its NLB IP address in the message that it sends to another
service. From C# code, how can I determine the IP address of the network
load balanced machine that the message is generated from?
So, in essence, I have server1, server2 and server3 sitting behind the
NLB IP address 100.1.2.100, then I have server4 and server5 sitting
behind NLB IP 200.1.2.200 how can server1 figure our what IP address its
sitting behind so it can pass that info (100.1.2.100) into the message I
want to send?

Unless you are doing NLB without NAT/IP Masquerading, you probably can't.

As I understand it, your setup is:

A - { server1, server2, server3 }
B - { server4, server5 }

A has IP 100.1.2.100, B has IP 200.1.2.200.

Scenario:
- server1 sends a message to B, not a specific server behind it.
- server5 winds up servicing the request, but as far as it can tell, it's
coming from A**

When a request is served through A (NLB)it will look like it is coming
from 100.1.2.100, and when the response is served back from B (NLB) it
will look like it's coming from 200.1.2.200.

You may want to provide additional details, as depending on the type of
load balancing, it may be possible. Frequently though, load balancing is
done at the network layer with the traffic itself being routed round-robin
style.

With more details of your current setup and what you're looking to
accomplish I'm sure you will get a better answer.

Chris.

Thanks Chris,

Let me try to clarify.

Lets aggregate the servers in the 2 NLB enviornments so we just look at the
2 different NLB farms 100.1.2.100 and 200.1.2.200. Messages are being sent
from these 2 distinct environments to an external trading partner, not to
eachother.

I just need to determine what the IP of the farm that the message is being
generated within and put it into the message that I need to send to the
trading partners. No other action is required, its just a part of the
requirements of the application that the trading partner know what NLB farm
this message was generated from.

We'll be using the standard windows NLB.

Does this clarify?

BA


Jun 27 '08 #4
BA wrote:
[...]
I just need to determine what the IP of the farm that the message is
being generated within and put it into the message that I need to send
to the trading partners. No other action is required, its just a part
of the requirements of the application that the trading partner know
what NLB farm this message was generated from.

We'll be using the standard windows NLB.

Does this clarify?
Yes it does. According to MSDN you can rig something up using WMI:
http://msdn.microsoft.com/en-us/libr...05(VS.85).aspx

Check the "enumerating nodes" section, as well as the Provider Reference. You'll
be looking for the MicrosoftNLB_Cluster class and its InterconnectAddress I believe.

Chris.

Jun 27 '08 #5
On Wed, 30 Apr 2008 11:14:27 -0700, BA <bi***************@gmail.comwrote:
[...]
I just need to determine what the IP of the farm that the message is
being generated within and put it into the message that I need to send
to the trading partners. No other action is required, its just a part
of the requirements of the application that the trading partner know
what NLB farm this message was generated from.
Granted, I'm sure I know less about the actual load-balancing architecture
than the other respondents so far. But it sounds to me as though that may
actually be a moot point.

In general network applications, the usual answer to a question like this
is that the remote end (i.e. your "trading partner") already knows the IP
address. You should have some way of resolving your connection to some
lower-level network object that already has the IP address. For example,
a connected Socket can return the endpoint addresses (for the trading
partner end, your server farm will be the remote address). Or if this is
over UDP, then the receiving method will be able to return the IP address
for a given datagram received.

Since I'm unfamiliar with the specifics with respect to the NLB
architecture, I don't know whether that affects how you're making the
network connection or what sort of objects are involved. But surely there
is some way to resolve these objects to a lower-level object, assuming
you're not already dealing with such.

There is practically never a need for one end of a network communication
transaction to have to communicate its own address to the other end. If
it can communicate anything to the other end, then the other end already
has at least as good information about the first end's address than the
first end could come up with.

Pete
Jun 27 '08 #6
Peter Duniho wrote:
On Wed, 30 Apr 2008 11:14:27 -0700, BA <bi***************@gmail.comwrote:
>[...]
I just need to determine what the IP of the farm that the message is
being generated within and put it into the message that I need to send
to the trading partners. No other action is required, its just a part
of the requirements of the application that the trading partner know
what NLB farm this message was generated from.

Granted, I'm sure I know less about the actual load-balancing
architecture than the other respondents so far. But it sounds to me as
though that may actually be a moot point.
Most of the rest of your reply is correct in the general sense. In this
particular instance, it appears to be more of a case of a service identity issue
than anything else.

It strikes me that you could simply have a configuration directive for the
services themselves which dictate which cluster they appear to be responding
from, rather than using WMI to query the Windows NLB service.

Chris.
Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ferpino | last post by:
Hello I've a NLB(Network Load Balanced) in Windows 2000 Advanced Server. I want that when a service fail in one of the servers, inmediately all the network flows goes to the other one. I think...
2
by: billym | last post by:
Does anyone know if C# (or .NET applications in general) can be load balanced on the middle tier simply by deploying them to multiple servers in a clustered environtment? If so, would this be...
1
by: msuk | last post by:
All, I have a load balanced application server enviroment and wish to write a component that will sit on each node and service remote requests from many clients. Can anyone give me some...
8
by: Steven Van Dyke | last post by:
Hi I need a code snippet to determine if my computer is connected to a network or not. There's probably a System.Net function for it, but I cannot find it. Thanks, Steve
4
by: Selden McCabe | last post by:
Does anyone know how to determine the client's MAC address from within ASP.Net? I suppose it would have to be java or vb script running on the browser, but I haven't been able to find an...
8
by: MrNobody | last post by:
I need to find out the IP address of my local network on the WAN. There is alot of information on getting my local machine IP address but I can't find anything for getting the IP address my network...
2
by: Alex | last post by:
I am now working on a project where a requirement is the autogeneration of web service (asmx) files that will be located on a network drive to be shared by multiple load balanced web servers. I am...
13
by: Chris Bellini | last post by:
Greetings! I would like to use Server.Transfer to redirect users to a given page, while maintaining the state of form fields. This works fine on a single server. However, this will be...
25
by: _DD | last post by:
I'd like to include a 'Test Connection' button in an app, for testing validity of a SQL connection string. I'd prefer to keep the timeout low. What is the conventional way of doing this?
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.