G'day all,
I'm working on a scenario with a Kamailio box with a private IP, with a public IP 1:1 NATed to it (but the VM does not see the public IP on the NICs).
When forwarding requests to some hosts I want to set the Via address to be the public IP, but when forwarding requests to other hosts I want to leave the Via address to the internal IP address.
If I set the `Advertise` parameter in the bind config, this sets the Via to the advertised IP, but I'm seeing that address used even when communicating with hosts on the private IP.
Of course if the IP was on the VM itself I could use $fs or force_send_socket, but that only works if I've got the public IP bound, which I can't do.
Is there a simple way to set / override what IP gets baked into the Via header?
Cheers, Nick
Provision a secondary IP on the server and use that one for private traffic and the one that is NATed 1:1 for public traffic. On the main IP (the one that is NATed 1:1) set the advertised option.
- ovidiu
On Tue, Jul 22, 2025 at 12:11 Nick Jones via sr-users < sr-users@lists.kamailio.org> wrote:
G'day all,
I'm working on a scenario with a Kamailio box with a private IP, with a public IP 1:1 NATed to it (but the VM does not see the public IP on the NICs).
When forwarding requests to some hosts I want to set the Via address to be the public IP, but when forwarding requests to other hosts I want to leave the Via address to the internal IP address.
If I set the `Advertise` parameter in the bind config, this sets the Via to the advertised IP, but I'm seeing that address used even when communicating with hosts on the private IP.
Of course if the IP was on the VM itself I could use $fs or force_send_socket, but that only works if I've got the public IP bound, which I can't do.
Is there a simple way to set / override what IP gets baked into the Via header?
Cheers, Nick __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hello,
the advertise for listen provides is very convenient, because it is automatically handled internally by most of the functions. But there are config options to set the advertise address per request, but with large configs, the complexity increases. See functions exported by core and modules like corex and rr.
Maybe you can use (listen on) a different port for the internal network communication (e.g., 5080), with no advertise address, that would keep the config simpler.
Cheers, Daniel
On 22.07.25 10:59, Nick Jones via sr-users wrote:
G'day all,
I'm working on a scenario with a Kamailio box with a private IP, with a public IP 1:1 NATed to it (but the VM does not see the public IP on the NICs).
When forwarding requests to some hosts I want to set the Via address to be the public IP, but when forwarding requests to other hosts I want to leave the Via address to the internal IP address.
If I set the `Advertise` parameter in the bind config, this sets the Via to the advertised IP, but I'm seeing that address used even when communicating with hosts on the private IP.
Of course if the IP was on the VM itself I could use $fs or force_send_socket, but that only works if I've got the public IP bound, which I can't do.
Is there a simple way to set / override what IP gets baked into the Via header?
Cheers, Nick
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Thanks Daniel and Ovidiu, Trawling through old mailing list posts I found a few references to set_advertised_address() which seems to do the trick, I'm calling that when the dispatcher group is going to something on a public address - if anyone else is looking to do the same thing, I think this is the way to go. Cheers, Nick
On Tue, 22 Jul 2025 at 19:25, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
the advertise for listen provides is very convenient, because it is automatically handled internally by most of the functions. But there are config options to set the advertise address per request, but with large configs, the complexity increases. See functions exported by core and modules like corex and rr.
Maybe you can use (listen on) a different port for the internal network communication (e.g., 5080), with no advertise address, that would keep the config simpler.
Cheers, Daniel
On 22.07.25 10:59, Nick Jones via sr-users wrote:
G'day all,
I'm working on a scenario with a Kamailio box with a private IP, with a public IP 1:1 NATed to it (but the VM does not see the public IP on the NICs).
When forwarding requests to some hosts I want to set the Via address to be the public IP, but when forwarding requests to other hosts I want to leave the Via address to the internal IP address.
If I set the `Advertise` parameter in the bind config, this sets the Via to the advertised IP, but I'm seeing that address used even when communicating with hosts on the private IP.
Of course if the IP was on the VM itself I could use $fs or force_send_socket, but that only works if I've got the public IP bound, which I can't do.
Is there a simple way to set / override what IP gets baked into the Via header?
Cheers, Nick
Kamailio - Users Mailing List - Non Commercial Discussions --
sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to
the sender!
-- Daniel-Constantin Mierla (@ asipto.com) twitter.com/miconda -- linkedin.com/in/miconda Kamailio Consultancy, Training and Development Services -- asipto.com