Literally nothing happens!
A5DkjGQUZx opened this issue · 6 comments
Hi
As the subject of the issue says when I run the Linux binary nothing happens. Asked for debug log in the config file but again no nothing in the log!
log-file: /var/log/hevsocks.log
log-level: debug
However, the tun0 device is created. I can confirm this by the ifconfig and syslog output...
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Link UP
Feb 17 18:03:31 ubuntu-lts-hyperv networkd-dispatcher[709]: WARNING:Unknown index 29 seen, reloading interface list
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Gained carrier
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Gained IPv6LL
Feb 17 18:03:31 ubuntu-lts-hyperv systemd-udevd[5027]: Using default interface naming scheme 'v249'.
Feb 17 18:03:31 ubuntu-lts-hyperv NetworkManager[703]: <info> [1676657011.8799] manager: (tun0): new Tun device (/org/freedesktop/NetworkManager/Devices/29)
Feb 17 18:03:34 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Link DOWN
Feb 17 18:03:34 ubuntu-lts-hyperv systemd-networkd[689]: tun0: Lost carrier
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 9000
inet 10.0.0.2 netmask 255.255.255.0 destination 10.0.0.2
inet6 fe80::8d89:35c3:430f:11c5 prefixlen 64 scopeid 0x20<link>
inet6 fc00::2 prefixlen 126 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1 bytes 48 (48.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I just get an output on terminal after killing the process by CTRL+C:
root@ubuntu-lts-hyperv:~/hev-socks5-tunnel# sudo ./hev-socks5-tunnel-linux-x86_64 ./conf/main.yml
**^C[2023-02-17 18:05:01] [E] socks5 tunnel read**
root@ubuntu-lts-hyperv:~/hev-socks5-tunnel#
I am sure about my Socks server health and confirmed it by Curl:
root@ubuntu-lts-hyperv:~# curl -x socks5h://localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
root@ubuntu-lts-hyperv:~#
root@ubuntu-lts-hyperv:~# curl -x socks5h://localhost:1080 --output deleteme -L https://github.com/heiher/hev-socks5-tunnel/archive/refs/tags/2.4.3.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 21817 0 21817 0 0 10398 0 --:--:-- 0:00:02 --:--:-- 67129
root@ubuntu-lts-hyperv:~#
I must also add that I used my locally compiled binary and the latest available release here on Github.
Sorry that I cannot provide more details. As I said these are literally ALL I have.
P.S.
This is my OS details:
root@ubuntu-lts-hyperv:~# uname -a
Linux ubuntu-lts-hyperv 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu-lts-hyperv:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
root@ubuntu-lts-hyperv:~#
P.P.S
Proper source policy based routing is also done:
echo 100 tun2socks >> /etc/iproute2/rt_tables
ip rule add from 10.0.0.0/24 dev tun0 table tun2socks
ip route add default via 10.0.0.1 dev tun0 table tun2socks
root@ubuntu-lts-hyperv:~# ip rule ls
0: from all lookup local
32765: from 10.0.0.0/24 iif tun0 lookup tun2socks
32766: from all lookup main
32767: from all lookup default
root@ubuntu-lts-hyperv:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.25.192.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.25.192.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
root@ubuntu-lts-hyperv:~# ip route
default via 172.25.192.1 dev eth0 proto static
10.0.0.0/24 dev tun0 proto kernel scope link src 10.0.0.2
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.25.192.0/20 dev eth0 proto kernel scope link src 172.25.205.30
root@ubuntu-lts-hyperv:~# ip route list table tun2socks
default via 10.0.0.1 dev tun0
My bad regarding no logs. I made a mistake in YAML config file. I forgot to uncomment the header #misc:
section. Now I do have log but not much information is provided even in the debug level!
root@ubuntu-lts-hyperv:~# tail -f /var/log/hevsocks.log
[2023-02-18 08:47:59] [E] socks5 tunnel read
[2023-02-18 08:48:26] [D] socks5 tunnel init
[2023-02-18 08:48:26] [D] socks5 tunnel run
[2023-02-18 08:48:26] [D] socks5 tunnel lwip task run
[2023-02-18 08:48:26] [D] socks5 tunnel timer task run
[2023-02-18 08:48:26] [D] socks5 tunnel event task run
[2023-02-18 08:50:39] [D] socks5 tunnel stop
[2023-02-18 08:50:39] [E] socks5 tunnel read
[2023-02-18 08:50:39] [D] socks5 tunnel fini
[2023-02-18 08:50:59] [D] socks5 tunnel init
[2023-02-18 08:50:59] [D] socks5 tunnel run
[2023-02-18 08:50:59] [D] socks5 tunnel lwip task run
[2023-02-18 08:50:59] [D] socks5 tunnel timer task run
[2023-02-18 08:50:59] [D] socks5 tunnel event task run
IP address connectivity is also confirmed:
root@ubuntu-lts-hyperv:~# fping 10.0.0.1
10.0.0.1 is alive
root@ubuntu-lts-hyperv:~# fping 10.0.0.2
10.0.0.2 is alive
But when I test with Curl:
root@ubuntu-lts-hyperv:~# sudo curl -I 10.0.0.2 google.com
curl: (7) Failed to connect to 10.0.0.2 port 80 after 0 ms: Connection refused
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Sat, 18 Feb 2023 09:00:11 GMT
Expires: Mon, 20 Mar 2023 09:00:11 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
root@ubuntu-lts-hyperv:~# sudo curl -I tun0 google.com
curl: (6) Could not resolve host: tun0
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Sat, 18 Feb 2023 09:00:44 GMT
Expires: Mon, 20 Mar 2023 09:00:44 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
root@ubuntu-lts-hyperv:~# curl -x socks5h://localhost:1080 google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
Did you add a default route for tun0 and a high priority route for upstream socks5 to avoid loops into tun0?
Did you add a default route for tun0 and a high priority route for upstream socks5 to avoid loops into tun0?
I used source address policy based routing so just traffic with source IP address of the tun interface will have default gateway of the tun2socks.
All other traffic is going out as normal. Confirmed this by using curl -x socks5h://localhost:1080 google.com
.
echo 100 tun2socks >> /etc/iproute2/rt_tables
ip rule add from 10.0.0.0/24 dev tun0 table tun2socks
ip route add default via 10.0.0.1 dev tun0 table tun2socks
root@ubuntu-lts-hyperv:~# ip rule ls
0: from all lookup local
32765: from 10.0.0.0/24 iif tun0 lookup tun2socks
32766: from all lookup main
32767: from all lookup default
root@ubuntu-lts-hyperv:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.25.192.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.25.192.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
root@ubuntu-lts-hyperv:~# ip route
default via 172.25.192.1 dev eth0 proto static
10.0.0.0/24 dev tun0 proto kernel scope link src 10.0.0.2
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.25.192.0/20 dev eth0 proto kernel scope link src 172.25.205.30
root@ubuntu-lts-hyperv:~# ip route list table tun2socks
default via 10.0.0.1 dev tun0
ok, i see. please try compile master commit from source and enable udp over udp in config file:
socks5:
udp: udp
Problem seems to be solved by compiling from the master commit and using udp:udp.
Will provide more details later. I want to use it for a transparent proxy (NAT gateway) with Xray.
So far so good...
root@ubuntu-lts-hyperv:~# speedtest -I tun0
Speedtest by Ookla
Server: Claranet Benelux B.V. - Amsterdam (id: 30847)
ISP: LeaseWeb Netherlands B.V.
Idle Latency: 121.84 ms (jitter: 4.37ms, low: 118.99ms, high: 127.04ms)
Download: 30.25 Mbps (data used: 50.7 MB)
196.68 ms (jitter: 39.85ms, low: 121.75ms, high: 810.43ms)
Upload: 3.72 Mbps (data used: 4.9 MB)
937.56 ms (jitter: 36.88ms, low: 131.87ms, high: 2218.23ms)
Packet Loss: 0.0%
Result URL: https://www.speedtest.net/result/c/2b183239-1f37-4aca-98bf-db676161c2ac