473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 3387
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.