Forum Discussion

marshje_58292's avatar
marshje_58292
Icon for Nimbostratus rankNimbostratus
Dec 11, 2007

UDP Health Monitoring with fixed SOURCE port?

Is is possible to configure LTM to use a fixed SOURCE port number when doing UDP health monitoring?

 

 

I have a UDP application that I am Load Balancing that does not normally "respond" as such - it's function is simply to replicate/forward traffic. I can write a rule in the forwarding application to send a "response" back to LTM (in response to an LTM monitor UDP packet), if I had a fixed port to respond to.
  • If you wrote an external monitor, you could easily write a sockets application in perl or otherwise...

    
    use IO::Socket::INET;
    $MySocket=new IO::Socket::INET->new(
            LocalPort=>1000,
            PeerPort=>$2,
            Proto=>'udp',
            PeerAddr=>'$1'
            );
  • It's not clear to me how the snippet of code you suggest fits into the larger picture. My sense is that an external monitor program would have to handle both the transmission and receipt of the "health" packet. And further must be able to send a status back to LTM.

     

     

    What am I missing here?
  • The external monitor is a script running on the LTM, called by the external monitor configured to your pool. I suppose with receive-only traffic you will have to be careful with your interval and timeout settings. This script should get you started:

    
    !/usr/bin/perl
    use strict;
    use warnings;
    use IO::Socket::INET;
    my $port   = getservbyname 'bootps', 'udp'; 
    my $socket = IO::Socket::INET -> new (LocalPort  => $port, 
                                          Broadcast  =>  1,
                                          Proto      => 'udp')
                 or die "Failed to bind to socket: $@";
    my $mess;     
    while ($socket -> recv ($mess, 1024)) {  
        print "Saw a bootp request.\n";
    }