FlowerWrong / tun2socks

Redirect tun flow to socks 5 in golang, support tcp and udp.
420 stars 108 forks source link

不是bug,问题协助 #30

Closed Archieeeeee closed 6 years ago

Archieeeeee commented 6 years ago

在学习这个repo的代码,看到netstack库有个tun_tcp_echo例子跑了一下没跑通,运行程序后没有看到端口有被监听到:

添加tun设备,启动测试

$ sudo ip tuntap add mode tun tun0 $ sudo ip link set tun0 up $ sudo ip addr add 192.168.1.1/24 dev tun0 $ ./tun_tcp_echo tun0 192.168.1.1 9999

查看监听端口

$ netstat -lnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 15505/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:
LISTEN 1298/master
udp 0 0 127.0.0.1:323 0.0.0.0: 15939/chronyd
udp6 0 0 ::1:323 :::
15939/chronyd
Active UNIX domain sockets (only servers)...

查了下这是当时的tun状态

$ ip addr show dev tun0 7: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 500 link/none inet 192.168.1.1/24 scope global tun0 valid_lft forever preferred_lft forever

我是在CentOS 7上跑代码的,帮我看下问题感谢

FlowerWrong commented 6 years ago

https://github.com/FlowerWrong/yyrp/blob/master/examples/netstack/setup.md#setup-netstack-on-archlinux

我当初使用的,你试试。

FlowerWrong commented 6 years ago

非该项目的,我关闭了。