dndx / phantun

Transforms UDP stream into (fake) TCP streams that can go through Layer 3 & Layer 4 (NAPT) firewalls/NATs.
Apache License 2.0
1.71k stars 137 forks source link

Phantun Not Connected #73

Closed asterdeve closed 2 years ago

asterdeve commented 2 years ago

I follow the document but still, I am not succeeded to connect server & client

On both side, I am using centos 7 64bits & I downloaded

phantun_x86_64-unknown-linux-musl.zip

I enable the ip_forward & also iptable part

then I run this command on the server & client side

RUST_LOG=info ./phantun_server --ipv4-only --local 4567 --remote 127.0.0.1:1234

INFO server > Remote address is: 127.0.0.1:1234 INFO server > 2 cores available INFO server > Created TUN device tun0 INFO server > Listening on 4567

RUST_LOG=info ./phantun_client --ipv4-only --local 127.0.0.1:1234 --remote 5.161.125.1xx:4567 INFO client > Remote address is: 5.161.125.1xx:4567 INFO client > 1 cores available INFO client > Created TUN device tun0

On both sides, the command executes successfully but I cannot pass the data by tunnel

while I am trying to connect with the server on the server side no log or anything showing it's remaining the same as like before

I am using udp2raw for 2 years when we try to connect with the server showing handshake long on the server side as I feel also in this it's supposed to show some log while the client trying to connect.

I changed the port number allowed in iptables in all the possible ways I have tried but the result is the same, I hope I clear myself enough if anyone can fixed the issue please try to help me.

2 things I want to know more if anyone knows

As I mentioned I am using udp2raw I am facing one common issue Extra Bandwidth Usage can this phantun tunnel will help me with that?

2nd as I can see phantun create a tun interface like tinyvpn can I ping the client to sever & server to client both side & through the tun interface can I forward port by iptables

Thanks for your kind attention, waiting for your reply, T.I.A

dndx commented 2 years ago
  1. Phantun definitely have a lower bandwidth overhead than udp2raw, but the main benefit is still the performance side. I don't expect it will significantly reduce the memory usage for you.
  2. The Tun interface is not for handling user traffic, it is how Phantun sends raw IP packet out.
  3. You can use tcpdump on the Tun interface created on both the server/client side to see traffic being sent out, I suspect your server was not configured properly and the TCP packets never reached there in the first place, thus no logs whatsoever.
asterdeve commented 2 years ago

Thanks for your reply Sir, After long research, I found the issue & I also successfully connected with the Phantun Server with Phantun Client & the issue port conflict.

Let me brief you about how we are using udp2raw, we are using udp2raw for asterisk trunking, we run the server like below

Run at server side:

./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777 -k "passwd" --raw-mode faketcp -a

Run at client side

./udp2raw_amd64 -c -l0.0.0.0:3333 -r44.55.66.77:4096 -k "passwd" --raw-mode faketcp -a

& then asterisk server running

[general] bindaddr=127.0.0.1 bindport=7777 nochecksums=yes adsi=no context=block disallow=all allow = g729 trunkmtu = 1240 codecpriority=host requirecalltoken=no trunkfreq=20 trunkmtu=1240 trunktimestamps=yes language=en jitterbuffer=no autokill=yes

[devine] username=devine secret=devine145236 type=friend host=dynamic mask=255.255.255.255 disallow=all allow = gsm requirecalltoken=no qualify=yes trunk=yes transfer=no nat=force_rport,comedia description=IAX2 Trunk Devine

& client side also similar configuration, & it works perfectly, but when I do the same config on phantun it does not work.

I have tried with OpenVPN as well & results are the same, hope you can correct my mistake, please guide me to archive my goal, Thanks for your reply