Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS请求无响应导致无法访问 #92

Closed
bigfoxtail opened this issue Dec 30, 2023 · 4 comments
Closed

DNS请求无响应导致无法访问 #92

bigfoxtail opened this issue Dec 30, 2023 · 4 comments

Comments

@bigfoxtail
Copy link

使用系统:Ubuntu 22.04
hev-socks5-server-linux-x86_64 配置

main:
  workers: 4
  port: 8000
  listen-address: '::'

misc:
  limit-nofile: 65535
  log-file: stdout
  log-level: debug

hev-socks5-tunnel-linux-x86_64 配置

tunnel:
  name: tun0
  mtu: 8500
  multi-queue: false
  ipv4: 198.18.0.1
  ipv6: 'fc00::1'

socks5:
  port: 8000
  address: 192.168.1.151
  udp: 'udp'

测试

#创建命名空间
sudo ip netns add t2sns
sudo ip link set dev tun0 netns t2sns
sudo ip netns exec t2sns ip link set dev tun0 up
sudo ip netns exec t2sns ip addr add 192.168.1.151/24 dev tun0
sudo ip netns exec t2sns ip route add default dev tun0

#在命名空间执行,正常返回数据
sudo ip netns exec t2sns su $USER -c "curl 192.168.1.1"
#无响应
sudo ip netns exec t2sns su $USER -c "curl myip.ipip.net"

请求时服务端日志

[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 construct
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server construct
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 session construct
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 session new
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server run
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server handshake
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server read auth method
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server write auth method
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server read request
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server read addr ip
[2023-12-31 01:18:22] [I] 0x7fa60124a4e0 socks5 server udp [0.0.0.0]:0
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server bind
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 session bind
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server write response
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 server service
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp splicer
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd b
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd f
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp recvfrom udp
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd f
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp recvfrom udp
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd f
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp recvfrom udp
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp sendto
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd b
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp sendto
[2023-12-31 01:18:22] [D] 0x7fa60124a4e0 socks5 udp fwd b
@cattyhouse
Copy link

#17

@heiher
Copy link
Owner

heiher commented Dec 31, 2023

192.168.1.151是socks5服务器,不能路由至tun0,应该bypass。

@bigfoxtail
Copy link
Author

使用作者提供的方法正常,可能是设计不同吧。
我使用的这个方法是从其他项目 xjasonlyu/tun2socks#102 复制的,即时绕过socks5也无法使用,可能是命名空间添加tun0导致的吧。
使用下面代码也不能正常运行。

sudo ip netns add t2sns
sudo ip link set dev tun0 netns t2sns
sudo ip netns exec t2sns ip link set dev tun0 up
sudo ip netns exec t2sns ip addr add 198.18.0.1/24 dev tun0
sudo ip netns exec t2sns ip rule add fwmark 0x438 lookup main pref 10
sudo ip netns exec t2sns ip -6 rule add fwmark 0x438 lookup main pref 10
sudo ip netns exec t2sns ip route add default dev tun0 table 20
sudo ip netns exec t2sns ip rule add lookup 20 pref 20
sudo ip netns exec t2sns ip -6 route add default dev tun0 table 20
sudo ip netns exec t2sns ip -6 rule add lookup 20 pref 20

@heiher
Copy link
Owner

heiher commented Dec 31, 2023

使用作者提供的方法正常,可能是设计不同吧。 我使用的这个方法是从其他项目 xjasonlyu/tun2socks#102 复制的,即时绕过socks5也无法使用,可能是命名空间添加tun0导致的吧。 使用下面代码也不能正常运行。

sudo ip netns add t2sns
sudo ip link set dev tun0 netns t2sns
sudo ip netns exec t2sns ip link set dev tun0 up
sudo ip netns exec t2sns ip addr add 198.18.0.1/24 dev tun0
sudo ip netns exec t2sns ip rule add fwmark 0x438 lookup main pref 10
sudo ip netns exec t2sns ip -6 rule add fwmark 0x438 lookup main pref 10
sudo ip netns exec t2sns ip route add default dev tun0 table 20
sudo ip netns exec t2sns ip rule add lookup 20 pref 20
sudo ip netns exec t2sns ip -6 route add default dev tun0 table 20
sudo ip netns exec t2sns ip -6 rule add lookup 20 pref 20

问题解决了吗?

@heiher heiher closed this as completed Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants