[SR-Users] Having kamailio bind to a VRF device

George Diamantopoulos georgediam at gmail.com
Thu Sep 21 13:06:30 CEST 2017


I have a use case where I need to have kamailio bind to a VRF device. The
configuration in question is similar to the example below, where eth1 is a
slave to the VRF-lite device:

 +----------+      +-------------------+
 |   eth0   |      |    vrf-green      |
 |  |      |      |
 +----------+      +-------------------+
                      |   eth1   |
                      |  |

Both the main routing table and "vrf-green" routing table have a default

What I need to be able to do is have kamailio bind to both interfaces:


And additionally be able to use force_send_socket to select an interface,
for example:


However, I can't get this to work. The above configuration fails because
there is no listen directive for Also, kamailio doesn't process
packets received on the VRF with the above listen directives, it behaves as
if it doesn't listen on indeed.

In addition using either of the below:


fails with an error upon starting kamailio.

According to the kernel documentation:

Applications that are to work within a VRF need to bind their socket to the
VRF device:

    setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);

or to specify the output device using cmsg and IP_PKTINFO.

The question is, is VRF useable with kamailio right now? Or is
development needed? Thanks!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170921/6b8cb788/attachment.html>

More information about the sr-users mailing list