shadowsocks / shadowsocks-rust

A Rust port of shadowsocks
https://shadowsocks.org/
MIT License
8.65k stars 1.17k forks source link

how to use tun in windows with sslocal #1389

Closed robyousugar closed 10 months ago

robyousugar commented 10 months ago

i downloaded wintun.dll and run sslocal.exe use -s "server" -m "aes-256-gcm" -k "key" --protocol tun --tun-interface-name "shadowsocks" -U.

2023-12-25T16:52:07.393074600+08:00 INFO shadowsocks local 1.17.2 build 2023-12-22T10:02:14.851068900+00:00 2023-12-25T16:52:08.022934300+08:00 INFO shadowsocks tun device shadowsocks, mode tcp_and_udp 2023-12-25T16:52:08.082894900+08:00 INFO [TUN] tun device network: 10.1.0.2/24 (address: 10.1.0.2, netmask: 255.255.255.0)

PixPin_2023-12-25_16-42-19

i miss some arg?

zonyitoo commented 10 months ago

It was quite a long time since I tested the Windows tun on my Windows VM. You may try to add -vvv and see what exactly it was received from Windows.

robyousugar commented 10 months ago

2023-12-26T09:34:36.357197300+08:00 ERROR [13004:13020] [wintun::log] WinTun: Failed to find matching adapter name: 找不到元素。 (Code 0x00000490) how to fix this?

zonyitoo commented 10 months ago

Please paste the full log. I think that was just indicated that wintun was going to create that interface.

robyousugar commented 10 months ago

2023-12-26T09:43:11.454710800+08:00 TRACE [1176:944] [shadowsocks_rust::service::local] Config { log: LogConfig { level: 3, format: LogFormatConfig { without_time: false }, config_path: None }, runtime: RuntimeConfig { worker_count: None, mode: MultiThread } } 2023-12-26T09:43:11.472267400+08:00 INFO [1176:944] [shadowsocks_rust::service::local] shadowsocks local 1.17.2 build 2023-12-22T10:02:14.851068900+00:00 2023-12-26T09:43:11.475336200+08:00 TRACE [1176:944] [shadowsocks_service::local] Config { server: [ServerInstanceConfig { config: ServerConfig { addr: SocketAddr(server:port), password: "password", method: AES_256_GCM, enc_key: [mask], timeout: None, identity_keys: [], user_manager: None, plugin: None, plugin_addr: None, remarks: None, id: None, mode: TcpAndUdp, weight: ServerWeight { tcp_weight: 1.0, udp_weight: 1.0 } }, acl: None }], local: [LocalInstanceConfig { config: LocalConfig { addr: None, protocol: Tun, mode: TcpAndUdp, udp_addr: None, tun_interface_name: Some("shadowsocks"), tun_interface_address: None, tun_interface_destination: None, ipv6_only: false, socks5_auth: Socks5AuthConfig { passwd: Socks5AuthPasswdConfig { passwd: {} } } }, acl: None }], dns: System, dns_cache_size: None, ipv6_first: false, ipv6_only: false, no_delay: false, fast_open: false, keep_alive: None, mptcp: false, outbound_bind_interface: None, outbound_bind_addr: None, inbound_send_buffer_size: None, inbound_recv_buffer_size: None, outbound_send_buffer_size: None, outbound_recv_buffer_size: None, manager: None, config_type: Local, udp_timeout: None, udp_max_associations: None, acl: None, security: SecurityConfig { replay_attack: SecurityReplayAttackConfig { policy: Default } }, balancer: BalancerConfig { max_server_rtt: None, check_interval: None, check_best_interval: None }, config_path: None, worker_count: 1 } 2023-12-26T09:43:11.525600900+08:00 TRACE [1176:944] [shadowsocks_service::dns] initialized DNS system resolver builtin 2023-12-26T09:43:11.526884400+08:00 TRACE [1176:944] [shadowsocks_service::local::loadbalancing::ping_balancer] init chose TCP server server:port 2023-12-26T09:43:11.528852100+08:00 TRACE [1176:944] [shadowsocks_service::local::loadbalancing::ping_balancer] init chose UDP server server:port 2023-12-26T09:43:11.535205200+08:00 ERROR [1176:944] [wintun::log] WinTun: Failed to find matching adapter name: 找不到元素。 (Code 0x00000490) 2023-12-26T09:43:11.590532500+08:00 INFO [1176:944] [wintun::log] WinTun: Using existing driver 0.14 2023-12-26T09:43:11.595465600+08:00 INFO [1176:944] [wintun::log] WinTun: Creating adapter 2023-12-26T09:43:11.824744600+08:00 INFO [1176:1216] [shadowsocks_service::local::tun] shadowsocks tun device shadowsocks, mode tcp_and_udp 2023-12-26T09:43:11.883053800+08:00 INFO [1176:1216] [shadowsocks_service::local::tun] [TUN] tun device network: 10.1.0.2/24 (address: 10.1.0.2, netmask: 255.255.255.0) 2023-12-26T09:43:11.889844600+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] received IP packet b"\x00\x00\x00\x00\x18:\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x90Q\t\x87\x00\x9fK\x00\x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t" 2023-12-26T09:43:11.949166600+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] IP packet :: (unicast? false) -> ff02::1:ff90:5109 (unicast? false) throwing away 2023-12-26T09:43:11.960664900+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] received IP packet b"\x00\x00\x00\x00\x08:\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x85\x00\xf1\xf4\x00\x00\x00\x00" 2023-12-26T09:43:11.991784500+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] IP packet fe80::1d90:7518:a790:5109 (unicast? true) -> ff02::2 (unicast? false) throwing away 2023-12-26T09:43:11.995256300+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] received IP packet b"\x00\x00\x00\x00$\x00\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16:\x00\x05\x02\x00\x00\x01\x00\x8f\x00\x94-\x00\x00\x00\x01\x04\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x90Q\t" 2023-12-26T09:43:12.026398+08:00 TRACE [1176:1216] [shadowsocks_service::local::tun] [TUN] IP packet fe80::1d90:7518:a790:5109 (unicast? true) -> ff02::16 (unicast? false) throwing away 2023-12-26T09:43:12.897112400+08:00 TRACE [1176:3184] [shadowsocks_service::local::tun] [TUN] received IP packet b"\x00\x00\x00\x00$\x00\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16:\x00\x05\x02\x00\x00\x01\x00\x8f\x00\x94-\x00\x00\x00\x01\x04\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x90Q\t\x00\x00\x00\x00\x1a:\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x88\x00C \x00\x00\x00\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\x02\x00\x00\x00\x00\x00$\x00\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16:\x00\x05\x02\x00\x00\x01\x00\x8f\x00\xe4\xc4\x00\x00\x00\x01\x04\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x03" 2023-12-26T09:43:13.010268100+08:00 TRACE [1176:3184] [shadowsocks_service::local::tun] [TUN] IP packet fe80::1d90:7518:a790:5109 (unicast? true) -> ff02::16 (unicast? false) throwing away 2023-12-26T09:43:13.013250600+08:00 TRACE [1176:3184] [shadowsocks_service::local::tun] [TUN] received IP packet b"`\x00\x00\x00\x00$\x00\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x1d\x90u\x18\xa7\x90Q\t\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16:\x00\x05\x02\x00\x00\x01\x00\x8f\x00\xe3\xcd\x00\x00\x00\x01\x04\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfb"

robyousugar commented 10 months ago

tun not work.Traffic don't pass through the proxy.need change routing table?

zonyitoo commented 10 months ago

Yes, you have to set the route table to route specific traffic to the interface.

robyousugar commented 10 months ago

thank you.