Forum Discussion

ecloss_25932's avatar
ecloss_25932
Icon for Nimbostratus rankNimbostratus
Mar 19, 2010

Forwarding to a specific address

I am brand new to iRules and am trying to build an iRule that will listen on a specific port (8411) of a specified address xxx.xxx.xxx.xxx and then forward to the same port on another address? This seems that it would be fairly simple but after 3 days of struggling with it and failing I am out of ideas. Can anyone out there help ??

1 Reply

  • On the face of it, what you are asking for is how virtual servers work;

    listen on 1.1.1.1:8411 and send all connections to a pool that contains 2.2.2.2:8411

    But maybe what you need is to have a wildcard virtual server 0.0.0.0:any and pluck just that traffic out that is for 1.1.1.1:8411 but leave everything else free to go where ever the routing table says it should go.

    If so, you could try something like this:

     
     when CLIENT_ACCEPTED { 
     switch [IP::local_addr] { 
     1.1.1.1 {  
     log local0. "I found IP addr 1.1.1.1" 
     switch [IP::protocol] { 
     6 { 
     switch [TCP::local_port] { 
     8411 {  
     log local0. "I found TCP port 8411" 
     node 2.2.2.2 
     } 
     default { log local0. "These aren't the ports you're looking for" } 
     } 
     } 
     17 { 
     switch [UDP::local_port] { 
     8411 {  
     log local0. "I found UDP port 8411"  
     node 2.2.2.2 
     } 
     default { log local0. "These aren't the ports you're looking for" } 
     } 
     } 
     default { log local0. "This isn't the right transport protocol" } 
     } 
     } 
     default { log local0. "This isn't the right IP addr" } 
     } 
     }