2

I have a Debian 9.5 server that I'm trying to use as a PBX server with a sip trunk, this machine has two network interfaces, one pointing to LAN another one pointing to my sip provider. This is the configuration:

iface LAN inet static
    address 192.168.1.247/24
    gateway 192.168.1.254
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.254

allow-hotplug SIP
iface SIP inet static
    address 172.xxx.xxx.xxx
    netmask 255.255.255.252

And a SIP server with IP: 172.xxx.xxx.xxx

What I want to do is route all incoming trafic from my LAN that targets to my SIP server to it.

I was trying adding this to SIP interface

post-up ip route add [MySipServerIP] dev SIP src 192.168.1.0/24 table mgmt

Another try:

post-up ip route add [SIP ip] dev SIP src 192.168.1.0/24 table mgmt

What is the right way to set this route?

1
  • Comments are not for extended discussion; this conversation has been moved to chat. – terdon Feb 17 '19 at 13:52
1

Well finally the work is done.

First: Interface LAN was configured by installer itself, then it add mask /24 that must be removed.

iface LAN inet static
    address 192.168.1.247/24
    gateway 192.168.1.254
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.254 

allow-hotplug SIP
iface SIP inet static
    address 172.xxx.xxx.xxx
    netmask 255.255.255.252

Was modified to:

iface LAN inet static
    address 192.168.1.247
    netmask 255.255.255.0
    gateway 192.168.1.254
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.254 

allow-hotplug SIP
iface SIP inet static
    address 172.xxx.xxx.IP
    netmask 255.255.255.252

Then at /etc/rc.local must add two static routes

  1. This route sends all trafic to LAN through LAN interface

    route add 192.168.1.0 gw 192.168.1.254
    
  2. This route sends all traffic to my sip server through SIP interface

    route add [SIP SERVR IP] gw 172.xxx.xxx.GW
    

This all done the work.

Note:

172.xxx.xxx.IP is the Ip assigned by telecom provider

172.xxx.xxx.GW is the gateway assigned by telecom provider

[SIP SERVR IP] is the Sip server ip assigned by telecom provider.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.