[Kamailio-Users] Dialog from 1 of N IP Addresses

Stanisław Pitucha stanis at gradwell.net
Fri Jun 19 17:26:32 CEST 2009


2009/6/19 Stagg Shelton <stagg at 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)...

-- 
Kind regards,

Stanisław Pitucha, Gradwell Voip Engineer

T: 01225 800 851 | F: 01225 800 801 | E: stanis at gradwell.net | www.gradwell.com

Gradwell - Internet for Business People
Phone Services | Business Broadband | Email & Website Hosting

Can switching to VoIP today put some change in your pocket?
Registered Address: 26 Cheltenham Street, Bath, BA2 3EX, UK. Company
Number: 3673235



More information about the Users mailing list