0

SIP server was unreachable after changing routes. I have 2 ISP ,ISP 1 is my default and ISP 2 is my back-up. I have a dialer behind linux router linux. Linux router has 3 ethernet cards.

Router network config

root@intellipatient:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 64:66:b3:02:d9:5a
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::6666:b3ff:fe02:d95a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10209371 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7782687 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2896210016 (2.8 GB)  TX bytes:1014989041 (1.0 GB)
          Interrupt:20 Base address:0xa000

eth1      Link encap:Ethernet  HWaddr d8:50:e6:51:1b:5c
          inet addr:121.96.56.5  Bcast:121.96.56.63  Mask:255.255.255.192
          inet6 addr: fe80::da50:e6ff:fe51:1b5c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1088495 errors:0 dropped:7954 overruns:0 frame:0
          TX packets:346384 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:83277286 (83.2 MB)  TX bytes:86874892 (86.8 MB)
          Interrupt:42 Base address:0xe000

eth2      Link encap:Ethernet  HWaddr c0:4a:00:04:04:ec
          inet addr:192.168.254.1  Bcast:192.168.254.255  Mask:255.255.255.0
          inet6 addr: fe80::c24a:ff:fe04:4ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7250634 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9369485 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1001062387 (1.0 GB)  TX bytes:2798746300 (2.7 GB)
          Interrupt:41 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:44550 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44550 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4021256 (4.0 MB)  TX bytes:4021256 (4.0 MB)

Here current routes set in router, I set default router to globe ISP provider now

root@intellipatient:~# ip route show
default via 192.168.254.254 dev eth2
121.96.56.0 dev eth1  scope link  src 121.96.56.5
121.96.56.0/26 dev eth1  scope link  src 121.96.56.5
169.254.0.0/16 dev eth0  scope link
192.168.1.0/24 dev eth0  scope link  src 192.168.1.1
192.168.254.0 dev eth2  scope link  src 192.168.254.1
192.168.254.0/24 dev eth2  scope link  src 192.168.254.1

Here the firewall config

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -A FORWARD -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m limit --limit 5/min -j LOG --log-prefix forwarding --log-level 7
iptables -A FORWARD -j DROP
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 121.96.56.5
iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 192.168.254.1

I created also table dialer for dialer, for the purpose of split access which currently set to bayantel ISP

root@intellipatient:~# ip route show table dialer
default via 121.96.56.1 dev eth1

IPtables rule

root@intellipatient:~# ip rule ls
0:      from all lookup local
32762:  from 192.168.1.2 lookup dialerbk
32763:  from 192.168.1.20 lookup dialer
32764:  from 192.168.254.1 lookup globetel
32765:  from 121.96.56.5 lookup bayantel
32766:  from all lookup main
32767:  from all lookup default

The problem is, when I set dialer route to bayantel

my dialer show 
2001/2001                  (Unspecified)    D   N      0        UNKNOWN
2000/2000                  (Unspecified)    D   N      0        UNKNOWN
APN                        208.74.75.250        N      5060     UNREACHABLE
apn                        208.74.75.250        N      5060     UNKNOWN
25 sip peers [Monitored: 1 online, 24 offline Unmonitored: 0 online, 0 offline]
goautodial*CLI>

and then when I change the route for dialer to globe

ip route change default via 192.168.254.254 

then my dialer get's connected again to voip provider.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
serutnev
  • 1
  • 1

1 Answers1

0

Simple setup like this:

  1. In sip.conf set bind=192.168.254.1
  2. Add route to your voip provider via eth2

All other setup require checks of how your packets really go and what asterisk send in sip packets. Not think you can get answer on that in stackoverflow format.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
arheops
  • 708
  • 1
  • 5
  • 13