13. SIP/UDP load-balancing with Call-ID session management

The “sipp” utility called for health-checking comes with the Debian package “sip-tester” (install with “sudo apt-get install sip-tester” on Debian).

The Configuration File

The configuration uses the following BalanceNG V3 extensions (also highlighted in bold):

  • The module chain vrrp,arp,ping,hc,master,slb,tnat,nat,rt is the BalanceNG standard module chain.
  • server 1 sessionid sip associates the SIP Call-ID session handler to virtual server 1.
  • target 1 sessionid sip and target 2 sessionid sip do the same for the targets.
  • target 1 screate enable and target 2 screate enable allow session creation in the reverse direction by packets initially coming from the target side. This is working because a non-DSR setup is used (where packets are passing BalanceNG also on the return path).
  • Only the configuration of one node is shown here.
//        configuration taken ...
//        BalanceNG ...
modules   vrrp,arp,ping,hc,master,slb,tnat,nat,rt
set       ipforwarding 1
interface bond0
interface eth1
vrrp      {
          vrid 1
          priority 200
          network 2
}         
network   1 {
          name LAN
          addr 172.17.40.0
          mask 255.255.255.0
          real 172.17.40.7
          virt 172.17.40.8
          interface bond0
}         
network   2 {
          name WAN
          addr 10.31.40.32
          mask 255.255.255.240
          real 10.31.40.42
          virt 10.31.40.43
          interface eth1
}         
register  networks 1,2
enable    networks 1,2
gateway   {
          ipaddr 10.31.40.33
}         
server    1 {
          ipaddr 10.31.40.43
          port 5060
          protocol udp
          sessionid sip
          stimeout 10
          targets 1,2
}         
server    2 {
          ipaddr 10.31.40.43
          port 80
          protocol tcp
          method session
          target 3
}         
register  servers 1,2
enable    servers 1,2
target    1 {
          name "SIP 5060"
          ipaddr 172.17.40.6
          port 5060
          protocol udp
          script "/usr/bin/sipp -sf /home/sip/client_check.xml -m 1 -nr -recv_timeout 3000 $ipaddr$:$port$",2,10
          screate enablesessionid sip
}         
target    2 {
          name "SIP 5060"
          ipaddr 172.17.40.14
          port 5060
          protocol udp
          script "/usr/bin/sipp -sf /home/sip/client_check.xml -m 1 -nr -recv_timeout 3000 $ipaddr$:$port$",2,10
          screate enablesessionid sip
}         
target    3 {
          name "HTTP"
          ipaddr 172.17.40.5
          port 80
          protocol tcp
          ping 3,10
}         
register  targets 1,2,3
enable    targets 1,2,3
//        end of configuration

Contents of clientcheck.xml as referenced by the sipp Health Check

<?xml version="1.0" encoding="ISO-8859-1" ?>
<scenario name="client check">
 <send>
 <![CDATA[
 OPTIONS sip:bng_health_check@inlab.de:[remote_port] SIP/2.0
 Via: SIP/2.0/[transport] [local_ip]:[local_port]
 Max-Forwards: 70
 To: <sip:bng_health_check@inlab.de:[remote_port]>
 From: <sip:bng_health_check@inlab.de:[local_port]>;tag=[call_number]
 Call-ID: [call_id]
 CSeq: [cseq] OPTIONS
 Contact: sip:bng_health_check@inlab.de:[local_port]
 Accept: application/sdp
 Content-Length: [len]
]]>
 </send>
 <recv response="200">
 </recv>
</scenario>