I have a requirement from an upstream provider that is providing multiple termination only gateways to me. The requirement is that I have to have a unique source ip address for each gateway that I will be terminating calls to. I would like to use only one kamailio system bound to multiple ip addresses to meet this requirement. I have my LCR built with the various routes to the gateways. I have identified the function force_send_socket([proto:]address[:port]) which seems like it can be used to meet this functional requirement. I am a little confused how to implement this function with LCR.
My basic requirement is that if upstream gateway ip address == 1.2.3.4 then originate and maintain the dialog from my source ip 4.3.2.1 else if gateway ip == 6.7.8.9 then originate and maintain dialog using soure ip 9.8.7.6, else if ... N upstream gateways
Is force_send_socket([proto:]address[:port]) the function that I need to be trying to use to meet this requirement? Is there a simpler method that can be used instead?
Any help will be appreciated.
Stagg
2009/6/19 Stagg Shelton stagg@3pconnect.com:
Is force_send_socket([proto:]address[:port]) the function that I need to be trying to use to meet this requirement? Is there a simpler method that can be used instead?
I'm not 100% sure about it, but try this: Every packet on linux goes through a routing table, which includes an outbound interface. You can specify an alias for each 'local' ip address. Then - routes are matched beginning with the longest prefix, so...
- for original interface ethX (for example eth0) create interfaces ethX:1 .. ethX:N with the source ips assigned to them - set a route for each interface: route add -host gw_ip_1 dev ethX:1 route add -host gw_ip_2 dev ethX:2 ... - you may need to add a network, which covers those gateways, so in case 'add -host' complains: route add -net gw_ip_1 netmask minimal_netmask_covering_all_gws dev ethX:1 ...
In theory it should work ;) I haven't tested it, so you may need to tweak it a bit (lot)...