wangyu- / UDPspeeder

A Tunnel which Improves your Network Quality on a High-latency Lossy Link by using Forward Error Correction, possible for All Traffics(TCP/UDP/ICMP)
MIT License
4.63k stars 823 forks source link

UDPspeeder和UDp2raw搭建之后,在路由器端开启之后UDP数据包全部丢失 #120

Open SCGabriel opened 6 years ago

SCGabriel commented 6 years ago

之前没有任何经验,就是看到大佬的UDPspeeder想试下效果,自己租了个服务器搭建的 VPS是租用的UFOVPShttps://www.ufovps.com/的香港沙田CN2专线,系统是centos-6.6-x86_64 服务器端的设置是

udpspeeder

speederv2 -s -l0.0.0.0:28900 -r127.0.0.1:1■■4 -f2:4 -k "A■■■e" --mode 0 -q1 &

[root@A■■■-■■■ee ~]# [2018-02-25 21:18:32][INFO]argc=10 speederv2 -s -l0.0.0.0:28900 -r127.0.0.1:1■■4 -f2:4 -k A■■■e --mode 0 -q1 [2018-02-25 21:18:32][INFO]jitter_min=0 jitter_max=0 output_interval_min=0 output_interval_max=0 fec_timeout=8 fec_data_num=2 fec_redundant_num=4 fec_mtu=1250 fec_queue_len=1 fec_mode=0 [2018-02-25 21:18:32][INFO]now listening at 0.0.0.0:28900

UDP2raw

udp2raw -s -l0.0.0.0:28901 -r127.0.0.1:28900 -a -k "A■■■e" --raw-mode faketcp &

[root@A■■■-■■■ee ~]# [2018-02-25 21:21:11][INFO]argc=9 udp2raw -s -l0.0.0.0:28901 -r127.0.0.1:28900 -a -k A■■■e --raw-mode faketcp [2018-02-25 21:21:11][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=md5 key=A■■■e local_ip=0.0.0.0 local_port=28901 remote_ip=127.0.0.1 remote_port=28900 source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576 [2018-02-25 21:21:11][WARN]you can run udp2raw with non-root account for better security. check README.md in repo for more info. [2018-02-25 21:21:11][INFO]const_id:d9d0cbdd [2018-02-25 21:21:11][INFO]run_command iptables -N udp2rawDwrW_d9d0cbdd_C0 [2018-02-25 21:21:11][INFO]run_command iptables -F udp2rawDwrW_d9d0cbdd_C0 [2018-02-25 21:21:11][INFO]run_command iptables -I udp2rawDwrW_d9d0cbdd_C0 -j DROP [2018-02-25 21:21:11][INFO]run_command iptables -I INPUT -p tcp -m tcp --dport 28901 -j udp2rawDwrW_d9d0cbdd_C0 [2018-02-25 21:21:11][WARN]auto added iptables rules [2018-02-25 21:21:11][INFO]now listening at 0.0.0.0:28901

================================================= 路由器端设置 01

02

这般设置之后,一开启UDP数据包就全丢,PS4显示NAT类型失败,单开UDPspeeder也不行。 因为是新开的VPS,所以iptable应该是没问题的吧? 然后咱在Vultr的日本VPS上跑也是UDP数据包全丢

我自己家是江西电信,有公网IP

SCGabriel commented 6 years ago

虽然发现路由器上的设置错误,但是修正了让朋友帮忙试验还是NAT失败,等回家看出了什么问题不

wangyu- commented 6 years ago

https://www.v2ex.com/t/432630

如果你确实都敲对了,仍然NAT不通。建议:

  1. 检查UDPspeeder和UDP2raw进程是否还活着

  2. 检查$$是否监听在1■■4 的 0.0.0.0

  3. 清空iptables后重试:

https://github.com/wangyu-/tinyfecVPN/wiki/清空iptables的方法

SCGabriel commented 6 years ago

好吧,发现VPS进程里udpspeeder和UDP2raw的进程都没了,重新打指令的话就通了,现在在研究怎么让这两行指令开机启动,或者说不会没了

[root@A■■■e-R███e ~]# speederv2 -s -l0.0.0.0:28900 -r127.0.0.1:1■■4 -f2:4 -k "A■■■e" --mode 0 -q1 & [1] 16297 [root@A■■■e-R███e ~]# [2018-02-26 18:00:31][INFO]argc=10 speederv2 -s -l0.0.0.0:28900 -r127.0.0.1:1■■4 -f2:4 -k A■■■e --mode 0 -q1 [2018-02-26 18:00:31][INFO]jitter_min=0 jitter_max=0 output_interval_min=0 output_interval_max=0 fec_timeout=8 fec_data_num=2 fec_redundant_num=4 fec_mtu=1250 fec_queue_len=1 fec_mode=0 [2018-02-26 18:00:31][INFO]now listening at 0.0.0.0:28900 udp2raw -s -l0.0.0.0:28901 -r127.0.0.1:28900 -a -k "A■■■e" --raw-mode faketcp & [2] 16309 [root@A■■■e-R███e ~]# [2018-02-26 18:01:16][INFO]argc=9 udp2raw -s -l0.0.0.0:28901 -r127.0.0.1:28900 -a -k A■■■e --raw-mode faketcp [2018-02-26 18:01:16][INFO]important variables: log_level=4:INFO raw_mode=faketcp cipher_mode=aes128cbc auth_mode=md5 key=A■■■e local_ip=0.0.0.0 local_port=28901 remote_ip=127.0.0.1 remote_port=28900 source_ip=0.0.0.0 source_port=0 socket_buf_size=1048576 [2018-02-26 18:01:16][WARN]you can run udp2raw with non-root account for better security. check README.md in repo for more info. [2018-02-26 18:01:16][INFO]const_id:5d802c9 [2018-02-26 18:01:16][INFO]run_command iptables -N udp2rawDwrW_5d802c9_C0 [2018-02-26 18:01:16][INFO]run_command iptables -F udp2rawDwrW_5d802c9_C0 [2018-02-26 18:01:16][INFO]run_command iptables -I udp2rawDwrW_5d802c9_C0 -j DROP [2018-02-26 18:01:16][INFO]run_command iptables -I INPUT -p tcp -m tcp --dport 28901 -j udp2rawDwrW_5d802c9_C0 [2018-02-26 18:01:16][WARN]auto added iptables rules [2018-02-26 18:01:16][INFO]now listening at 0.0.0.0:28901 [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]received syn,sent syn ack back [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]got packet from a new ip [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]created new conn,state: server_handshake1,my_id is cc10a159 [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]changed state to server_handshake1,my_id is cc10a159 [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]received handshake oppsite_id:e7714156 my_id:cc10a159 [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]oppsite const_id:6ce87f77 [2018-02-26 18:01:46][INFO][59.■■■.■■■.82:4■■82]changed state to server_ready [2018-02-26 18:01:49][INFO][59.■■■.■■■.82:4■■82]new conv conv_id=8953aba4, assigned fd=10 [2018-02-26 18:01:50][INFO]new connection from 127.0.0.1:58254 [2018-02-26 18:01:50][INFO][127.0.0.1:58254]new conv 4ab3e4b1,fd 10 created,fd64=4294967398 [2018-02-26 18:02:07][INFO][59.■■■.■■■.82:45568]received syn,sent syn ack back [2018-02-26 18:02:07][INFO][59.■■■.■■■.82:45568]got packet from a new ip [2018-02-26 18:02:07][INFO][59.■■■.■■■.82:45568]created new conn,state: server_handshake1,my_id is 8d09ef25 [2018-02-26 18:02:07][INFO][59.■■■.■■■.82:45568]changed state to server_handshake1,my_id is 8d09ef25 [2018-02-26 18:02:08][INFO][59.■■■.■■■.82:45568]received handshake oppsite_id:d32de981 my_id:8d09ef25 [2018-02-26 18:02:08][INFO][59.■■■.■■■.82:45568]oppsite const_id:6ce87f77 [2018-02-26 18:02:08][INFO][59.■■■.■■■.82:45568]grabbed a connection [2018-02-26 18:02:19][INFO][59.■■■.■■■.82:45568]inactive conn cleared [2018-02-26 18:02:20][WARN][59.■■■.■■■.82,49582]rst==1,cnt=1 [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]received syn,sent syn ack back [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]got packet from a new ip [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]created new conn,state: server_handshake1,my_id is ba58cc00 [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]changed state to server_handshake1,my_id is ba58cc00 [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]received handshake oppsite_id:e99c23dc my_id:ba58cc00 [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]oppsite const_id:6ce87f77 [2018-02-26 18:02:28][INFO][59.■■■.■■■.82:33501]grabbed a connection [2018-02-26 18:02:39][INFO][59.■■■.■■■.82:33501]inactive conn cleared [2018-02-26 18:02:48][WARN][59.■■■.■■■.82,45568]rst==1,cnt=1 [2018-02-26 18:03:13][INFO][59.■■■.■■■.82:28964]received syn,sent syn ack back [2018-02-26 18:03:13][INFO][59.■■■.■■■.82:28964]got packet from a new ip [2018-02-26 18:03:13][INFO][59.■■■.■■■.82:28964]created new conn,state: server_handshake1,my_id is 91dfd00e [2018-02-26 18:03:13][INFO][59.■■■.■■■.82:28964]changed state to server_handshake1,my_id is 91dfd00e [2018-02-26 18:03:14][INFO][59.■■■.■■■.82:28964]received handshake oppsite_id:328a3d37 my_id:91dfd00e [2018-02-26 18:03:14][INFO][59.■■■.■■■.82:28964]oppsite const_id:6ce87f77 [2018-02-26 18:03:14][INFO][59.■■■.■■■.82:28964]grabbed a connection [2018-02-26 18:03:22][INFO][127.0.0.1:58254]new conv 1fc06cdf,fd 11 created,fd64=4294967399 [2018-02-26 18:03:24][INFO][127.0.0.1:58254]new conv 8f238fd6,fd 12 created,fd64=4294967400 [2018-02-26 18:03:25][INFO][59.■■■.■■■.82:28964]inactive conn cleared [2018-02-26 18:03:37][INFO][59.■■■.■■■.82:23029]received syn,sent syn ack back [2018-02-26 18:03:38][INFO][59.■■■.■■■.82:23029]received syn,sent syn ack back [2018-02-26 18:03:38][INFO][59.■■■.■■■.82:23029]got packet from a new ip [2018-02-26 18:03:38][INFO][59.■■■.■■■.82:23029]created new conn,state: server_handshake1,my_id is b1a7d80c [2018-02-26 18:03:38][INFO][59.■■■.■■■.82:23029]changed state to server_handshake1,my_id is b1a7d80c [2018-02-26 18:03:41][INFO][59.■■■.■■■.82:23029]changed state to server_handshake1,my_id is b1a7d80c [2018-02-26 18:03:41][INFO][59.■■■.■■■.82:23029]received handshake oppsite_id:35253009 my_id:b1a7d80c [2018-02-26 18:03:41][INFO][59.■■■.■■■.82:23029]oppsite const_id:6ce87f77 [2018-02-26 18:03:41][INFO][59.■■■.■■■.82:23029]grabbed a connection [2018-02-26 18:03:45][INFO][127.0.0.1:58254]new conv 429651ed,fd 13 created,fd64=4294967401 [2018-02-26 18:03:50][INFO][59.■■■.■■■.82:23029]inactive conn cleared [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]received syn,sent syn ack back [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]got packet from a new ip [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]created new conn,state: server_handshake1,my_id is 395267b6 [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]changed state to server_handshake1,my_id is 395267b6 [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]received handshake oppsite_id:e422d5af my_id:395267b6 [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]oppsite const_id:6ce87f77 [2018-02-26 18:04:02][INFO][59.■■■.■■■.82:31842]grabbed a connection [2018-02-26 18:04:13][INFO][59.■■■.■■■.82:31842]inactive conn cleared [2018-02-26 18:04:14][WARN][59.■■■.■■■.82,33501]rst==1,cnt=1 [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]received syn,sent syn ack back [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]got packet from a new ip [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]created new conn,state: server_handshake1,my_id is 65d72f47 [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]changed state to server_handshake1,my_id is 65d72f47 [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]received handshake oppsite_id:e48bd3ef my_id:65d72f47 [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]oppsite const_id:6ce87f77 [2018-02-26 18:04:52][INFO][59.■■■.■■■.82:16848]grabbed a connection [2018-02-26 18:04:56][WARN][59.■■■.■■■.82,23029]rst==1,cnt=1 [2018-02-26 18:05:03][INFO][59.■■■.■■■.82:16848]inactive conn cleared [2018-02-26 18:05:08][WARN][59.■■■.■■■.82,28964]rst==1,cnt=1 [2018-02-26 18:05:32][INFO]conv 4ab3e4b1 cleared [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]received syn,sent syn ack back [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]got packet from a new ip [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]created new conn,state: server_handshake1,my_id is 22a09467 [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]changed state to server_handshake1,my_id is 22a09467 [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]received handshake oppsite_id:2aabbaeb my_id:22a09467 [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]oppsite const_id:6ce87f77 [2018-02-26 18:06:01][INFO][59.■■■.■■■.82:30462]grabbed a connection [2018-02-26 18:06:08][WARN][59.■■■.■■■.82,31842]rst==1,cnt=1 [2018-02-26 18:06:13][INFO][59.■■■.■■■.82:30462]inactive conn cleared [2018-02-26 18:06:14][WARN][59.■■■.■■■.82,16848]rst==1,cnt=1 [2018-02-26 18:06:24][INFO]conv 8f238fd6 cleared [2018-02-26 18:06:54][INFO][127.0.0.1:58254]new conv 63a131f2,fd 10 created,fd64=4294967402 [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]received syn,sent syn ack back [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]got packet from a new ip [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]created new conn,state: server_handshake1,my_id is d03e99dd [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]changed state to server_handshake1,my_id is d03e99dd [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]received handshake oppsite_id:290db80e my_id:d03e99dd [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]oppsite const_id:6ce87f77 [2018-02-26 18:07:13][INFO][59.■■■.■■■.82:21061]grabbed a connection [2018-02-26 18:07:25][INFO][59.■■■.■■■.82:21061]inactive conn cleared [2018-02-26 18:07:38][INFO][127.0.0.1:58254]new conv 63a21d37,fd 12 created,fd64=4294967403 [2018-02-26 18:07:38][WARN][59.■■■.■■■.82,30462]rst==1,cnt=1 [2018-02-26 18:08:03][INFO][59.■■■.■■■.82:15630]received syn,sent syn ack back [2018-02-26 18:08:03][INFO][59.■■■.■■■.82:15630]got packet from a new ip [2018-02-26 18:08:03][INFO][59.■■■.■■■.82:15630]created new conn,state: server_handshake1,my_id is 813a2843 [2018-02-26 18:08:03][INFO][59.■■■.■■■.82:15630]changed state to server_handshake1,my_id is 813a2843 [2018-02-26 18:08:04][INFO][59.■■■.■■■.82:15630]received handshake oppsite_id:680c47f9 my_id:813a2843 [2018-02-26 18:08:04][INFO][59.■■■.■■■.82:15630]oppsite const_id:6ce87f77 [2018-02-26 18:08:04][INFO][59.■■■.■■■.82:15630]grabbed a connection [2018-02-26 18:08:15][INFO][59.■■■.■■■.82:15630]inactive conn cleared [2018-02-26 18:08:22][INFO][59.■■■.■■■.82:25006]received syn,sent syn ack back [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]got packet from a new ip [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]created new conn,state: server_handshake1,my_id is b486c05a [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]changed state to server_handshake1,my_id is b486c05a [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]received handshake oppsite_id:75e5e896 my_id:b486c05a [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]oppsite const_id:6ce87f77 [2018-02-26 18:08:23][INFO][59.■■■.■■■.82:25006]grabbed a connection [2018-02-26 18:08:34][INFO][59.■■■.■■■.82:25006]inactive conn cleared [2018-02-26 18:08:38][WARN][59.■■■.■■■.82,15630]rst==1,cnt=1 [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]received syn,sent syn ack back [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]got packet from a new ip [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]created new conn,state: server_handshake1,my_id is f174fb8d [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]changed state to server_handshake1,my_id is f174fb8d [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]received handshake oppsite_id:17bdadc6 my_id:f174fb8d [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]oppsite const_id:3431dec2 [2018-02-26 18:09:01][INFO][116.■■■.■■■.232:5788]changed state to server_ready

SCGabriel commented 6 years ago

感谢大佬

AqgRVQEP commented 6 years ago

用tmux 保持vps后台两个进程活着