cnbatch / kcptube

同时支持传送TCP与UDP的KCP通道,附带端口跳跃的功能,以及FEC,自带中继服务器支持
BSD 3-Clause "New" or "Revised" License
115 stars 15 forks source link

how to install wireguard in kcptube? #20

Open linnuxx opened 5 months ago

linnuxx commented 5 months ago

.

cnbatch commented 5 months ago

In order to forward the traffic of wireguard to kcptube, the WireGuard listening address and communication address should both point to the kcptube forwarding port on the local machine.

Assume that home pc is client and 'ipvds' is server, wireguard and kcptube are running on the same machine. If so, please modify the configureations as below:

wgclient:[Interface] PrivateKey = key

~ListenPort = 51820~

Address = 192.168.168.10/24 MTU = 1300

DNS = 1.1.1.1

[Peer] PublicKey = key AllowedIPs = 192.168.168.9/24

~Endpoint = ipvds:51820~

Endpoint = 127.0.0.1:51820 PersistentKeepalive = 20

wgserver: [Interface] PrivateKey = key ListenPort = 51820 Address = 192.168.168.9/24 MTU = 1300 [Peer] PublicKey = key AllowedIPs = 192.168.168.10/24 AllowedIPs = 192.168.0.10/24 AllowedIPs = 192.168.0.0/24 AllowedIPs = 192.168.1.0/24

PersistentKeepalive = 20

homepc:

~mode=server~

mode=client kcp=regular3 inbound_bandwidth=1G outbound_bandwidth=1G

~listen_port=3000~

listen_port=51820

~destination_port=51820~

destination_port=59000 destination_address=ipvds encryption_password=qwerty1234 encryption_algorithm=AES-GCM

~stun_server=stun.qq.com~

~log_path=./~

vds:

~mode=client~

mode=server kcp=regular3 inbound_bandwidth=500M outbound_bandwidth=50M listen_port=59000

~destination_port=3000~

destination_port=51820

~destination_address=iphomepc from 2ip.me~

destination_address=127.0.0.1 encryption_password=qwerty1234 encryption_algorithm=AES-GCM

graph LR;
    wgclient["wgclient, connect to 127.0.0.1:51820"]-->local["kcptube (client), listen on 51820, connect to rempte:59000"];
    local-->remote["kcptube (server), listen on 59000, connect to wgserver"];
    remote-->wgserver["wgserver, listen on 51820"];
linnuxx commented 5 months ago

wireguard and kcptube

wireguard and kcptube - works on different external IP addresses, so there is no access over the local network.

cnbatch commented 5 months ago

Is #21 the new configuration settings?

If so, the wireguard connection is connected directly via internet. No traffic is forwarded by kcptube.