473,758 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3405
On Apr 30, 1:40 pm, "BA" <biztalk.archit ...@gmail.comwr ote:
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.ch sh.cawrote in message
news:Ox******** ******@TK2MSFTN GP05.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 "enumeratin g nodes" section, as well as the Provider Reference. You'll
be looking for the MicrosoftNLB_Cl uster class and its InterconnectAdd ress I believe.

Chris.

Jun 27 '08 #5
On Wed, 30 Apr 2008 11:14:27 -0700, BA <bi************ ***@gmail.comwr ote:
[...]
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.comwr ote:
>[...]
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
1573
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 i can only do it by disconnecting programatically the network adapter,...but how??? Could i do it with .NET? how?? Thanks
2
2050
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 something supported by the Framework, MSCS, or a third party solution such as Local Director? Also, if it can be done are their coding caveats that must be adhered to?
1
5493
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 advice in what type of remoting I should use i.e. client activated or sever activated for my load balanced enviroment? Thanks
8
2231
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
9428
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 example... Thanks, ---Selden McCabe
8
10383
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 is on. I was thinking I could make a HTTP Request to a server which displays your IP address as they see it and scrape it out of the response but I was hoping for a method which is less dependent on some server out on the web...
2
1318
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 wondering what the implications are for concurrency issues if one web server in the farm generates the WSMX, then another web server in the farm receives an initial request that causes a compile of the WSMX and while the web service is being...
13
2993
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 deployed in a load balanced environment. I know that Session variables and load balanced environments don't mix. Do I have a cause for concern with Server.Transfer as well?
25
14503
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
9492
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9299
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9740
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8744
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5332
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.