Forum Discussion

ram-esh_161164's avatar
ram-esh_161164
Icon for Nimbostratus rankNimbostratus
Jun 17, 2014

Can I bind a virtual server port to real server port via iRule for every connection

I have this requirement -

 

One Client owns the server. Only client know on what port a service is running in that server. They want to send port info as some data in the connection. Since I have no real server port info, I can't bind virtual server port to real server port.

 

When Client connects to virtual server/port, I want to write an iRule that will parse data in that connection and extract port number. Using the port number in the parsed data, client connection is forwarded to real server.

 

Customer has 1000 servers with 20 services in each server.

 

Any help is really appreciated.

 

Thanks to all

 

-Ramesh

 

11 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Is the destination port of the incoming traffic to the LTM different from the port the server listening to?

     

    • ram-esh_161164's avatar
      ram-esh_161164
      Icon for Nimbostratus rankNimbostratus
      I don't know on what port the service is running. Client will provide to me in the payload.
  • Is the destination port of the incoming traffic to the LTM different from the port the server listening to?

     

    • ram-esh_161164's avatar
      ram-esh_161164
      Icon for Nimbostratus rankNimbostratus
      I don't know on what port the service is running. Client will provide to me in the payload.
  • Can you tell us what you are trying to do overall. I get the impression this is only part of the picture.

     

    • ram-esh_161164's avatar
      ram-esh_161164
      Icon for Nimbostratus rankNimbostratus
      Real server port number is not available. I can bind vip to real server IP. But can't bind to a port on the real server. Client provides me this port number in the payload. I need to parse the payload and extract the port number and continue my connection to real server. Every time a client makes a connection to vip, it provides me real server port number in the payload. Everytime, I have to run the script to find real server port number and then connect to real server port to complete the connection from client to real server.
  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    How does the payload looks like with the port information?

     

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    I assume 2 bytes referred is in TCP payload.

    Try this:

    when CLIENT_ACCEPTED {
        TCP::collect
    }
    when CLIENT_DATA {
       set port [TCP::payload 2]
       TCP::release
    }
    when LB_SELECTED {
      node [LB::server addr] $port
      LB::reselect
    }