Closed A5DkjGQUZx closed 1 year ago
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
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!
However, the tun0 device is created. I can confirm this by the ifconfig and syslog output...
I just get an output on terminal after killing the process by CTRL+C:
I am sure about my Socks server health and confirmed it by Curl:
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:
P.P.S Proper source policy based routing is also done: