I want to connect two SIP phones from different locations over ZeroTier. I have no problem configuring asterisk, however I am lost at how to connect remote (LAN 2) phone using forwarding.
The situation can be pictured like this:
--------------------------+---------------------------------
LAN 1 I LAN 2
192.168.2.0/24 I 192.168.3.0/24
--------------------------+---------------------------------
I
ASTERISK + I
ZeroTier node 1 I ZeroTier node 2
192.168.192.117 <================> 192.168.192.128
192.168.2.117 I 192.168.3.105
^ I ^
| I |
v I v
SIP phone 1 I SIP phone 2
192.168.2.101 I 192.168.3.101
I have asterisk server running on 192.168.2.117. No problem to see phone on LAN 1. The problem is how to see phone on LAN 2.
I read some explenations on iptables and have partial success - seems that I can see packets from remote phone on ZeroTier node on LAN 1 becase of this rules:
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A PREROUTING -p udp -i eth0 -j DNAT --to 192.168.192.117
The idea is to forward all incoming UDP from LAN 2 and forward it to ZeroTier on LAN 1. I must admit I don't fully understand what is written here... and also it may be completely wrong :(
However that's all. No way to response going back.
ZeroTier supports natively some bridging, but I must admit networking is "high math" for me.
Can anybody help please?