Forum Discussion

ggarza_345867's avatar
ggarza_345867
Icon for Nimbostratus rankNimbostratus
Jul 19, 2018

dns irule sytax error

Im getting syntax errors with this irule and having trouble finding where the error is..if you could help that would be great.. ! ! when DNS_REQUEST { if { [IP::addr [IP::client_addr]/24 equals 192.168.163.0] || [IP::addr

 

[IP::client_addr]/24 equals 192.168.165.0]} { if { [LB::status vs 192.168.163.39 ] eq "up" } { host 192.168.163.39 } } else { if { [LB::status vs 192.168.204.45 ] eq "up" } { host 192.168.204.45 } elseif { [LB::status vs 192.168.163.39 ] eq "up" } { host 192.168.163.39 } else { host 192.168.204.45 }

 

} }

 

1 Reply

  • Hello,

    It looks like you had an extra 'if' next to an else that wasn't needed. Please try this (I've not had chance to test it as I'm traveling and writing this from my phone)

    when DNS_REQUEST { 
      if {([IP::addr [IP::client_addr]/24 equals 192.168.163.0]) || ([IP::addr [IP::client_addr]/24 equals 192.168.165.0])} { 
        if {[LB::status vs 192.168.163.39 ] eq "up" } { 
          host 192.168.163.39 
        } elseif {[LB::status vs 192.168.204.45] eq "up" } { 
          host 192.168.204.45 
        } elseif {[LB::status vs 192.168.163.39 ] eq "up" } { 
          host 192.168.163.39 
        } else { 
          host 192.168.204.45 
        }
      } 
    }